Commit e974fb7
feat!: mcpm v2 (#202)
* Remove router and active profile functionality, preserve v2 commands
Remove legacy router daemon and active profile concepts while maintaining
all v2 command functionalities. Profiles now work as virtual tags only.
## Major Changes
### Removed Router Infrastructure
- Router command and all subcommands (mcpm router on/off/status/set/share/unshare)
- Router daemon functionality (/src/mcpm/router/ directory)
- Router configuration management methods
- Router-based tunneling and sharing
### Removed Active Profile Concept
- activate_profile() and deactivate_profile() methods from client managers
- client_add_profile() function that used router for profile activation
- Router server formatting utilities
### Preserved Core Functionality
- All v2 commands work as before (mcpm install, mcpm profile, mcpm share, etc.)
- Profile system now works as virtual tags only
- FastMCP-based sharing via mcpm share and mcpm profile share
- Client configuration management
### Backward Compatibility
- Created minimal RouterConfig class for FastMCP middleware compatibility
- Created simple Tunnel class to replace router-based tunneling
- Updated imports throughout codebase
- Fixed all tests (113 passing)
### Technical Details
- No daemon processes required anymore
- Sharing uses FastMCP proxies directly
- Profile activation shows proper error message for v2.0
- Updated connection URLs to show streamable HTTP and SSE endpoints
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Format code with ruff and fix all linting issues
- Fixed 760 linting issues automatically with ruff check --fix --unsafe-fixes
- Formatted 36 files with ruff format for consistent code style
- Removed unused variables and improved code quality
- Fixed whitespace, trailing spaces, and formatting inconsistencies
- All 113 tests still passing after formatting
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* improve mcpm client ls
* Improve mcpm ls command user experience
- Add --verbose/-v flag for detailed server configurations
- Show only server names and profiles by default for cleaner output
- Change "tags" to "profiles" in UI for better user understanding
- Remove duplicate server names (shown only once)
- Highlight profile names in bright yellow for better visibility
- Add helpful tip about -v flag when not using verbose mode
- Maintain backward compatibility with show_name parameter
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* move import to client import
* Enhance client edit command with profile support and UI improvements
- Add profile support to client edit and ls commands
- Implement mixed selection UI allowing both profiles and servers
- Replace color coding with emoji icons (📦 for profiles, 🔧 for servers)
- Add conflict detection to prevent duplicate servers across profiles
- Implement retry loop for better UX when conflicts occur
- Show blank instead of "No description" for servers without descriptions
- Display actual server names in profile descriptions
- Update tests to reflect new table structure with profiles column
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Add interactive-only server edit command
- Add new mcpm edit command for interactive server configuration editing
- Support STDIO servers (command, args, env) and remote servers (URL, headers)
- Interactive form-based editing with InquirerPy for better UX
- Real-time validation and confirmation before applying changes
- Graceful fallback with clear messaging in non-terminal environments
- Comprehensive test suite with proper error handling
- Clean, single-file implementation for maintainability
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Add -N/--new and -e/--editor options to edit command
Adds two new arguments to enhance the edit command functionality:
- -N/--new: Interactive creation of new server configurations
- -e/--editor: Opens global config file in external editor
Also fixes help formatting and config path reference bug.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat(cli): add global error handler with rich tracebacks
Implements a global error handler using a decorator to catch all unhandled
exceptions. This improves user experience by providing a clear message
and a link to the GitHub issues page.
Tracebacks are now pretty-printed using the 'rich' library for better
readability and easier debugging.
* docs(project): add GEMINI.md for project conventions
Adds a GEMINI.md file to document project-specific conventions for
the Gemini assistant. This includes instructions to use 'ruff' for
formatting and 'uv' for dependency management.
* docs(cli): add links to github issues and discussions in help text
Adds links to the GitHub Issues and Discussions pages in the main help
documentation. This makes it easier for users to report bugs, request
features, or provide feedback.
* style(python): format code with ruff
Formats the Python code in the project using the 'ruff' formatter to
ensure consistent code style.
* feat(cli): add --path option to client edit command
Adds a '--path' option to the 'mcpm client edit' command, allowing users
to specify a custom path to the client's configuration file. This
provides greater flexibility for managing client configurations that are
not in their default locations.
* docs(project): update GEMINI.md with git commit convention
Adds a new convention to GEMINI.md to always double-check with the user
before committing changes to git.
* Fix mcpm share command implementation to match original
- Replace tunnel.py with exact copy from original implementation
- Use Hugging Face CDN for frpc binary downloads instead of GitHub
- Fix deprecated API calls: run_streamable_http_async → run_http_async
- Use localhost instead of 127.0.0.1 for local_host in tunnels
- Update DEFAULT_PORT to 6276 across all commands
- Include proper checksums and binary verification
- Fix frpc command arguments to use --server_addr format
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Fix authentication middleware for FastMCP proxy
- Use multiple approaches to access HTTP headers in middleware
- Try FastMCP's get_http_headers() function first
- Fallback to context.request.headers and context.headers
- Handle both 'Bearer' and 'bearer' token formats
- Gracefully handle stdio mode where no HTTP context exists
- Properly re-raise authentication errors while skipping other errors
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Show security warning only when --no-auth is used
- Only display "Anyone with the URL can access your server" when authentication is disabled
- When auth is enabled, show API key and authentication instructions instead
- Apply this logic to both 'mcpm share' and 'mcpm profile share' commands
- Improve user awareness of security implications based on auth settings
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Simplify share command output
- Remove SSE endpoint from display (keep HTTP only)
- Remove "(recommended)" from HTTP label
- Change "Connection URLs" to "Connection URL" in profile share
- Cleaner, more focused output for users
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Remove unnecessary --debug flag from profile run command
- Remove --debug flag since logging is now controlled by MCPM_DEBUG env var
- Update function signature to remove debug parameter
- Update docstring to mention MCPM_DEBUG=1 for verbose output
- Simplify command by using centralized logging configuration
Consistent with other commands that use environment variables for debug control.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Improve run command logging and console output
- Split logging configuration into general and dependency-specific parts
- Add rich console output to run --http commands matching share style
- Control uvicorn logging across all HTTP commands (run, share)
- Extract debug utilities to common location for consistency
- Show clean HTTP URLs and server lists in run commands
- Move verbose logging to debug level with MCPM_DEBUG control
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Fix code formatting and linting issues
- Format all code with ruff formatter
- Fix test imports to use updated MCPMProxyFactory constructor
- Remove deprecated RouterConfig usage in tests
- Fix import ordering and line length issues
- Add missing newlines and remove trailing whitespace
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Include timestamp and class name in log format
- Enable timestamp display in Rich logging handler
- Add module/class name to log format using %(name)s
- Maintain clean output while providing better debugging info
- Format shows: [timestamp] LEVEL module.name: message
Example output:
[07/04/25 15:10:14] INFO mcpm.commands.run: Server started successfully
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Clarify authorization header format in share panels
- Change 'Authorization Header:' to 'HEADER Authorization:'
- Makes it crystal clear this is an HTTP header
- Users can easily copy the exact header name and value
- Format: HEADER Authorization: Bearer <api-key>
* Improve inspect command with optional server name
- Make server_name argument optional for inspect command
- When no server specified, show helpful panel with options
- Prompt user to confirm launching raw MCP Inspector
- Provide clear guidance on inspecting MCPM-managed servers
- Include examples: 'mcpm inspect filesystem', 'mcpm inspect time'
- Show 'mcpm ls' command to discover available servers
- Add yellow border panel to make the choice clear and actionable
Example flow:
mcpm inspect # Shows options, prompts for confirmation
mcpm inspect filesystem # Direct inspection of specific server
* Fix tests for updated inspect and run command behavior
- Update inspect tests to handle new optional server name behavior
- Add test for no server name case (raw inspector prompt)
- Update run test to expect 5 log records (error + helpful suggestions)
- Set proper logging level to capture INFO messages in test
- All inspect and run related tests now passing
* Apply ruff formatting fixes
* Remove outdated concepts from config system
- Remove active_client, active_target, and active_profile concepts
- Remove stashed_servers functionality
- Remove save_share_config and read_share_config methods
- Simplify ClientConfigManager to only essential methods
- Update client ls command to remove ACTIVE indicator
- Fix all tests to work without outdated concepts
- Update test fixtures to use config_path_override parameter
🤖 Generated with Claude Code
Co-Authored-By: Claude <[email protected]>
* Implement comprehensive v1 to v2 migration system
- Add V1ConfigDetector to identify v1 configurations with smart detection
- Add V1ToV2Migrator with progressive disclosure migration prompts
- Support three migration paths: migrate, start fresh, or ignore
- Create timestamped backups in ~/.config/mcpm/backups/ with documentation
- Migrate v1 profiles to v2 virtual profiles with global servers
- Handle stashed servers with restore or documentation options
- Remove v1 config.json completely after migration (not just null values)
- Exclude auth.json from v1 detection as it's a v2 feature
- Add cross-platform "press any key" functionality
- Integrate migration check into all CLI commands
- Add manual migration command: mcpm migrate
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Remove old middleware and consolidate to unified event-driven tracking
This commit completes the middleware consolidation by removing deprecated
components and switching to a unified event-driven architecture:
**Removed old middleware classes:**
- MCPMMonitoringMiddleware -> replaced by MCPMUnifiedTrackingMiddleware
- MCPMUsageTrackingMiddleware -> replaced by MCPMUnifiedTrackingMiddleware
**Removed deprecated database code:**
- usage_sessions table and all related queries
- track_session method from AccessMonitor interface
- session_tracker.py module and its exports
**Updated tracking approach:**
- All tracking now uses events (SESSION_START/SESSION_END) with session_id linking
- Usage statistics computed at query time from events table
- Simplified method delegation to computed stats
- Maintained backward compatibility for metadata formats
**Benefits:**
- Single unified middleware handles all tracking automatically
- Event-driven architecture enables rich analytics
- Simplified codebase with consistent patterns
- Better session correlation via session_id
All tests pass and usage command works correctly with computed statistics.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Add rich-click for beautiful CLI formatting
This commit enhances the CLI experience with rich-click integration,
providing modern, colorful, and well-organized help screens.
**Added rich-click integration:**
- Added rich-click>=1.8.0 dependency
- Created comprehensive configuration in utils/rich_click_config.py
- Updated all 26 command files to use rich-click module
- Preserved custom main help with ASCII art while enhancing subcommands
**Enhanced CLI features:**
- Beautiful colored output with syntax highlighting
- Arguments and options in bordered boxes for clarity
- Consistent color scheme (cyan for options/commands, yellow for metavars)
- Smart width handling and better typography
- Enhanced error messages with helpful suggestions
- Professional formatting matching modern CLI tools
**Code quality improvements:**
- Applied ruff formatting to all Python files
- Fixed all linting issues (unused variables, trailing whitespace)
- Fixed test failures for changed output format
- Cleaned up imports and formatting inconsistencies
**Benefits:**
- More intuitive and visually appealing help screens
- Better organization of command options and arguments
- Consistent styling across all commands
- Improved readability with proper spacing and colors
- Modern CLI experience while maintaining MCPM branding
All tests pass (122 passed, 6 skipped).
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Remove inspector command and reorganize command groups
- Remove inspector command and related code (separate from inspect command)
- Reorganize command groups with new structure:
* Server Execution: run, share, inspect, usage
* Reorder: Server Management → Server Execution → Client → Profile → System & Configuration
* Move migrate to System & Configuration group
* Remove empty Advanced Tools group
- Update CLI imports and command registration
- Clean up test files for removed inspector functionality
- Update migration help text references
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Improve CLI help system and command descriptions
- Update main CLI description to be more direct about MCPM capabilities
- Improve client and profile command descriptions with specific examples
- Add consistent grey-purple footer to all commands for GitHub issues
- Remove header/footer from subcommands while keeping for main CLI help
- Implement custom help handling for main command with proper header/footer display
- Remove duplicate information and streamline footer messaging
- Use Text objects instead of markup strings to fix rendering issues
Key improvements:
- Main CLI: Centralized MCP server management with clear value proposition
- Client command: Explains MCP clients and supported applications
- Profile command: Describes workflow organization with concrete examples
- Consistent support footer across all commands with proper styling
- Clean main command help with ASCII art header and minimal footer
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Clean up deprecated configuration fields and imports
Remove unused configuration fields and deprecated modules:
- Remove deprecated REQUIRED_FIELDS and OPTIONAL_FIELDS ClassVar from FullServerConfig
- Delete deprecated server_config.py module
- Remove deprecated --target options from add.py and list.py commands
- Fix import order and remove unused variables to pass ruff checks
- Update test expectations for new help output format
- Restore rich-click command grouping configuration
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Fix v1 to v2 migration to only occur after user confirmation
Previously, ProfileConfigManager would automatically migrate v1 profiles.json
files on initialization, which happened before users confirmed they wanted
to migrate. This caused profiles to be migrated prematurely.
Changes:
- Removed automatic migration from ProfileConfigManager.__init__
- Removed unused _migrate_legacy_profiles methods from ProfileConfigManager
- Added create_profile() method to ProfileConfigManager for V1ToV2Migrator
- Updated V1ToV2Migrator to also remove profiles.json after migration
- Updated test to reflect that ProfileConfigManager no longer auto-migrates
- Fixed ASCII art logo spacing in cli.py and rich_click_config.py
Now profile migration only happens after user explicitly chooses to migrate
via the V1ToV2Migrator prompt.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Clean up logo printing code
* Update all documentation to match MCPM v2.0 implementation
Comprehensive documentation overhaul to reflect the new v2.0 architecture and
commands. Based on the actual CLI help output and current implementation.
Changes:
- Removed MCPM_Command_Specification.md (no longer needed)
- Updated MIGRATION_GUIDE.md with accurate migration flow and options
- Updated README.md with correct v2.0 command structure and features
- Updated docs/advanced_features.md for v2.0 FastMCP integration
- Updated docs/router_share.md for new sharing system (no separate router)
All documentation now accurately reflects:
- Global configuration model with virtual profiles
- Correct command names and options from CLI help
- v2.0 migration process with user confirmation
- FastMCP-based sharing instead of router daemon
- Client integration features
- Current feature set without deprecated v1 concepts
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* Complete documentation overhaul for MCPM v2.0
Comprehensive update of all documentation to accurately reflect the v2.0
implementation and command structure based on actual CLI help output.
Major changes:
- Removed MCPM_Command_Specification.md (no longer needed)
- Completely rewrote MIGRATION_GUIDE.md to match actual migration flow
- Updated README.md with correct v2.0 command structure and features
- Updated README.zh-CN.md to match English version with v2.0 content
- Rewrote docs/advanced_features.md for FastMCP integration
- Updated docs/router_share.md for new sharing system (no router daemon)
- Completely rewrote docs/router_tech_design.md for v2.0 architecture
Key updates:
- Global configuration model with virtual profiles
- Correct command names from CLI help (install/uninstall vs add/rm)
- v2.0 migration process with user confirmation options
- FastMCP-based execution and sharing instead of router daemon
- Client integration commands (mcpm client ls/edit/import)
- Removed all deprecated v1 target-based concepts
- Updated Chinese documentation to match English version
- Consistent terminology and examples throughout
All documentation now accurately reflects the current v2.0 implementation
without any outdated v1 references.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* update docs
---------
Co-authored-by: Claude <[email protected]>1 parent e81082a commit e974fb7
File tree
116 files changed
+12379
-8928
lines changed- docs
- examples
- pages
- registry
- scripts
- src/mcpm
- clients
- managers
- commands
- profile
- target_operations
- core
- router
- fastmcp_integration
- migration
- monitor
- profile
- router
- schemas
- utils
- tests
- test_clients
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
116 files changed
+12379
-8928
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 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 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
0 commit comments