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.

215 stars

Best use case

mcpctl is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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.

Teams using mcpctl should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/mcpctl/SKILL.md --create-dirs "https://raw.githubusercontent.com/megalithic/dotfiles/main/home/common/programs/ai/pi-coding-agent/skills/mcpctl/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/mcpctl/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How mcpctl Compares

Feature / AgentmcpctlStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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):

1. **Global** — `~/.pi/agent/mcp.json`
2. **Imports** — configs from other tools (vscode, cursor, claude-code, codex, windsurf)
3. **Project** — `.pi/mcp.json` in project root

Project-level entries override global entries with the same name.

## Imports

Project `.pi/mcp.json` can import servers from other tools:

```json
{
  "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** | `~/.pi/agent/mcp.json` | Nix (home-manager) | Edit `~/.dotfiles/home/common/programs/ai/pi-coding-agent/mcp.json`, then `just home` |
| **Project** | `.pi/mcp.json` (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:

1. Edit the source: `~/.dotfiles/home/common/programs/ai/pi-coding-agent/mcp.json`
2. Run `just home` (or `just rebuild`) to apply
3. 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

```json
{
  "mcpServers": {
    "server-name": {
      "command": "npx",
      "args": ["-y", "package-name@latest"],
      "env": { "KEY": "value" },
      "cwd": "/optional/working/dir"
    }
  }
}
```

### HTTP — connects to a URL

```json
{
  "mcpServers": {
    "server-name": {
      "url": "http://localhost:8080/mcp",
      "headers": { "Authorization": "Bearer token" }
    }
  }
}
```

Short form (URL only, type inferred):

```json
{
  "mcpServers": {
    "server-name": {
      "url": "https://example.com/mcp"
    }
  }
}
```

### Config options (all optional)

| Field | Type | Description |
|-------|------|-------------|
| `command` | string | Executable to run (stdio) |
| `args` | string[] | Command arguments (stdio) |
| `env` | object | Environment variables (stdio) |
| `cwd` | string | Working directory (stdio) |
| `url` | string | Server URL (HTTP) |
| `headers` | object | HTTP headers (HTTP) |
| `auth` | `"oauth"` or `"bearer"` | Auth method (HTTP) |
| `bearerToken` | string | Static bearer token |
| `bearerTokenEnv` | string | Env var name for bearer token |
| `lifecycle` | `"lazy"` / `"eager"` / `"keep-alive"` | Connection strategy (default: `lazy`) |
| `idleTimeout` | number | Minutes before idle disconnect |
| `debug` | 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

1. Ask scope if not obvious (global for cross-project, project for local)
2. Ask server type if not obvious (stdio or HTTP)
3. Gather config (command/url, args, env, etc.)
4. Read target config file (source file for global, `.pi/mcp.json` for project)
5. Warn if server name already exists — confirm before overwriting
6. Merge new server into existing `mcpServers` object
7. Write updated JSON
8. For global: edit nix source file, inform user `just home` is needed, then `/reload`
9. For project: write directly, then `/reload`
10. Verify: `mcp({ connect: "server-name" })` then `mcp({ server: "server-name" })`

### Remove

1. Determine which scope has the server (check project first, then global)
2. Read the config file
3. Remove the server entry from `mcpServers`
4. Write updated JSON
5. For global: edit nix source, inform user `just home` is needed
6. `/reload` to apply

### List

1. Read global config: `~/.dotfiles/home/common/programs/ai/pi-coding-agent/mcp.json`
2. Read project config: `.pi/mcp.json` in cwd (if exists)
3. Show all servers with:
   - Name
   - Type (stdio/HTTP)
   - Scope (global/project/imported)
   - Connection info (command or URL)
4. Use `mcp({})` to check which are currently connected and list their tools

### Inspect

1. Show full config for the named server
2. Show which scope it comes from
3. Use `mcp({ server: "server-name" })` to list available tools
4. Use `mcp({ connect: "server-name" })` to test connection if not connected

### Troubleshoot

When a server isn't working:

1. Check config syntax — read and validate the JSON
2. Check scope — is it in the right config file?
3. Check connection — `mcp({ connect: "server-name" })`
4. For stdio: verify command exists (`which <command>`), check env vars
5. For HTTP: verify URL is reachable (`curl -s -o /dev/null -w "%{http_code}" <url>`)
6. Check for name conflicts — same name in global and project?
7. Check lifecycle — eager/keep-alive servers should connect at start
8. Report findings with specific fix suggestions

Related Skills

writing-clearly-and-concisely

215
from megalithic/dotfiles

Apply Strunk's timeless writing rules to ANY prose humans will read - documentation, commit messages, error messages, explanations, reports, or UI text. Makes your writing clearer, stronger, and more professional.

web-search

215
from megalithic/dotfiles

Web search using DuckDuckGo (free, unlimited). Falls back to pi-web-access extension for content extraction.

web-browser

215
from megalithic/dotfiles

Interact with web pages using agent-browser CLI. MUST run 'browser connect 9222' FIRST to use existing browser with authenticated sessions.

tmux

215
from megalithic/dotfiles

Remote control tmux sessions for interactive CLIs (python, gdb, etc.) by sending keystrokes and scraping pane output.

ticket-worker

215
from megalithic/dotfiles

Work on a single tk ticket end-to-end. Use when the user says 'work on ticket X' or when spawned by work-tickets.sh.

ticket-creator

215
from megalithic/dotfiles

Create and refine tickets for the tk ticket system. Use when the user says 'create tickets for X', 'refine ticket X', 'break this into tickets', 'seed tickets from plan', or anything about creating or refining tk tickets.

tell

215
from megalithic/dotfiles

Delegate tasks to other agents - pi sessions or external agents (claude, opencode, aider). Non-blocking with task tracking and completion notifications.

task-pipeline

215
from megalithic/dotfiles

Structured workflow for research → plan → tickets → work. Use when starting or continuing a task with /task, /plan, or /tickets commands.

preview

215
from megalithic/dotfiles

Display code, diffs, images, and other content in a tmux pane or popup. Auto-detects nvim/megaterm for floating popups.

handoff

215
from megalithic/dotfiles

Save session state for later pickup. Use /handoff when context is degrading, /pickup to resume in a new session.

github

215
from megalithic/dotfiles

Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.

git-worktrees

215
from megalithic/dotfiles

Git worktree conventions and commands. Use when creating, switching to, or cleaning up git worktrees for branch work.