MCP Server Integration
How to Add MCP Servers to OpenClaw
Section titled “How to Add MCP Servers to OpenClaw”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.serversfor 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:
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:
openclaw mcp login musicThe 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.
Adding a local server (stdio)
Section titled “Adding a local server (stdio)”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:
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.
How tools are named
Section titled “How tools are named”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.
The minimal profile hides MCP tools
Section titled “The minimal profile hides MCP tools”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.
Limiting which tools a server exposes
Section titled “Limiting which tools a server exposes”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:
openclaw mcp tools notes --exclude delete_note,move_noteThis 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.
Checking that it works
Section titled “Checking that it works”openclaw mcp status --verbose # every server: transport, auth state, tool countopenclaw mcp doctor music --probe # config + credentials + a live connectionopenclaw mcp probe notes # just the connection and tool listdoctor reporting “OAuth credentials are not authorized” means the token is missing or expired: run openclaw mcp login <name> again.
Hot reload vs restart
Section titled “Hot reload vs restart”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.
Restricted agents and travel data
Section titled “Restricted agents and travel data”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.