High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph โ average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.
MCP server for OpenClaw and Claude.ai
OpenClaw MCP Server sits between an MCP client and a self-hosted OpenClaw gateway. It handles OAuth2, CORS, validation, and request routing so the client can send chats, check health, and manage async tasks through OpenClaw.
Builders who want Claude.ai or Claude Desktop to hand tasks to a self-hosted OpenClaw assistant.
You can delegate work from Claude to OpenClaw through a secured MCP bridge instead of copying messages back and forth.
What it does
OAuth2 protected bridge
Adds OAuth 2.1 authentication for HTTP access to the MCP server.
Chat and status tools
Provides `openclaw_chat`, `openclaw_status`, and `openclaw_instances` for talking to and inspecting OpenClaw.
Async task tools
Adds `openclaw_chat_async`, `openclaw_task_status`, `openclaw_task_list`, and `openclaw_task_cancel` for long-running work.
Multi-instance routing
Lets one server route requests to multiple OpenClaw gateways with separate URLs, tokens, and timeouts.
Docker and compose setup
Includes Dockerfile and compose examples for local, remote, and production deployment.
Security guidance
Documents threat boundaries, logging rules, CORS defaults, and reverse-proxy settings.
How to get it
- 1Pre-built images are published to GitHub Container Registry on every release.
docker pull ghcr.io/freema/openclaw-mcp:latest
- 2Generate secrets and start
export MCP_CLIENT_SECRET=$(openssl rand -hex 32) export OPENCLAW_GATEWAY_TOKEN=your-gateway-token docker compose up -d
- 3Run
npx openclaw-mcp
- 4Run
AUTH_ENABLED=true MCP_CLIENT_ID=openclaw MCP_CLIENT_SECRET=your-secret \ MCP_ISSUER_URL=https://mcp.your-domain.com \ CORS_ORIGINS=https://claude.ai OPENCLAW_GATEWAY_TOKEN=your-gateway-token \ npx openclaw-mcp --transport http --port 3000
- 5Run
OPENCLAW_INSTANCES='[ {"name": "prod", "url": "http://prod:18789", "token": "tok1", "default": true}, {"name": "staging", "url": "http://staging:18789", "token": "tok2"}, {"name": "dev", "url": "http://dev:18789", "token": "tok3"} ]'
README
OpenClaw MCP Server
๐ฆ Model Context Protocol (MCP) server for OpenClaw AI assistant integration.
Demo
Why I Built This
Hey! I created this MCP server because I didn't want to rely solely on messaging channels to communicate with OpenClaw. What really excites me is the ability to connect OpenClaw to the Claude web UI. Essentially, my chat can delegate tasks to my Claw bot, which then handles everything else โ like spinning up Claude Code to fix issues for me.
Think of it as an AI assistant orchestrating another AI assistant. Pretty cool, right?
Quick Start
Docker (Recommended)
Pre-built images are published to GitHub Container Registry on every release.
docker pull ghcr.io/freema/openclaw-mcp:latest
Create a docker-compose.yml:
services:
mcp-bridge:
image: ghcr.io/freema/openclaw-mcp:latest
container_name: openclaw-mcp
restart: unless-stopped
ports:
- "3000:3000"
environment:
- OPENCLAW_URL=http://host.docker.internal:18789
- OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN}
- OPENCLAW_AGENT_ID=${OPENCLAW_AGENT_ID:-}
- OPENCLAW_MODEL=openclaw
- AUTH_ENABLED=true
- MCP_CLIENT_ID=openclaw
- MCP_CLIENT_SECRET=${MCP_CLIENT_SECRET}
- MCP_ISSUER_URL=${MCP_ISSUER_URL:-}
- MCP_REDIRECT_URIS=https://claude.ai/api/mcp/auth_callback,https://claude.com/api/mcp/auth_callback
- TRUST_PROXY=1
- CORS_ORIGINS=https://claude.ai
extra_hosts:
- "host.docker.internal:host-gateway"
read_only: true
security_opt:
- no-new-privileges
Generate secrets and start:
export MCP_CLIENT_SECRET=$(openssl rand -hex 32)
export OPENCLAW_GATEWAY_TOKEN=your-gateway-token
docker compose up -d
Then in Claude.ai add a custom MCP connector pointing to https://your-domain.com/mcp with MCP_CLIENT_ID=openclaw and your MCP_CLIENT_SECRET.
Important: The connector URL must end with
/mcpโ that's the Streamable HTTP endpoint. A bare domain (https://your-domain.com) hits the server root and returns 404 after OAuth completes.
Tip: Pin a specific version instead of
latestfor production:ghcr.io/freema/openclaw-mcp:1.1.0
Local (Claude Desktop)
npx openclaw-mcp
Add to your Claude Desktop config:
{
"mcpServers": {
"openclaw": {
"command": "npx",
"args": ["openclaw-mcp"],
"env": {
"OPENCLAW_URL": "http://127.0.0.1:18789",
"OPENCLAW_GATEWAY_TOKEN": "your-gateway-token",
"OPENCLAW_AGENT_ID": "main",
"OPENCLAW_MODEL": "openclaw",
"OPENCLAW_TIMEOUT_MS": "300000"
}
}
}
}
Remote (Claude.ai) without Docker
AUTH_ENABLED=true MCP_CLIENT_ID=openclaw MCP_CLIENT_SECRET=your-secret \
MCP_ISSUER_URL=https://mcp.your-domain.com \
CORS_ORIGINS=https://claude.ai OPENCLAW_GATEWAY_TOKEN=your-gateway-token \
npx openclaw-mcp --transport http --port 3000
Important: When running behind a reverse proxy (Caddy, nginx, Traefik, Cloudflare Tunnel, etc.) you must set:
MCP_ISSUER_URL(or--issuer-url) to your public HTTPS URL โ otherwise OAuth metadata advertiseshttp://localhost:3000and clients fail to authenticate.TRUST_PROXY=1(or--trust-proxy 1) โ otherwiseexpress-rate-limitrejects the proxy'sX-Forwarded-Forheader and/tokencrashes withERR_ERL_UNEXPECTED_X_FORWARDED_FOR.
Recommended: Set
MCP_REDIRECT_URIS=https://claude.ai/api/mcp/auth_callback,https://claude.com/api/mcp/auth_callbackso authorization codes can only be delivered to Claude's callbacks. Note the exact/api/mcp/auth_callbackpath โ matching is exact, and getting it wrong fails OAuth withUnregistered redirect_uri(see Troubleshooting).
See Installation Guide for details.
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Your Server โ
โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ OpenClaw โ โ OpenClaw MCP โ โ
โ โ Gateway โโโโโโโบโ Bridge Server โ โ
โ โ :18789 โ โ :3000 โ โ
โ โ โ โ โ โ
โ โ OpenAI-compat โ โ - OAuth 2.1 auth โ โ
โ โ /v1/chat/... โ โ - CORS protection โ โ
โ โโโโโโโโโโโโโโโโโโโ โ - Input validation โ โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโโโโโ โ
โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTPS + OAuth 2.1
โผ
โโโโโโโโโโโโโโโโโโโ
โ Claude.ai โ
โ (MCP Client) โ
โโโโโโโโโโโโโโโโโโโ
Available Tools
Sync Tools
| Tool | Description |
|---|---|
openclaw_chat | Send messages to OpenClaw and get responses |
openclaw_status | Check OpenClaw gateway health |
openclaw_instances | List all configured OpenClaw instances |
Async Tools (for long-running operations)
| Tool | Description |
|---|---|
openclaw_chat_async | Queue a message, get task_id immediately |
openclaw_task_status | Check task progress and get results |
openclaw_task_list | List your tasks with filtering |
openclaw_task_cancel | Cancel a pending task |
Tasks are scoped to the MCP connection that created them. In HTTP mode, where
one process serves many clients, a client can only see and cancel its own
tasks โ another client's task_id reads as "not found" even if it is known.
Reconnecting starts a fresh scope, so poll a task on the connection that
queued it.
Multi-Instance Mode
Orchestrate multiple OpenClaw gateways from a single MCP server. One bridge, many claws โ route requests to prod, staging, dev, or whatever you name them (lobster-supreme and the-claw-abides are perfectly valid names).
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Claude.ai / Claude Desktop โ
โ (MCP Client) โ
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ OpenClaw MCP Bridge Server โ
โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โ
โ โ Instance โ โ Instance โ โ Instance โ โ
โ โ Registry โ โ Resolver โ โ Validator โ โ
โ โโโโโโโโฌโโโโโโโโ โโโโโโโโฌโโโโโโโโ โโโโโโโโฌโโโโโโโโ โ
โ โ โ โ โ
โ โโโโโโโโดโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโดโโโโโโโโ โ
โ โ Per-Instance OpenClaw Clients โ โ
โ โ (separate auth, timeout, URL per instance) โ โ
โ โโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ ๐ฆ prod โ โ ๐ฆ staging โ โ ๐ฆ dev โ
โ (default) โ โ โ โ โ
โ :18789 โ โ :18789 โ โ :18789 โ
โ OpenClaw GW โ โ OpenClaw GW โ โ OpenClaw GW โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
Setup
OPENCLAW_INSTANCES='[
{"name": "prod", "url": "http://prod:18789", "token": "tok1", "default": true},
{"name": "staging", "url": "http://staging:18789", "token": "tok2"},
{"name": "dev", "url": "http://dev:18789", "token": "tok3"}
]'
Usage
All tools accept an optional instance parameter to target a specific gateway:
# Chat with staging instance
openclaw_chat message="Deploy status?" instance="staging"
# Check health of prod
openclaw_status instance="prod"
# List all configured instances
openclaw_instances
# Async task targeting dev
openclaw_chat_async message="Run tests" instance="dev"
When instance is omitted, the default instance is used. Each instance has its own auth token, timeout, and URL โ fully isolated.
Key Features
- Zero-migration upgrade โ existing single-instance deployments work without any config change
- Per-instance isolation โ separate auth tokens, timeouts, and URLs
- Dynamic routing โ Claude picks the right instance per request
- Task tracking โ async tasks remember which instance they target
- Security โ tokens are never exposed via
openclaw_instances
See Configuration โ Multi-Instance Mode for the full reference.
Documentation
- Installation โ Setup for Claude Desktop & Claude.ai
- Configuration โ Environment variables & options
- Deployment โ Docker & production setup
- Threat Model โ What Claude can/can't trigger, trust boundaries & attack surfaces
- Logging โ What gets logged, where, and what is never logged
- Development โ Contributing & adding tools
- Security โ Security policy & best practices
Security
โ ๏ธ Always enable authentication in production!
# Generate secure client secret
export MCP_CLIENT_SECRET=$(openssl rand -hex 32)
# Run with auth enabled
AUTH_ENABLED=true MCP_CLIENT_ID=openclaw MCP_CLIENT_SECRET=$MCP_CLIENT_SECRET \
openclaw-mcp --transport http
CORS is disabled unless you opt in. Set CORS_ORIGINS only when a browser
client needs to reach the server directly:
CORS_ORIGINS=https://claude.ai,https://your-app.com
See Configuration for all security options.
Upgrading to 1.7.0
Two defaults changed for security. Both only affect HTTP mode; stdio is unchanged.
- CORS is now off by default. Previously an unset
CORS_ORIGINSsentAccess-Control-Allow-Origin: *. If a browser client depends on that, set the origins explicitly (CORS_ORIGINS=https://your-app.com), orCORS_ORIGINS=*to restore the old behaviour. - Async tasks are scoped to the connection that created them. A client
that used to poll a
task_idqueued by a different connection will now get "not found".
Migrating from SSE to HTTP transport
Starting with v1.5.0, the primary transport is Streamable HTTP (--transport http). The legacy SSE transport (--transport sse) is deprecated but still works for backward compatibility.
What changed
| Before | After |
|---|---|
--transport sse | --transport http (recommended) |
Primary endpoint: GET /sse | Primary endpoint: POST/GET/DELETE /mcp |
Health: "transport": "sse" | Health: "transport": "streamable-http" |
Migration steps
-
CLI / Docker: Replace
--transport ssewith--transport http# Before openclaw-mcp --transport sse --port 3000 # After openclaw-mcp --transport http --port 3000 -
Claude.ai connector URL: No change needed โ Claude.ai already uses
/mcp(Streamable HTTP) -
Legacy clients: The
/sseand/messagesendpoints still work. A deprecation warning is logged on each SSE connection. -
Dockerfile ENTRYPOINT: Updated automatically if using the official Docker image
Note:
--transport ssewill continue to work as a deprecated alias. Both transports are served simultaneously regardless of which flag you use.
Requirements
- Node.js โฅ 20
- OpenClaw gateway running with HTTP API enabled:
// openclaw.json { "gateway": { "http": { "endpoints": { "chatCompletions": { "enabled": true } } } } }
License
MIT
Author
Created by Tomรกลก Grasl
Related Projects
- OpenClaw โ The AI assistant this MCP connects to
- MCP Specification โ Model Context Protocol docs
Files in the repo
- .claude-plugin
- .github
- docs
- plugins
- src
- .dockerignore
- .env.example
- .eslintrc.json
- .gitignore
- .prettierrc
- CLAUDE.md
- docker-compose.dev.yml
- docker-compose.yml
- Dockerfile
- LICENSE
- package-lock.json
- package.json
- README.md
- SECURITY.md
- server.json
- Taskfile.yml
- tsconfig.json
- tsup.config.ts
- vitest.config.ts
Discussion (0)
Ask about usage, or say what you built with itSign in to join the discussion.
No comments yet. Be the first to say what this is good for.
More connectors

Universal provider proxy for OpenAI Codex & Claude Code โ use any LLM (Claude, Gemini, Grok, DeepSeek, Ollamaโฆ) with Codex CLI, App, SDK, and Claude Code
Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300ยตs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.
Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.
Stop your AI from making things up โ it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.
20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | ่ฝป้็บง่ทจๅนณๅฐๆฐๆฎๅบ็ฎก็ๅทฅๅ ท๏ผๆฏๆ MySQLใPostgreSQLใSQLiteใRedisใMongoDBใ่พพๆขฆ็ญ 90+ ๆฐๆฎๅบ๏ผๆไพๆก้ข็ซฏใDockerใCLIใๅ ็ฝฎ AI ๅฉๆๅ MCP Serverใ