Dotfiles mcpctl
Manage MCP server configurations — add, remove, list, inspect, troubleshoot. Use when asked to "add mcp server", "remove mcp", "list mcp servers", "mcp status", "configure mcp", "troubleshoot mcp", or any MCP server management task.
install
source · Clone the upstream repo
git clone https://github.com/megalithic/dotfiles
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/megalithic/dotfiles "$T" && mkdir -p ~/.claude/skills && cp -r "$T/home/common/programs/ai/pi-coding-agent/skills/mcpctl" ~/.claude/skills/megalithic-dotfiles-mcpctl && rm -rf "$T"
manifest:
home/common/programs/ai/pi-coding-agent/skills/mcpctl/SKILL.mdsource content
mcpctl — MCP server management
Manage MCP server configurations for pi-mcp-adapter. Supports global and project scopes, stdio and HTTP server types.
Load order
pi-mcp-adapter merges configs in this order (later wins):
- Global —
~/.pi/agent/mcp.json - Imports — configs from other tools (vscode, cursor, claude-code, codex, windsurf)
- Project —
in project root.pi/mcp.json
Project-level entries override global entries with the same name.
Imports
Project
.pi/mcp.json can import servers from other tools:
{ "imports": ["vscode", "cursor", "claude-code"], "mcpServers": { "my-server": { ... } } }
Supported import sources:
vscode, cursor, claude-code, codex, windsurf. Imported servers are merged between global and project configs.
Scope rules
| Scope | Config file | Managed by | How to edit |
|---|---|---|---|
| Global | | Nix (home-manager) | Edit , then |
| Project | (project root) | Direct | Write file directly |
Global is nix-managed. The file at
~/.pi/agent/mcp.json is a symlink to the nix store. To change it:
- Edit the source:
~/.dotfiles/home/common/programs/ai/pi-coding-agent/mcp.json - Run
(orjust home
) to applyjust rebuild - Reload pi with
/reload
Project is direct. Write
.pi/mcp.json in the project root. No rebuild needed — just /reload.
Server types
Stdio — runs a local command
{ "mcpServers": { "server-name": { "command": "npx", "args": ["-y", "package-name@latest"], "env": { "KEY": "value" }, "cwd": "/optional/working/dir" } } }
HTTP — connects to a URL
{ "mcpServers": { "server-name": { "url": "http://localhost:8080/mcp", "headers": { "Authorization": "Bearer token" } } } }
Short form (URL only, type inferred):
{ "mcpServers": { "server-name": { "url": "https://example.com/mcp" } } }
Config options (all optional)
| Field | Type | Description |
|---|---|---|
| string | Executable to run (stdio) |
| string[] | Command arguments (stdio) |
| object | Environment variables (stdio) |
| string | Working directory (stdio) |
| string | Server URL (HTTP) |
| object | HTTP headers (HTTP) |
| or | Auth method (HTTP) |
| string | Static bearer token |
| string | Env var name for bearer token |
| / / | Connection strategy (default: ) |
| number | Minutes before idle disconnect |
| boolean | Show server stderr |
Lifecycle modes:
- lazy (default) — connects on first tool call, disconnects after idle timeout
- eager — connects at session start, no auto-disconnect
- keep-alive — connects at start, auto-reconnects if dropped
Operations
Add
- Ask scope if not obvious (global for cross-project, project for local)
- Ask server type if not obvious (stdio or HTTP)
- Gather config (command/url, args, env, etc.)
- Read target config file (source file for global,
for project).pi/mcp.json - Warn if server name already exists — confirm before overwriting
- Merge new server into existing
objectmcpServers - Write updated JSON
- For global: edit nix source file, inform user
is needed, thenjust home/reload - For project: write directly, then
/reload - Verify:
thenmcp({ connect: "server-name" })mcp({ server: "server-name" })
Remove
- Determine which scope has the server (check project first, then global)
- Read the config file
- Remove the server entry from
mcpServers - Write updated JSON
- For global: edit nix source, inform user
is neededjust home
to apply/reload
List
- Read global config:
~/.dotfiles/home/common/programs/ai/pi-coding-agent/mcp.json - Read project config:
in cwd (if exists).pi/mcp.json - Show all servers with:
- Name
- Type (stdio/HTTP)
- Scope (global/project/imported)
- Connection info (command or URL)
- Use
to check which are currently connected and list their toolsmcp({})
Inspect
- Show full config for the named server
- Show which scope it comes from
- Use
to list available toolsmcp({ server: "server-name" }) - Use
to test connection if not connectedmcp({ connect: "server-name" })
Troubleshoot
When a server isn't working:
- Check config syntax — read and validate the JSON
- Check scope — is it in the right config file?
- Check connection —
mcp({ connect: "server-name" }) - For stdio: verify command exists (
), check env varswhich <command> - For HTTP: verify URL is reachable (
)curl -s -o /dev/null -w "%{http_code}" <url> - Check for name conflicts — same name in global and project?
- Check lifecycle — eager/keep-alive servers should connect at start
- Report findings with specific fix suggestions