Commit 03a7b3d
🤖 Add Comprehensive AI Agent Friendly CLI Support (#221)
* feat: add comprehensive AI agent friendly CLI support
This commit implements comprehensive non-interactive CLI support for AI agents across all major MCPM commands:
**Server Management (mcpm new, mcpm edit):**
- Non-interactive server creation with --type, --command, --args, --env, --url, --headers
- Field-specific server editing with CLI parameters
- Environment variable support for automation
**Profile Management (mcpm profile edit, mcpm profile inspect):**
- Server management via --add-server, --remove-server, --set-servers
- Profile renaming with --name parameter
- Enhanced inspect with --port, --host, --http, --sse options
**Client Management (mcpm client edit):**
- Server and profile management for MCP clients
- Support for --add-server, --remove-server, --set-servers
- Profile operations with --add-profile, --remove-profile, --set-profiles
**Infrastructure:**
- New non-interactive utilities in src/mcpm/utils/non_interactive.py
- Environment variable detection (MCPM_NON_INTERACTIVE, MCPM_FORCE)
- Parameter parsing and validation utilities
- Server configuration creation and merging
**Documentation and Automation:**
- Automatic llm.txt generation for AI agents
- GitHub Actions workflow for continuous documentation updates
- Developer tools for local llm.txt generation
- Comprehensive AI agent integration guide
**Key Benefits:**
- Complete automation support with no interactive prompts
- Environment variable configuration for sensitive data
- Batch operations and structured error handling
- 100% backward compatibility with existing interactive workflows
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: simplify CLI help text to remove redundant information
- Streamlined docstrings for new, edit, profile edit, profile inspect, and client edit
- Removed verbose examples that duplicated parameter descriptions
- Focused on concise, essential information in help output
- Regenerated llm.txt with cleaner documentation (23KB vs 27KB)
- Improved user experience with less cluttered help screens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve linting errors and test failures after AI-agent CLI updates
- Fix unused variable in generate_llm_txt.py
- Clean up whitespace in docstrings throughout non_interactive.py
- Fix edit command to properly exit with return codes using sys.exit()
- Update tests to correctly mock non-interactive detection
- Fix client edit test to avoid non-interactive mode for external editor test
- Update test assertions to match new simplified help text
All tests now pass (113 passed, 6 skipped) and linting is clean.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* test: add comprehensive non-interactive tests for AI-agent CLI commands
- Add non-interactive test coverage for mcpm edit, profile edit, profile inspect, client edit, and config set commands
- Fix exit code handling in commands to properly use sys.exit() for non-interactive mode
- Fix remote server environment variable validation in non_interactive.py
- Update existing tests to match corrected command behavior
- Ensure all AI-agent friendly CLI commands have proper test coverage
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve test failures in edit and client commands
- Fix RemoteServerConfig env field access issue in edit command
- Update client edit tests to use add_server instead of update_servers
- Fix profile test assertions for correct output messages
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve mypy errors and remove duplicate function
- Remove duplicate _edit_server_non_interactive function definition
- Add Union type annotation to fix mypy type compatibility issues
- Import Union from typing module
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve all remaining profile command test failures
- Fix mock setups for profile edit tests to match actual implementation
- Update profile edit tests to use correct method calls (clear_profile, add_server_to_profile, etc.)
- Fix server validation by mocking list_servers correctly
- Handle profile name conflict checking in rename tests
- Fix subprocess mocking in profile inspect tests
- Update assertion expectations to match actual command behavior
All tests now passing: 155 passed, 6 skipped
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: add missing mock for client edit test failing in CI
- Add GlobalConfigManager mock to test_client_edit_command_client_not_installed
- Ensures test has servers available to avoid early exit with code 1
- Fixes CI test failure where no servers were available
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* test: add assertion for remove_server method call in client edit test
- Enhanced test_client_edit_non_interactive_remove_server to verify that
client_manager.remove_server is called with the correct prefixed server name
- Added proper mock setup for MCPM-managed server configuration
- Ensures the removal operation is actually triggered as intended
- Also includes automatic formatting fixes in test_profile_commands.py
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* test: add assertion for add_server method call in client edit test
- Enhanced test_client_edit_non_interactive_add_server to verify that
client_manager.add_server is called with the correct server configuration
- Added detailed validation of the server config parameters:
- Server name with proper mcpm_ prefix
- Command set to "mcpm"
- Args set to ["run", "test-server"]
- Ensures the add operation is actually triggered as intended
- Provides comprehensive verification of non-interactive add server workflow
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Update tests/test_edit.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* test: add assertion for remove_server in set servers test
Add assertion to verify that the old server is removed when using
--set-servers in non-interactive mode. This ensures the test properly
validates that old servers are removed before adding new ones.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: update GitHub Actions to latest versions and add security permissions
- Update actions/setup-python from v4 to v5
- Update peter-evans/create-pull-request from v5 to v7
- Add minimal permissions block (contents: write, pull-requests: write) for improved security
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: pass force parameter to add_server to enable proper server overwrite
- Pass force=force parameter to global_config_manager.add_server() call
- Ensures existing servers are properly overwritten when --force flag is used
- Fixes inconsistency where force check existed but wasn't applied
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Jonathan Wang <jonathan@pathintegral.xyz>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 9e999e9 commit 03a7b3d
File tree
19 files changed
+4374
-121
lines changed- .github/workflows
- docs
- scripts
- src/mcpm
- commands
- profile
- utils
- tests
19 files changed
+4374
-121
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
0 commit comments