This article is about:
- Configuring MCP servers across different host platforms
- Managing server configurations for Claude, VS Code, Cursor, and other hosts
- Synchronizing environment configurations to multiple hosts
- Backup and recovery of host configurations
Hatch can automatically configure MCP servers on supported host platforms, eliminating the need to manually edit configuration files for each application. This feature streamlines the process of setting up MCP servers across your development environment.
Hatch currently supports configuration for these MCP host platforms:
- Claude Desktop - Anthropic's desktop application
- Claude Code - Anthropic's VS Code extension
- VS Code - Microsoft Visual Studio Code with MCP extensions
- Cursor - AI-powered code editor
- Kiro - Kiro IDE with MCP support
- Codex - OpenAI Codex with MCP server configuration support
- LM Studio - Local language model interface
- Gemini - Google's AI development environment
- Mistral Vibe - Mistral Vibe CLI coding agent
- OpenCode - OpenCode AI coding assistant
- Augment - Augment Code AI assistant
For step-by-step guidance on MCP host configuration, see the comprehensive tutorial series:
- Tutorial: Host Platform Overview - Understanding host platforms and deployment approaches
- Tutorial: Configuring Hatch Packages - Preferred deployment method with automatic dependency resolution
- Tutorial: Configuring Arbitrary Servers - Advanced method for non-Hatch servers
- Tutorial: Environment Synchronization - Cross-environment deployment workflows
Add an MCP server to a specific host:
# Configure a local MCP server
hatch mcp configure weather_server \
--host claude-desktop \
--command python \
--args weather_server.py
# Configure a remote MCP server
hatch mcp configure api-service \
--host cursor \
--url https://api.example.com/mcp \
--header "Authorization=Bearer token"View servers configured on a specific host:
# List available host platforms
hatch mcp list hosts
# List configured servers from current environment
hatch mcp list servers
# List servers from specific host
hatch mcp list servers --host claude-desktopHatch provides multiple ways to view MCP host configurations:
Table Views (for quick overview):
hatch mcp list hosts: View all hosts and their servershatch mcp list servers: View all servers and their hosts
Detailed Views (for comprehensive information):
hatch mcp show hosts: Detailed view of all host configurationshatch mcp show servers: Detailed view of all server configurations
Filtering: All commands support regex filtering:
hatch mcp list hosts --server "weather.*": Show only servers matching patternhatch mcp show servers --host "claude.*": Show only hosts matching pattern
Examples:
# View all hosts with their servers (table view)
hatch mcp list hosts
# View all servers with their hosts (table view)
hatch mcp list servers
# View detailed host configurations
hatch mcp show hosts
# View detailed server configurations
hatch mcp show servers
# Filter by server name using regex
hatch mcp show hosts --server "weather.*"
# Filter by host name using regex
hatch mcp show servers --host "claude.*"Remove an MCP server from a host:
# Remove server from specific host
hatch mcp remove server weather_server --host claude-desktop
# Remove server from all hosts
hatch mcp remove server weather_server --host all
# Remove entire host configuration
hatch mcp remove host claude-desktopImportant: Each server must be configured as either local (using --command) or remote (using --url), but not both. These options are mutually exclusive:
- Local servers: Use
--commandand optionally--argsand--env-var - Remote servers: Use
--urland optionally--header
Attempting to use both --command and --url will result in an error.
Local servers run as processes on your machine:
# Basic local server
hatch mcp configure my-server \
--host claude-desktop \
--command python \
--args server.py
# Server with environment variables
hatch mcp configure weather_server \
--host claude-desktop \
--command python \
--args weather_server.py \
--env-var API_KEY=your-key \
--env-var DEBUG=true
# Server with absolute path (required for some hosts)
hatch mcp configure secure-server \
--host claude-desktop \
--command /usr/local/bin/python \
--args /path/to/secure_server.pyRemote servers are accessed via HTTP/HTTPS:
# Basic remote server
hatch mcp configure api-server \
--host cursor \
--url https://api.example.com/mcp
# Remote server with authentication
hatch mcp configure authenticated-api \
--host cursor \
--url https://secure-api.example.com/mcp \
--header "Authorization=Bearer your-token" \
--header "Content-Type=application/json"Set up the same server on multiple host platforms using the sync command:
# Configure on the primary host first
hatch mcp configure weather_server \
--host claude-desktop \
--command python \
--args weather_server.py
# Then sync to other hosts
hatch mcp sync --from-host claude-desktop --to-host cursor,vscode
# Or sync from an environment to multiple hosts
hatch mcp sync --from-env default --to-host all# Sync environment to specific hosts
hatch mcp sync --from-env production --to-host claude-desktop,cursor
# Copy configuration between hosts
hatch mcp sync --from-host claude-desktop --to-host cursor
# Sync with filtering (only servers matching pattern)
hatch mcp sync --from-env dev --to-host all --pattern ".*api.*"
# Preview changes without applying them
hatch mcp sync --from-env prod --to-host all --dry-runHatch automatically creates backups before modifying host configurations:
# Configure with automatic backup (default)
hatch mcp configure my-server --host claude-desktop --command python --args server.py
# Skip backup creation
hatch mcp configure my-server --host claude-desktop --command python --args server.py --no-backup# List available backups
hatch mcp backup list claude-desktop
# Restore from backup file
hatch mcp backup restore claude-desktop --backup-file <backup_file_name>Backups are stored in ~/.hatch/mcp_host_config_backups/ with the naming pattern:
mcp.json.<hostname>.<timestamp>
The system validates host names against available MCP host types:
claude-desktopcursorvscodekirolmstudiogemini- Additional hosts as configured
All error messages use standardized formatting with structured details:
[ERROR] Failed to configure MCP server 'my-server'
Host: claude-desktop
Reason: Server configuration invalid for claude-desktop
Invalid host names result in clear error messages with available options listed:
[ERROR] Invalid host 'vsc'
Field: --host
Suggestion: Supported hosts: claude-desktop, vscode, cursor, kiro, lmstudio, gemini
For complete command syntax and all available options, see CLI Reference.