Every MCP server you enable injects its tool definitions into your context window.
Enable 2-3 servers and you lose 100k+ tokens just on tool schemas.
mcpctl lets you toggle servers on and off with one command.
Works at both global (~/.claude.json) and project (.mcp.json) scope, handles container lifecycle for Docker/Podman servers, and substitutes environment variables for secrets.
β οΈ IMPORTANT DISCLAIMERMCP servers can access your system resources, files, and network. Different servers may behave differently and request varying levels of access to your machine.
USE AT YOUR OWN RISK. Always review server permissions, check the source repository, and only enable servers from trusted sources.
- π Universal Management - Single tool for all MCP server types (npm, python, docker)
- π³ Container Runtime Auto-Detection - Works with both Docker and Podman
- π¦ Package Support - npm (npx) and Python (uvx) packages
- π Secrets Management - Environment variable substitution from
.envfiles - β‘ Simple Commands - list, config, enable, disable
- π YAML Configuration - Human-readable server definitions
- π Automatic Backups - Claude config backed up before changes
- Installation
- Quick Start
- Usage
- Configuration
- Supported Server Types
- Examples
- Architecture
- Contributing
- License
- Python 3.10 or higher
- Docker or Podman (for container-based MCP servers)
- Node.js (for npm-based MCP servers)
- Claude Code CLI
uv tool install mcp-ctrl
mcpctl listpip install mcp-ctrl
mcpctl listgit clone https://github.com/savitojs/mcpctl.git
cd mcpctl
uv sync
uv run mcpctl listNote: The PyPI package is named
mcp-ctrl, but the command ismcpctl
Tip: Managing Python environments? setV keeps them in one place with uv-backed creation, auto-freeze, and
setv doctorto fix broken envs after OS upgrades.
mcpctl resolves ${VAR} references from your shell environment first, then falls back to .env files. Set them wherever you prefer:
# Option A: shell profile (~/.zshenv, ~/.bashrc, ~/.profile, etc.)
export GITHUB_PAT=ghp_your_github_token_here
export EXA_API_KEY=your_exa_api_key
# Option B: dotenv file (~/.env)
GITHUB_PAT=ghp_your_github_token_here
EXA_API_KEY=your_exa_api_keymcpctl listOutput:
Available MCP Servers:
βͺ DISABLED | filesystem | npm | Secure file operations
βͺ DISABLED | github | npm | GitHub repository management
βͺ DISABLED | sequential-thinking | npm | Structured reasoning
π³ βͺ DISABLED | postgres | docker | PostgreSQL database access
... (13 servers available in examples)
# Enable an npm-based server
mcpctl enable filesystem
# Enable a docker-based server (starts container automatically)
mcpctl enable postgresmcpctl list filesystemmcpctl disable filesystem| Command | Description | Example |
|---|---|---|
list |
List all servers, or show details for one | mcpctl list / mcpctl list github |
config |
Show current configuration and paths | mcpctl config |
enable <server> |
Enable server(s), starts containers if needed | mcpctl enable github filesystem |
disable <server> |
Disable server(s) and stop containers | mcpctl disable postgres |
# Enable in global config (~/.claude.json)
mcpctl enable --global github
# Enable in project config (.mcp.json)
mcpctl enable --project github
# Preview changes without applying
mcpctl enable --dry-run github
# Disable server but keep container running
mcpctl disable postgres --keep-container
# Get help
mcpctl --help
mcpctl <command> --helpmcpctl stores configuration in ~/.config/mcpctl/:
mcp-servers.yaml- Your MCP server configurations
mcp-servers.yaml defines all available MCP servers. See examples/mcp-servers.example.yaml for a complete example.
Use ${VAR_NAME} syntax in YAML for environment variable substitution:
env:
GITHUB_TOKEN: "${GITHUB_TOKEN}"Variables are resolved from (last wins):
~/.env.env(project-local overrides)- Shell environment (
~/.zshenv,~/.bashrc,~/.profile, etc.)
Edit mcp-servers.yaml:
servers:
my-server:
type: npm # or docker, python, executable
description: "What this server does"
transport: stdio
requires_container: false
mcp_config:
command: npx
args:
- -y
- "@org/my-mcp-server"
env: {}filesystem:
type: npm
requires_container: false
mcp_config:
command: npx
args:
- -y
- "@modelcontextprotocol/server-filesystem"
- /path/to/dirpython-server:
type: python
requires_container: false
mcp_config:
command: uvx
args:
- python-mcp-packagepostgres:
type: docker
requires_container: true
container:
name: mcp-postgres
image: postgres:16-alpine
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_DB: mydb
mcp_config:
command: npx
args:
- -y
- mcp-postgres
- postgresql://postgres:${POSTGRES_PASSWORD}@localhost:5432/mydbcustom-server:
type: executable
requires_container: false
mcp_config:
command: /path/to/mcp-server
args:
- --config
- /path/to/config.json$ mcpctl enable postgres
βΉοΈ Starting container: docker run -d --name mcp-postgres -p 5432:5432 ...
β
Container 'mcp-postgres' started
β
Server 'postgres' enabled in Claude config
β οΈ Restart Claude Code to apply changes$ mcpctl enable github
β
Server 'github' enabled in Claude config
β οΈ Restart Claude Code to apply changes$ mcpctl list github
github
Type: remote
Description: GitHub repository management (official remote server)
Transport: http
Scope: global
Env vars: GITHUB_PAT$ mcpctl config
mcpctl configuration
Config file: ~/.config/mcpctl/mcp-servers.yaml
Default scope: global
Container: /usr/bin/podman
Servers defined: 6
filesystem
github
memory
...flowchart TB
subgraph mcpctl["mcpctl"]
CLI["CLI (enable / disable / list / config)"]
end
YAML["~/.config/mcpctl/<br/>mcp-servers.yaml"]
ENV["Environment<br/>shell env / .env files"]
subgraph targets["Claude Config"]
GLOBAL["~/.claude.json<br/>(global)"]
PROJECT[".mcp.json<br/>(project)"]
end
subgraph containers["Container Runtime"]
PODMAN["Podman / Docker"]
end
YAML -->|reads server<br/>definitions| CLI
ENV -->|resolves<br/>env var secrets| CLI
CLI -->|writes mcpServers| GLOBAL
CLI -->|writes mcpServers| PROJECT
CLI -->|start / stop| PODMAN
style mcpctl fill:#1e1b4b,stroke:#8b5cf6,color:#e2e8f0
style CLI fill:#2e1065,stroke:#8b5cf6,color:#e2e8f0
style YAML fill:#1e293b,stroke:#334155,color:#94a3b8
style ENV fill:#1e293b,stroke:#334155,color:#94a3b8
style GLOBAL fill:#14532d,stroke:#22c55e,color:#bbf7d0
style PROJECT fill:#14532d,stroke:#22c55e,color:#bbf7d0
style PODMAN fill:#172554,stroke:#3b82f6,color:#bfdbfe
style targets fill:#0a1a0a,stroke:#22c55e,color:#86efac
style containers fill:#0a1528,stroke:#3b82f6,color:#93c5fd
Container servers (Docker/Podman):
enable starts the container + writes to Claude config. disable stops it + removes the entry.
Package servers (npm/Python):
enable writes to Claude config (the package auto-runs when Claude needs it). disable removes the entry.
# Check Docker/Podman is running
docker ps # or: podman ps
# Check container logs
docker logs <container-name>
# Manually start container
docker start <container-name>
# or with podman:
podman start <container-name>
# Then enable in Claude config
mcpctl enable <server-name># Verify .env file
cat ~/.env
# Check substitution
mcpctl list github# Verify config added
cat ~/.claude.json | grep <server-name>
# Restart Claude Code
# (Exit and restart the CLI)mcpctl includes example configurations for popular MCP servers. See the ~/.config/mcpctl/mcp-servers-examples.yaml file or the examples/ directory in the repository for 13+ pre-configured server examples including:
- File operations (filesystem)
- GitHub integration
- Browser automation (playwright, puppeteer)
- Database access (postgres)
- Web search (brave-search)
- Knowledge graphs (memory)
- HTTP requests (fetch)
- And more...
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
To contribute a new MCP server configuration:
- Add server definition to
examples/mcp-servers.example.yaml - Test with
mcpctl enable your-server - Document any required environment variables
- Submit PR with server details
This project is licensed under the MIT License - see the LICENSE file for details.
- Model Context Protocol - The MCP specification
- Claude Code - AI-powered coding assistant
- Anthropic - Claude AI
- π Documentation
- π Issue Tracker
- π¬ Discussions
Made with β€οΈ for the Claude Code community
