This document outlines a comprehensive plan to make every MCPM feature accessible via pure parameterized CLI commands, eliminating the need for interactive TUI interfaces when used by AI agents or automation scripts.
- Core operations:
search,info,ls,run,doctor,usage - Profile operations:
profile ls,profile create,profile run,profile rm(with--force) - Configuration:
config ls,config unset,config clear-cache - Client listing:
client ls - Installation:
install(with env vars),uninstall(with--force)
- Server creation:
new,edit - Configuration:
config set - Client management:
client edit,client import - Profile management:
profile edit,profile inspect - Migration:
migrate(partial)
Current: Interactive form only
mcpm new # Prompts for all server detailsProposed: Full CLI parameter support
mcpm new <server_name> \
--type {stdio|remote} \
--command "python -m server" \
--args "arg1 arg2" \
--env "KEY1=value1,KEY2=value2" \
--url "http://example.com" \
--headers "Authorization=Bearer token" \
--forceImplementation Requirements:
- Add CLI parameters to
src/mcpm/commands/new.py - Create parameter validation logic
- Implement non-interactive server creation flow
- Maintain backward compatibility with interactive mode
Current: Interactive form or external editor
mcpm edit <server> # Interactive form
mcpm edit <server> -e # External editorProposed: Field-specific updates
mcpm edit <server> --name "new_name"
mcpm edit <server> --command "new command"
mcpm edit <server> --args "new args"
mcpm edit <server> --env "KEY=value"
mcpm edit <server> --url "http://new-url.com"
mcpm edit <server> --headers "Header=Value"
mcpm edit <server> --forceImplementation Requirements:
- Add field-specific CLI parameters to
src/mcpm/commands/edit.py - Create parameter-to-config mapping logic
- Implement selective field updates
- Support multiple field updates in single command
Current: Interactive server selection
mcpm profile edit <profile> # Interactive checkbox selectionProposed: Server management via CLI
mcpm profile edit <profile> --add-server "server1,server2"
mcpm profile edit <profile> --remove-server "server3,server4"
mcpm profile edit <profile> --set-servers "server1,server2,server5"
mcpm profile edit <profile> --rename "new_profile_name"
mcpm profile edit <profile> --forceImplementation Requirements:
- Add server management parameters to
src/mcpm/commands/profile/edit.py - Create server list parsing utilities
- Implement server validation logic
- Support multiple operations in single command
Current: Interactive server selection
mcpm profile inspect <profile> # Interactive server selectionProposed: Direct server specification
mcpm profile inspect <profile> --server "server_name"
mcpm profile inspect <profile> --all-servers
mcpm profile inspect <profile> --port 3000Implementation Requirements:
- Add server selection parameters to
src/mcpm/commands/profile/inspect.py - Implement direct server targeting
- Support batch inspection of all servers
Current: Interactive server selection
mcpm client edit <client> # Interactive server/profile selectionProposed: Server management via CLI
mcpm client edit <client> --add-server "server1,server2"
mcpm client edit <client> --remove-server "server3,server4"
mcpm client edit <client> --set-servers "server1,server2,server5"
mcpm client edit <client> --add-profile "profile1,profile2"
mcpm client edit <client> --remove-profile "profile3"
mcpm client edit <client> --config-path "/custom/path"
mcpm client edit <client> --forceImplementation Requirements:
- Add server/profile management parameters to
src/mcpm/commands/client.py - Create client configuration update logic
- Support mixed server and profile operations
Current: Interactive server selection
mcpm client import <client> # Interactive server selectionProposed: Automatic or specified import
mcpm client import <client> --all
mcpm client import <client> --servers "server1,server2"
mcpm client import <client> --create-profile "imported_profile"
mcpm client import <client> --merge-existing
mcpm client import <client> --forceImplementation Requirements:
- Add import control parameters to
src/mcpm/commands/client.py - Implement automatic import logic
- Support profile creation during import
Current: Interactive prompts
mcpm config set # Interactive key/value promptsProposed: Direct key-value setting
mcpm config set <key> <value>
mcpm config set node_executable "/path/to/node"
mcpm config set registry_url "https://custom-registry.com"
mcpm config set analytics_enabled true
mcpm config set --list # Show available config keysImplementation Requirements:
- Add direct key-value parameters to
src/mcpm/commands/config.py - Create configuration key validation
- Add configuration key listing functionality
Current: Interactive choice prompt
mcpm migrate # Interactive choice: migrate/start fresh/ignoreProposed: Direct migration control
mcpm migrate --auto-migrate # Migrate automatically
mcpm migrate --start-fresh # Start fresh
mcpm migrate --ignore # Ignore v1 config
mcpm migrate --backup-path "/path/to/backup"Implementation Requirements:
- Add migration control parameters to
src/mcpm/commands/migrate.py - Implement automatic migration logic
- Add backup functionality
- All existing interactive commands remain unchanged
- New CLI parameters are additive, not replacing
- Interactive mode remains the default when parameters are missing
- Add
--interactiveflag to force interactive mode when needed
--force- Skip all confirmations--json- Machine-readable output where applicable--verbose- Detailed output for debugging--dry-run- Preview changes without applying--non-interactive- Disable all prompts globally
- Comprehensive parameter validation before execution
- Clear error messages for invalid combinations
- Help text updates for all new parameters
- Parameter conflict detection and resolution
- Extend existing env var pattern to all commands
MCPM_FORCE=true- Global force flagMCPM_NON_INTERACTIVE=true- Disable all promptsMCPM_JSON_OUTPUT=true- JSON output by default- Server-specific env vars for sensitive data
- Consistent JSON output format for programmatic use
- Exit codes: 0 (success), 1 (error), 2 (validation error)
- Structured error messages with error codes
- Progress indicators for long-running operations
Create src/mcpm/utils/non_interactive.py:
def is_non_interactive() -> bool:
"""Check if running in non-interactive mode."""
def parse_key_value_pairs(pairs: str) -> dict:
"""Parse comma-separated key=value pairs."""
def parse_server_list(servers: str) -> list:
"""Parse comma-separated server list."""
def validate_server_exists(server: str) -> bool:
"""Validate that server exists in global config."""For each command, add:
- CLI parameter decorators
- Parameter validation functions
- Non-interactive execution paths
- Parameter-to-config mapping logic
Implement detection logic:
- Check for TTY availability
- Check environment variables
- Check for force flags
- Graceful fallback when required parameters are missing
- All new CLI parameters
- Parameter validation logic
- Non-interactive execution paths
- Parameter parsing utilities
- Full command workflows
- Parameter combination testing
- Error handling scenarios
- Environment variable integration
- Headless execution scenarios
- Batch operation testing
- Error recovery testing
- Performance benchmarking
- Ensure interactive modes still work
- Backward compatibility verification
- Help text accuracy
- Exit code consistency
- Predictable Execution: No interactive prompts to block automation
- Scriptable: All operations can be scripted and automated
- Composable: Commands can be chained and combined
- Debuggable: Verbose output and clear error messages
- Stateless: No dependency on terminal state or user presence
- Batch Operations: Support for multiple operations in single commands
- Error Handling: Structured error responses for programmatic handling
- Coverage: 100% of MCPM commands have non-interactive alternatives
- Compatibility: 100% backward compatibility with existing workflows
- Performance: Non-interactive commands execute ≤ 50ms faster than interactive
- Reliability: 99.9% success rate for valid parameter combinations
- Usability: Clear documentation and help text for all new parameters
- Phase 1: Server Management (1-2 weeks)
- Phase 2: Profile Management (1-2 weeks)
- Phase 3: Client Management (2-3 weeks)
- Phase 4: Configuration Management (1 week)
- Phase 5: Migration Enhancement (1 week)
- Testing & Documentation: 1-2 weeks
Total Estimated Timeline: 7-11 weeks
- Create utility functions and infrastructure
- Implement server management commands (highest impact)
- Implement profile management commands
- Implement client management commands
- Implement configuration management commands
- Implement migration enhancements
- Add comprehensive testing
- Update documentation and help text
This plan transforms MCPM from a user-centric tool with interactive elements into a fully AI-agent-friendly CLI tool while maintaining all existing functionality for human users.