Purpose
OpenClaw MCP Server is a Model Context Protocol (MCP) server used to integrate the OpenClaw AI assistant into the Claude ecosystem. The author built it because they did not want to rely solely on messaging channels to communicate with OpenClaw, but instead wanted to connect OpenClaw to the Claude web interface, so that chat could delegate tasks to the Claw bot, which would then handle the follow-up work, such as launching Claude Code to fix issues. You can think of it as having one AI assistant orchestrate another AI assistant.
Main capabilities
- Establishes a secure bridge between Claude.ai and a self-hosted OpenClaw assistant, with OAuth2 authentication support.
- Provides synchronous and asynchronous tools; asynchronous tools are used for long-running operations.
- Task scope is bound to the MCP connection that created it: in HTTP mode, when one process serves multiple clients, a client can only view and cancel its own tasks, and other clients' task_id will appear as "not found"; reconnecting opens a new scope, so a queued task should be polled on the connection that queued it.
- Multi-instance mode: multiple OpenClaw gateways can be orchestrated from a single MCP server, routing requests to custom-named instances such as prod, staging, and dev. All tools accept an optional instance parameter to specify the target gateway; when omitted, the default instance is used. Each instance has its own authentication token, timeout, and URL, and is fully isolated. This mode supports zero-migration upgrades, and existing single-instance deployments require no configuration changes; tokens are not exposed through openclaw_instances.
Usage
Docker (recommended)
Prebuilt images are pushed to GitHub Container Registry on each release. Create docker-compose.yml, generate secrets, and start it. Then add a custom MCP connector in Claude.ai, pointing to https://your-domain.com/mcp,并使用 MCP_CLIENT_ID=openclaw and MCP_CLIENT_SECRET.
Important: the connector URL must end with /mcp; this is the Streamable HTTP endpoint. The bare domain (https://your-domain.com)会命中服务器根路径,在 After OAuth completes, it returns 404.
Tip: in production, it is recommended to pin a specific version rather than latest, for example ghcr.io/freema/openclaw-mcp:1.1.0.
Local (Claude Desktop)
Add the corresponding configuration to the Claude Desktop configuration.
Remote (Claude.ai) without Docker
Important: when running behind a reverse proxy (Caddy, nginx, Traefik, Cloudflare Tunnel, etc.), you must set:
- MCP_ISSUER_URL (or --issuer-url) to the public HTTPS URL, otherwise the OAuth metadata will advertise http://localhost:3000,导致客户端认证失败。
- TRUST_PROXY=1 (or --trust-proxy 1), otherwise express-rate-limit will reject the proxy's X-Forwarded-For header, and /token will crash with ERR_ERL_UNEXPECTED_X_FORWARDED_FOR.
It is recommended to set MCP_REDIRECT_URIS=https://claude.ai/api/mcp/auth_callback,https://claude.com/api/mcp/auth_callback,使授权码只能投递到 Claude's callback address. Note the exact /api/mcp/auth_callback path; matching is exact, and a typo will cause OAuth to fail with an Unregistered redirect_uri error.
Transport migration
Starting from v1.5.0, the primary transport is Streamable HTTP (--transport http). The legacy SSE transport (--transport sse) is deprecated but still backward compatible. When migrating, replace --transport sse with --transport http in CLI / Docker; the Claude.ai connector URL does not need to change, because Claude.ai already uses /mcp (Streamable HTTP); legacy clients can still use the /sse and /messages endpoints, and each SSE connection logs a deprecation warning; when using the official Docker image, the Dockerfile ENTRYPOINT is updated automatically. --transport sse will continue to work as a deprecated alias, and both transports are served simultaneously regardless of which flag is used.
Upgrading to 1.7.0
Two defaults have changed for security reasons, affecting only HTTP mode; stdio is unchanged:
- CORS is now disabled by default. Previously, not setting CORS_ORIGINS would send Access-Control-Allow-Origin: . If browser clients depend on that behavior, set the origin explicitly (CORS_ORIGINS=https://your-app.com),或设置 CORS_ORIGINS= restores the old behavior.
- Async tasks are scoped to the connection that created them. Previously, clients polling a task_id queued by another connection would now get "not found".
Use cases
- Want to delegate tasks from the Claude.ai web interface to a self-hosted OpenClaw assistant.
- Need to have one AI assistant orchestrate another AI assistant, for example triggering Claude Code to fix an issue.
- Need to manage multiple OpenClaw gateways (production, staging, development, etc.) from a single MCP server.
- Need a self-hosted deployment with OAuth2 authentication and a secure bridge.
Limitations and caveats
- Always enable authentication in production.
- CORS is disabled by default unless actively enabled; only set CORS_ORIGINS when browser clients need direct access to the server.
- The connector URL must end with /mcp, otherwise it returns 404 after OAuth completes.
- Behind a reverse proxy, MCP_ISSUER_URL and TRUST_PROXY must be set correctly, otherwise authentication or /token will fail.
- Redirect URI matching is exact, and a typo will cause OAuth to fail.
- Async tasks can only be polled on the connection that created them; across connections it will show "not found".
- The OpenClaw gateway needs the HTTP API enabled, for example by setting gateway.http.endpoints.chatCompletions.enabled to true in openclaw.json.
The project was created by Tomáš Grasl. Related projects include OpenClaw (the AI assistant this MCP connects to) and the MCP Specification (Model Context Protocol documentation).