OpenClaw MCP Server

io.github.freema由 GitHub 账号 freema 发布v1.8.1更新于 Nov 7, 2026

MCP server bridging Claude.ai/Desktop with self-hosted OpenClaw via OAuth 2.1.

发布方自己的服务:OpenClaw Direct

概览

AI 生成的概览

将 Claude 客户端连接到自托管的 OpenClaw AI 助手,让助手向 OpenClaw 代理发送消息并跟踪长时间运行的任务。

可以做什么
  • 向 OpenClaw 代理发送消息并获取回复,或异步排队并通过轮询、列出、取消来管理任务
  • 检查网关健康状态并列出已配置的 OpenClaw 实例
  • 按调用将请求路由到多个命名 OpenClaw 网关(如 prod、staging、dev)之一
  • 既可作为 Claude Desktop 的本地 stdio 进程运行,也可作为带 OAuth 2.1 的 HTTP 桥接服务供 Claude.ai 使用
适用场景
当你自托管 OpenClaw 助手,希望 Claude Desktop 或 Claude.ai 把工作委派给它时使用,包括通过异步任务处理长时间作业,或用一个连接器访问多个 OpenClaw 网关。
运行要求
需要 Node.js 20 或更高版本,或使用已发布的 Docker 镜像。需要一个可访问且已启用 HTTP chat-completions 端点的 OpenClaw 网关,以及 OPENCLAW_URL 和 OPENCLAW_GATEWAY_TOKEN bearer 令牌。HTTP 模式需要 MCP_CLIENT_ID 与 MCP_CLIENT_SECRET,置于反向代理后还需 MCP_ISSUER_URL 和 TRUST_PROXY。
安装前请注意
该桥接会把文本转交给 OpenClaw 代理,但无法判断这些文本会让代理做什么,因此对具备 shell 权限的代理进行提示注入是主要风险;请通过 OPENCLAW_AGENT_ID 指向专用的最小权限代理。它持有网关 bearer 令牌和 OAuth 客户端密钥。HTTP 模式在未启用认证时拒绝启动,关闭认证被明确标为危险。该桥接为单租户:持有客户端密钥者即可完全访问同一网关。

安装

在 SourceWeft 中

  1. 打开 控制台中的 OpenClaw MCP Server,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

OpenClaw MCP Server

[npm version] [CI] [License: MIT] [GHCR] [Website]

[图片]

🦞 Model Context Protocol (MCP) server for OpenClaw AI assistant integration.

Demo

[OpenClaw MCP in Claude.ai]

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.

bash
docker pull ghcr.io/freema/openclaw-mcp:latest

Create a docker-compose.yml:

yaml
services:  mcp-bridge:    image: ghcr.io/freema/openclaw-mcp:latest    container_name: openclaw-mcp    restart: unless-stopped    ports:      - "127.0.0.1:3000:3000"   # loopback only, reached through your reverse proxy    environment:      - OPENCLAW_URL=http://host.docker.internal:18789      - OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN}      - OPENCLAW_AGENT_ID=${OPENCLAW_AGENT_ID:-}      - OPENCLAW_MODEL=openclaw      - 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    cap_drop:      - ALL    security_opt:      - no-new-privileges

The port is published on 127.0.0.1 only: the bridge speaks plain HTTP and is meant to sit behind a TLS-terminating reverse proxy on the same host (see Deployment).

Generate secrets and start:

bash
export MCP_CLIENT_SECRET=$(openssl rand -hex 32)export OPENCLAW_GATEWAY_TOKEN=your-gateway-tokendocker 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 latest for production: ghcr.io/freema/openclaw-mcp:1.8.1

Use a least-privilege agent. Set OPENCLAW_AGENT_ID to a dedicated OpenClaw agent that only has the tools you want Claude to reach — not your main agent with shell access. See Security.

Local (Claude Desktop)

bash
npx openclaw-mcp

Add to your Claude Desktop config:

