Skip to content

Commit 7a30cce

Browse files
tgunrclaudeJoJoJoJoJoJoJoCopilot
committed
🤖 Add Comprehensive AI Agent Friendly CLI Support (pathintegral-institute#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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * Update tests/test_edit.py Co-authored-by: Copilot <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Jonathan Wang <[email protected]> Co-authored-by: Copilot <[email protected]> # Conflicts: # src/mcpm/commands/client.py
1 parent d54d728 commit 7a30cce

File tree

1 file changed

+9
-30
lines changed

1 file changed

+9
-30
lines changed

.github/workflows/generate-llm-txt.yml

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,17 @@ jobs:
2424
pull-requests: write
2525

2626
steps:
27+
- name: Generate token
28+
id: generate_token
29+
uses: actions/create-github-app-token@v1
30+
with:
31+
app-id: ${{ secrets.BOT_APP_ID }}
32+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
33+
2734
- name: Checkout code
2835
uses: actions/checkout@v4
2936
with:
30-
token: ${{ secrets.GITHUB_TOKEN }}
37+
token: ${{ steps.generate_token.outputs.token }}
3138
fetch-depth: 0
3239

3340
- name: Set up Python
@@ -62,32 +69,4 @@ jobs:
6269
git commit -m "docs: update llm.txt for AI agents [skip ci]"
6370
git push
6471
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66-
67-
- name: Create Pull Request (for releases)
68-
if: github.event_name == 'release' && steps.check_changes.outputs.no_changes == 'false'
69-
uses: peter-evans/create-pull-request@v7
70-
with:
71-
token: ${{ secrets.GITHUB_TOKEN }}
72-
commit-message: "docs: update llm.txt for release ${{ github.event.release.tag_name }}"
73-
title: "📚 Update llm.txt for AI agents (Release ${{ github.event.release.tag_name }})"
74-
body: |
75-
## 🤖 Automated llm.txt Update
76-
77-
This PR automatically updates the llm.txt file for AI agents following the release of version ${{ github.event.release.tag_name }}.
78-
79-
### Changes
80-
- Updated command documentation
81-
- Refreshed examples and usage patterns
82-
- Updated version information
83-
84-
### What is llm.txt?
85-
llm.txt is a comprehensive guide for AI agents to understand how to interact with MCPM programmatically. It includes:
86-
- All CLI commands with parameters and examples
87-
- Environment variables for automation
88-
- Best practices for AI agent integration
89-
- Error handling and troubleshooting
90-
91-
This file is automatically generated from the CLI structure using `scripts/generate_llm_txt.py`.
92-
branch: update-llm-txt-${{ github.event.release.tag_name }}
93-
delete-branch: true
72+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}

0 commit comments

Comments
 (0)