Skip to content

MCP Integration

MCP lets Anode use tools from local or remote servers. Anode supports stdio and basic HTTP JSON-RPC transports, tool filtering, OAuth tokens, and workspace trust.

Define MCP servers in a JSON config file. Each server entry maps a name to a ServerConfig object.

PathScopeLoading
~/.config/anode/mcp.jsonUserAlways loaded
anode.jsonWorkspaceRequires trust, mcp.allowWorkspace: true, or ANODE_ENABLE_WORKSPACE_MCP=true; reads a top-level mcpServers object
.mcp.jsonWorkspaceRequires trust, mcp.allowWorkspace: true, or ANODE_ENABLE_WORKSPACE_MCP=true

User-level servers load first. Workspace servers merge in second.

FieldTypeDescription
commandstringExecutable to launch (stdio transport)
argsstring[]Arguments passed to command
envmapEnvironment variables. Supports ${VAR} and ${VAR:-default} expansion
cwdstringWorking directory for the server process
urlstringHTTP endpoint (HTTP transport). Mutually exclusive with command
headersmapHTTP headers sent with every request
includeToolsstring[]Tool name patterns to include. Only matching tools register
excludeToolsstring[]Tool name patterns to exclude. Matching tools are dropped

Set command for stdio servers. Set url for HTTP servers. Do not set both.

{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/projects"],
"env": {
"NODE_ENV": "production"
}
}
}
}

Anode spawns npx as a child process and communicates over stdin/stdout.

{
"mcpServers": {
"remote-db": {
"url": "https://mcp.example.com/v1",
"headers": {
"X-API-Key": "${MCP_DB_KEY}"
},
"includeTools": ["query_*"],
"excludeTools": ["query_drop_table"]
}
}
}

The env expansion syntax works inside headers values too.

Workspace-level MCP config files (anode.json and .mcp.json) do not load automatically. Anode requires explicit trust.

Trust a workspace:

anode mcp trust
anode mcp approve

This stores a SHA-256 hash of the workspace root path in ~/.config/anode/mcp-trust.json. The next time you open this workspace, Anode loads workspace MCP config without prompting.

Alternatively, set the environment variable to skip trust checks:

export ANODE_ENABLE_WORKSPACE_MCP=true

Or set the main config flag:

{
"mcp": {
"allowWorkspace": true
}
}

When workspace MCP is enabled, Anode checks both anode.json and .mcp.json at the workspace root. In anode.json, MCP servers must be under a top-level mcpServers key, not under the main mcp settings object.

Add or remove user-level servers in ~/.config/anode/mcp.json:

anode mcp add docs --url https://example.com/mcp
anode mcp add local --env TOKEN=secret -- npx -y @modelcontextprotocol/server-filesystem .
anode mcp remove docs

--header KEY=VALUE adds HTTP headers for remote MCP servers configured with --url. --env KEY=VALUE and --cwd <dir> apply to stdio commands configured after --.

MCP tools register with a namespaced name:

mcp__<server>__<tool>

Both <server> and <tool> are sanitized: lowercased, restricted to alphanumeric characters, dashes, and underscores. For example, a tool readFile on server filesystem becomes mcp__filesystem__readfile.

Use includeTools and excludeTools to control which tools a server exposes. Patterns are matched against tool names before registration.

  • includeTools: Only tools matching at least one pattern are registered.
  • excludeTools: Tools matching any pattern are dropped (applied after include).

Patterns support glob syntax. For example, ["read_*", "list_*"] matches read_file and list_dir.

Authenticate with remote MCP servers that require OAuth.

anode mcp oauth login remote-db

This starts a browser-based OAuth PKCE flow:

  1. Anode derives authorize and token URLs from the server URL (/oauth/authorize, /oauth/token).
  2. A local callback server opens in your browser.
  3. You approve access. Anode stores tokens in ~/.config/anode/mcp-oauth.json.

The Bearer token is automatically injected into HTTP headers for that server.

FlagDescription
--server-url <url>MCP server URL (auto-detected from config if omitted)
--client-id <id>OAuth client ID
--client-secret <secret>OAuth client secret (if required)
--scopes <scopes>OAuth scopes (space-separated)

When --server-url is omitted, Anode resolves the URL from the same MCP config set used by anode mcp: user config first, then trusted or explicitly enabled workspace config.

Anode refreshes tokens automatically with a 60-second buffer before expiry. No manual intervention needed.

anode mcp oauth logout remote-db

This clears stored credentials for the named server.

anode mcp oauth status

Shows token status for all configured MCP servers - whether tokens are valid, expired, or absent.

anode mcp list

Shows configured server definitions without connecting to them. Use --connect to connect to servers and show connection status plus discovered tools. Use --timeout <duration> with --connect to override the connection timeout (default 10s). Explicit timeout values must be greater than zero.

anode mcp doctor

Validates your MCP config files and tests connections to all servers. Use this to diagnose startup failures or misconfigured servers. Successful checks end with MCP doctor passed..

anode mcp status

Shows the current connection state for configured MCP servers. Use this when a tool disappears from the registry or a server was expected to reconnect.

anode mcp info
anode mcp info filesystem

Prints one server or all servers with config details, discovered tools, and resources. Use it before changing include/exclude filters.

anode mcp tools
anode mcp resources

tools lists every currently exposed MCP tool with its namespaced Anode name. resources lists resources exposed by connected servers.

Read one resource directly:

anode mcp read filesystem file:///home/user/project/README.md
anode mcp reload

Reconnects configured MCP servers in place. Use it after editing ~/.config/anode/mcp.json, anode.json, or .mcp.json instead of restarting the TUI.

Skills can bundle their own mcp.json alongside SKILL.md. These servers activate lazily - only when the skill runs. See Agents and Skills for details on skill structure.

Enable skill-local MCP in config:

{
"skills": {
"allowMCP": true
}
}

For compatibility, the workspace MCP environment gate also enables skill-local MCP when skills.allowMCP is not set:

export ANODE_ENABLE_WORKSPACE_MCP=true

The active profile and tool policy still apply to skill-local MCP tools.

These keys live in your config.json under mcp:

KeyTypeDefaultDescription
allowWorkspaceboolfalseAllow workspace .mcp.json loading without explicit trust
connectTimeoutint10MCP connection timeout in seconds
{
"mcp": {
"allowWorkspace": false,
"connectTimeout": 15
}
}