Skip to content

MCP Server Integration

OpenClaw has a native MCP (Model Context Protocol) client. Servers are declared under mcp.servers.<name> in ~/.openclaw/openclaw.json, and their tools show up to agents like any other tool. Nothing extra to install: no bridge process, no wrapper scripts, no shell round-trip through exec.

Native plugins vs MCP servers. Apple PIM, Fastmail, and Travel Hub run as native OpenClaw plugins that register typed tools in-process (see Plugins and Skills). Use mcp.servers for anything that already speaks MCP and has no plugin: a vendor’s hosted server, or a community stdio server for a local app.

Adding a remote server (streamable HTTP + OAuth)

Section titled “Adding a remote server (streamable HTTP + OAuth)”

Most hosted MCP servers use the streamable-http transport with OAuth. Add one with the CLI:

Terminal window
openclaw mcp add music \
--url https://mcp.example-music.com/mcp \
--transport streamable-http \
--auth oauth \
--oauth-scope "playback-control-all catalog:read"

add probes the server immediately; pass --no-probe if the server rejects unauthenticated probes. Then complete the login:

Terminal window
openclaw mcp login music

The login prints an authorize URL. Open it, sign in with the account you want the agent to act as, and approve. The CLI listens on 127.0.0.1:8989/oauth/callback for the redirect and times out after about five minutes. If the browser can’t reach that callback (headless box, different machine), copy the code parameter from the redirect URL and finish with openclaw mcp login music --code <code>.

The equivalent config in openclaw.json:

{
"mcp": {
"servers": {
"music": {
"url": "https://mcp.example-music.com/mcp",
"transport": "streamable-http",
"auth": "oauth",
"oauth": { "scope": "playback-control-all catalog:read" }
}
}
}
}

OAuth tokens are stored in the gateway’s state database, not in openclaw.json and not in secrets.json. There is nothing to paste or rotate by hand; when a token dies, openclaw mcp login <name> again.

Servers that run as a local process use the stdio transport (implied whenever a command is set). The command must resolve in the gateway’s environment, so prefer absolute paths:

Terminal window
openclaw mcp add notes \
--command /opt/homebrew/bin/npx \
--arg -y --arg some-notes-mcp@1.2.3 --arg "/Users/AGENT_USER/Notes"

Or in config:

{
"mcp": {
"servers": {
"notes": {
"command": "/opt/homebrew/bin/npx",
"args": ["-y", "some-notes-mcp@1.2.3", "/Users/AGENT_USER/Notes"],
"toolFilter": { "exclude": ["delete_note", "move_note"] }
}
}
}
}

Pin the package version. An unpinned npx -y fetches whatever is newest on the next gateway start, which is a supply-chain risk and a debugging headache.

Every MCP tool surfaces as <server>__<tool> (double underscore). The music server’s play tool becomes music__play; the notes server’s search_notes becomes notes__search_notes. All of them belong to one built-in plugin, bundle-mcp.

This is the step people miss. If an agent uses tools.profile: "minimal" (the recommended baseline for a family assistant), MCP tools are hidden until you allow them explicitly. Add a server glob to that agent’s alsoAllow:

{
"agents": {
"list": [
{
"id": "main-agent",
"tools": {
"profile": "minimal",
"alsoAllow": ["exec", "music__*", "notes__*"]
}
},
{
"id": "family-agent",
"tools": {
"profile": "minimal",
"deny": ["notes__*"] // belt and braces: never expose private notes here
}
}
]
}
}

Agents that run sandboxed additionally need bundle-mcp (or the same glob) in tools.sandbox.tools.allow, otherwise the sandbox filter drops the tools even though the profile allows them.

You do not have to take every tool a server offers. Exclude the destructive ones at the server level so no agent can reach them:

Terminal window
openclaw mcp tools notes --exclude delete_note,move_note

This writes a per-server toolFilter.exclude list into the config (shown in the stdio example above). Excluded tools are never registered, so they do not appear in any agent’s tool list regardless of alsoAllow.

Terminal window
openclaw mcp status --verbose # every server: transport, auth state, tool count
openclaw mcp doctor music --probe # config + credentials + a live connection
openclaw mcp probe notes # just the connection and tool list

doctor reporting “OAuth credentials are not authorized” means the token is missing or expired: run openclaw mcp login <name> again.

Edits to mcp.servers and to an agent’s tools.alsoAllow hot-reload in the running gateway. Watch the log for config hot reload applied, or force it with openclaw mcp reload. Changes to plugins.load.paths still need a full gateway restart.

Family and group agents should not get direct MCP access to anything private. When they need travel information, they ask the travel agent for it with sessions_send and get back a summary, the same delegation pattern used for mail. See Multi-Agent Architecture.