json
{  "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

bash
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 advertises http://localhost:3000 and clients fail to authenticate.
  • TRUST_PROXY=1 (or --trust-proxy 1) — otherwise express-rate-limit rejects the proxy's X-Forwarded-For header and /token crashes with ERR_ERL_UNEXPECTED_X_FORWARDED_FOR.

Recommended: Set MCP_REDIRECT_URIS=https://claude.ai/api/mcp/auth_callback,https://claude.com/api/mcp/auth_callback so authorization codes can only be delivered to Claude's callbacks. Note the exact /api/mcp/auth_callback path — matching is exact, and getting it wrong fails OAuth with Unregistered 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

ToolDescription
openclaw_chatSend messages to OpenClaw and get responses
openclaw_statusCheck OpenClaw gateway health
openclaw_instancesList all configured OpenClaw instances

Async Tools (for long-running operations)

ToolDescription
openclaw_chat_asyncQueue a message, get task_id immediately
openclaw_task_statusCheck task progress and get results
openclaw_task_listList your tasks with filtering
openclaw_task_cancelCancel a pending task

Tasks belong to whoever created them. In HTTP mode that is the authenticated OAuth client, so a client can poll its tasks from a new MCP session, and another client's task_id reads as "not found" even if it is known. Without an authenticated client (stdio) tasks are scoped to the connection.

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

bash
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 instanceopenclaw_chat message="Deploy status?" instance="staging"
# Check health of prodopenclaw_status instance="prod"
# List all configured instancesopenclaw_instances
# Async task targeting devopenclaw_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!

bash
# Generate secure client secretexport MCP_CLIENT_SECRET=$(openssl rand -hex 32)
# Run with auth enabledMCP_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:

bash
CORS_ORIGINS=https://claude.ai,https://your-app.com

See Configuration for all security options.

Give the bridge a least-privilege agent

The bridge passes text to an OpenClaw agent and cannot judge what that text makes the agent do. Anything Claude reads — a web page, an email, a document — can end up in an openclaw_chat call, so prompt injection into an agent that can run shell commands is the biggest real-world risk of this setup, and OAuth does not help against it. Do not point the bridge at your main agent: create a dedicated OpenClaw agent with only the tools it needs, sandboxed, and select it with OPENCLAW_AGENT_ID. Details in SECURITY.md and the Threat Model.

Upgrading to 1.8.1

A security and maintenance release; no configuration changes are required.

  • docker-compose.yml now publishes the port on 127.0.0.1 only. If you use the compose file from this repository and reach port 3000 directly from another machine (no reverse proxy on the same host), it stops being reachable after you update the file. Put a reverse proxy in front, or set BIND_ADDRESS=0.0.0.0 to restore the old binding. A compose file you maintain yourself, and docker run, are not affected. The compose file also drops all Linux capabilities (cap_drop: [ALL]).
  • MCP SDK 1.32.2 with its security fixes; the Docker image runs on Node.js 24. The npm package still supports Node.js ≥ 20.
  • Request bodies on /mcp and /messages are limited to 4 MiB and parsed only after authentication. Long non-ASCII messages that used to fail with 413 under the old implicit 100 kB limit now work; JSON-RPC batches are capped at 100 messages by the SDK.

See the changelog for the full list.

Upgrading to 1.8.0

OAuth is now mandatory for the HTTP transport. Before 1.8.0 HTTP mode ran without authentication unless AUTH_ENABLED=true was set, so a bare docker run of the image exposed every tool to anyone who could reach the port. Now:

  • Without MCP_CLIENT_ID and MCP_CLIENT_SECRET the server refuses to start. AUTH_ENABLED=true still works but is no longer needed.
  • AUTH_ENABLED=false / --no-auth refuses to start instead of silently disabling auth. If you really need an unauthenticated server (e.g. a proxy in front already authenticates every request), set MCP_DANGEROUSLY_DISABLE_AUTH=true (--dangerously-disable-auth).
  • stdio is unchanged.

Async tasks now belong to the OAuth client, not the MCP connection. A client that opens a new MCP session between tool calls can poll the tasks it created (#44). The bridge is single-tenant — whoever holds the client secret already has full access to the same OpenClaw gateway — so the OAuth client is the isolation boundary. Dynamically registered clients each get their own namespace. Without auth, tasks stay scoped to the connection.

New ALLOWED_HOSTS for a loopback bind behind a reverse proxy that preserves the public Host header (Tailscale Serve, nginx with proxy_set_header Host $host), which previously failed with 403 Invalid Host (#41). See configuration.

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_ORIGINS sent Access-Control-Allow-Origin: *. If a browser client depends on that, set the origins explicitly (CORS_ORIGINS=https://your-app.com), or CORS_ORIGINS=* to restore the old behaviour.
  • Async tasks are scoped to the connection that created them. A client that used to poll a task_id queued by a different connection will now get "not found". (1.8.0 relaxes this to the authenticated OAuth client.)

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

BeforeAfter
--transport sse--transport http (recommended)
Primary endpoint: GET /ssePrimary endpoint: POST/GET/DELETE /mcp
Health: "transport": "sse"Health: "transport": "streamable-http"

Migration steps

  1. CLI / Docker: Replace --transport sse with --transport http

    bash
    # Beforeopenclaw-mcp --transport sse --port 3000# Afteropenclaw-mcp --transport http --port 3000
  2. Claude.ai connector URL: No change needed — Claude.ai already uses /mcp (Streamable HTTP)

  3. Legacy clients: The /sse and /messages endpoints still work. A deprecation warning is logged on each SSE connection.

  4. Dockerfile ENTRYPOINT: Updated automatically if using the official Docker image

Note: --transport sse will 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:
    json5
    // openclaw.json{ "gateway": { "http": { "endpoints": { "chatCompletions": { "enabled": true } } } } }

License

MIT

Author

Created by Tomáš Grasl

Related Projects

来源:README.md,提交 95eba1b

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

3
  1. v1.8.1最新Nov 7, 2026
  2. v1.8.0Oct 25, 2026
  3. v1.7.0Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Openclaw 集成