MCP (Model Context Protocol)
Open protocol for plugging external tools and data into CrabCode. Supports stdio, SSE, HTTP servers, with OAuth and built-in acosmi.com proxies.
What it is
MCP is an open protocol that lets CrabCode reach external "tools" and "data": run an MCP server (Slack, GitHub, filesystem, internal DB, ...), register it in config, and CrabCode can invoke its tools and read its resources during a conversation.
When you see this doc
- The
/mcpserver list - A
crabcode mcp addCLI argument error - A
.mcp.jsonparse-error link settings.jsonvalidation pointing at the MCP fields
Where to configure
| File | Scope |
|---|---|
~/.crabcode/settings.json (mcpServers field) | Global user |
[repo]/.mcp.json | Project shared (committed) |
[repo]/.crabcode/settings.json | Project local (not committed) |
[repo]/.crabcode/settings.local.json | Local override (gitignored) |
Load order: user → project → local → policy; later loads override earlier ones for the same server name.
Example
{
"mcpServers": {
"filesystem": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/code"],
"env": { "LOG_LEVEL": "info" }
},
"sentry": {
"type": "http",
"url": "https://mcp.sentry.dev/mcp",
"headers": { "Authorization": "Bearer ${SENTRY_TOKEN}" }
},
"internal-sse": {
"type": "sse",
"url": "https://internal.example.com/sse"
}
}
}{
"mcpServers": {
"filesystem": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/me/code"],
"env": { "LOG_LEVEL": "info" }
},
"sentry": {
"type": "http",
"url": "https://mcp.sentry.dev/mcp",
"headers": { "Authorization": "Bearer ${SENTRY_TOKEN}" }
},
"internal-sse": {
"type": "sse",
"url": "https://internal.example.com/sse"
}
}
}Supported type: stdio / http / sse. (IDE extensions use internal sse-ide / ws-ide — not user-facing.)
Windows note
A bare command: "npx" doesn't resolve on Windows; route through cmd:
{
"mcpServers": {
"filesystem": {
"type": "stdio",
"command": "cmd",
"args": ["/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:\\code"]
}
}
}{
"mcpServers": {
"filesystem": {
"type": "stdio",
"command": "cmd",
"args": ["/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:\\code"]
}
}
}CLI commands
crabcode mcp is the non-interactive admin entry point:
| Command | Use |
|---|---|
crabcode mcp list | List all MCP servers with scope and status |
crabcode mcp get [name] | Show full config for one server |
crabcode mcp add [name] -- [cmd] [args...] | Add a stdio server |
crabcode mcp add --transport http [name] [url] | Add an HTTP server (--transport sse works the same) |
crabcode mcp add --header "Authorization: Bearer ..." ... | With auth headers |
crabcode mcp add -e KEY=VAL ... -- [cmd] | Inject env vars |
crabcode mcp add-json [name] [json] | Paste a JSON config directly |
crabcode mcp remove [name] [-s user/project/local] | Remove a server |
crabcode mcp reset-project-choices | Reset .mcp.json trust decisions (reprompts on next load) |
crabcode mcp serve | Run CrabCode itself as an MCP server (callable by other MCP clients) |
crabcode mcp xaa setup / login | Configure Cross-App Access (SEP-990) IdP |
Startup flags
--mcp-config <file>— load extra config files (space-separated, may repeat)--strict-mcp-config— use only--mcp-configsources; ignore user/project/local--mcp-debug— deprecated, use--debug
Slash commands
| Command | Use |
|---|---|
/mcp | Live server status; pick an entry to toggle |
/mcp enable/disable [name] or all | Enable / disable |
/mcp reconnect [name] | Force reconnect |
OAuth and built-in acosmi.com servers
- OAuth:
sse/httpservers can declare anoauthblock (clientId/callbackPort/authServerMetadataUrl). The first tool call opens a browser for authorization; tokens cache in your local keychain - Cross-App Access (XAA): configure the enterprise IdP once with
crabcode mcp xaa setup; XAA-enabled servers then share that identity instead of logging in per server - acosmi.com proxy servers: once signed in to Acosmi, a set of
acosmi.com <Name>servers appears automatically, forwarded by the gateway — no manual config; they show up directly in/mcp
Limits and caveats
- stdio servers are long-lived: spawned at CrabCode startup, killed on session exit; a crash means waiting for next launch
- Header env-var interpolation:
Bearer ${TOKEN}and$TOKENboth work; undefined vars expand to empty string .mcp.jsontrust: first load of a project's.mcp.jsonprompts for approval; decisions cache locally — usereset-project-choicesto re-prompt- Name collisions: later loads override earlier;
crabcode mcp addrefuses a duplicate name within the same scope - Scope: defaults to
user; use-s projectfor.mcp.json(team-shared) or-s localfor the gitignored local file