generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 37
CLI Tool for MCP Server Registration and Health Validation (#120) #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Move mcp_client.py to cli/ directory with enhanced functionality - Add CLI installation script and comprehensive examples - Create example MCP server with 3 tools (example_tool, echo_tool, status_tool) - Add server management documentation with all mcp_client.py commands - Implement internal API endpoints for toggle_service with HTTP Basic Auth - Update scopes.yml to include all mcpgw tools in restricted scopes - Add registry configuration for example-server - Clean up redundant functions from mcpgw server (get_server_details, get_service_tools) - Update tool counts and schemas in registry configurations - Add Docker Compose service for example-server Key features: - Full CLI toolkit for MCP server management - Dynamic server registration/removal via API - Internal authentication for administrative operations - Comprehensive documentation and examples - Ready-to-use example server for testing Addresses dynamic server management workflow and CLI tooling needs.
Major improvements to server registration workflow and service management: Core Fixes: - Fix server registration enabling order to resolve is_enabled: false in FAISS metadata - Fix tool discovery conditions and add scopes update functionality in health checks - Fix enum comparison bug in health status checking - Add configurable health check interval via environment variable - Improve logging to show discovered tool names Service Management Overhaul: - Add comprehensive service_mgmt.sh script for server lifecycle management - Remove obsolete CLI tools (mcp_registry_cli.py, test_registry_cli.sh, install.sh) - Add credential management system with automatic refresh - Add scopes_manager.py utility for dynamic scopes.yml updates Documentation Reorganization: - Rename server-management.md to service-management.md with complete rewrite - Move mcp_client.py documentation to new cli.md file - Rewrite testing.md to use mcp_client.py instead of obsolete scripts - Add end-to-end example section with example-server workflow - Fix all references to non-existent scripts Infrastructure Updates: - Remove example-server from docker-compose.yml (backup created) - Add service management utility to README.md What's New section - Update environment variable configuration for health check intervals This addresses server registration issues and establishes service_mgmt.sh as the primary tool for server management with comprehensive verification.
- Add Regenerate Credentials section at top of testing.md - Reference credentials-provider/generate_creds.sh script - Explain 5-minute Keycloak token lifetime requirement - Provide clear steps for generating fresh authentication tokens
Remove temporary backup files: - README_backup.md - cli/examples/server-config.json.backup - docker-compose.yml.backup These were created during development and are no longer needed.
- Add add_server_to_scopes_groups and remove_server_from_scopes_groups MCP tools - Implement internal API endpoints for scopes groups management with admin auth - Update service_mgmt.sh with add-to-groups and remove-from-groups commands - Fix service verification to use server path instead of name - Prevent YAML anchors/aliases in scopes.yml to maintain clean format - Add comprehensive documentation for advanced scopes management - Update docker-compose.yml to support ADMIN_USER and ADMIN_PASSWORD
Modified add_server_to_scopes() to only add newly registered servers to unrestricted groups (mcp-servers-unrestricted/read and execute). Previously, servers were being added to both unrestricted AND restricted groups, which violated the principle of least privilege. Changes: - registry/utils/scopes_manager.py: Updated sections list in add_server_to_scopes() to only include unrestricted groups - docs/service-management.md: Added documentation explaining the default behavior when registering new servers This ensures new servers are only accessible to users with unrestricted permissions by default. Administrators can explicitly add servers to restricted groups using add_server_to_groups() when needed.
Corrected references to mcp_client.py to include the cli/ directory prefix. The file was moved to cli/mcp_client.py but the macOS guide was not updated.
This was referenced Oct 1, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a comprehensive CLI tool for MCP server registration, health validation, and lifecycle management, addressing issue #120.
Key Features
1. Service Management Script (
cli/service_mgmt.sh
)2. Enhanced MCP Client (
cli/mcp_client.py
)3. MCP Utilities Library (
cli/mcp_utils.py
)4. Example Server
servers/example-server/
)5. Registry Management Tools (mcpgw server)
New tools exposed via
/mcpgw
endpoint:list_services
- List all registered servershealthcheck_services
- Get health status for all serversregister_service
- Register new serversremove_service
- Remove serverstoggle_service
- Enable/disable serversadd_server_to_scopes_groups
- Add servers to specific scopes groupsremove_server_from_scopes_groups
- Remove servers from scopes groups6. Scopes Management
registry/utils/scopes_manager.py
for automated scopes.yml updates7. Documentation
docs/cli.md
)docs/service-management.md
)Changes
New Files
cli/service_mgmt.sh
- Main service management script (822 lines)cli/mcp_client.py
- Enhanced MCP client (137 lines)cli/mcp_utils.py
- Utility library (426 lines)cli/examples/
- Example configuration filesservers/example-server/
- Example MCP server implementationregistry/utils/scopes_manager.py
- Scopes management utilities (408 lines)docs/cli.md
- CLI documentation (266 lines)docs/service-management.md
- Service management guide (503 lines)Modified Files
servers/mcpgw/server.py
- Added registry management toolsregistry/api/server_routes.py
- New internal API endpointsregistry/services/server_service.py
- Enhanced server managementauth_server/server.py
- Scopes reload endpointdocs/testing.md
- Updated with new testing workflowsREADME.md
- Added service management referencesBug Fixes
Testing
All features have been tested with:
Documentation
Complete documentation provided:
cli/examples/
Breaking Changes
None - all changes are additive and backward compatible.
Related Issues
Closes #120
Demo
The service management script provides comprehensive output: