OpenClaw MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
OpenClaw MCP Server
将 OpenClaw Gateway WebSocket API 封装为 MCP (Model Context Protocol) 服务,让任何支持 MCP 的宿主(Claude Desktop、Cursor、VS Code Copilot Chat 等)可以直接与 OpenClaw 交互。
功能特性
连接本地或远程 OpenClaw Gateway(支持
ws://和wss://)启动时自动握手连接,断线后自动重连
12 个内置 MCP 工具,覆盖对话、渠道、配置、模型管理
单文件 CJS bundle,无需本地
node_modules
Related MCP server: websocat-mcp
前提条件
Node.js 22+
OpenClaw Gateway 已在运行(本地默认
ws://127.0.0.1:18789,或远程wss://)
环境变量
通过 MCP 宿主配置的 env 字段注入:
变量 | 默认值 | 说明 |
|
| Gateway WebSocket 地址 |
| — | 认证 token(对应 |
| — | 认证密码(对应 |
|
| 默认会话 key( |
|
| 工具描述中显示的 AI 角色名称 |
查看本地 token
openclaw config get gateway.auth.token
快速开始(npx)
无需克隆仓库,直接通过 npx 使用,首次运行自动安装,后续使用缓存。
在 Claude Desktop 中配置
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS):
{
"mcpServers": {
"openclaw": {
"command": "npx",
"args": ["-y", "openclaw-mcp-server"],
"env": {
"OPENCLAW_URL": "ws://127.0.0.1:18789",
"OPENCLAW_TOKEN": "your-gateway-token",
"OPENCLAW_SESSION": "agent:xiaozhi",
"OPENCLAW_AGENT_NAME": "小龙虾"
}
}
}
}在 Cursor 中配置
编辑 ~/.cursor/mcp.json(或通过 Cursor Settings → MCP):
{
"mcpServers": {
"openclaw": {
"command": "npx",
"args": ["-y", "openclaw-mcp-server"],
"env": {
"OPENCLAW_TOKEN": "your-token"
}
}
}
}在 VS Code Copilot Chat 中配置
编辑 .vscode/mcp.json(工作区级)或用户 settings.json(mcp.servers):
{
"servers": {
"openclaw": {
"type": "stdio",
"command": "npx",
"args": ["-y", "openclaw-mcp-server"],
"env": {
"OPENCLAW_TOKEN": "your-token"
}
}
}
}
-y表示首次运行时自动安装,后续调用直接使用缓存,无额外开销。
固定版本(推荐生产使用)
"args": ["-y", "openclaw-mcp-server@1.0.0"]远程 Gateway(wss://)
若 Gateway 在远程机器上,直接传入 wss:// 地址即可:
"env": {
"OPENCLAW_URL": "wss://your-gateway.example.com",
"OPENCLAW_TOKEN": "your-token"
}或者使用 SSH 隧道将远程端口转发到本地:
ssh -N -L 18789:127.0.0.1:18789 user@gateway-host然后保持 OPENCLAW_URL=ws://127.0.0.1:18789。
可用工具
工具 | 说明 |
| 向 AI agent 发送消息,等待完整回复(内部自动处理流式) |
| 获取会话历史记录 |
| 中止当前正在运行的 AI 回复 |
| 通过指定渠道(Telegram / Discord / Slack 等)直接发送消息 |
| 检查所有消息渠道连接状态 |
| 获取 Gateway 健康状态 |
| 列出所有会话 |
| 清空会话历史(需要 |
| 列出所有已配置的 AI agents |
| 读取 Gateway 配置项 |
| 写入 Gateway 配置项 |
| 列出可用 AI 模型及当前激活的模型 |
本地构建使用(node)
如需从源码构建或二次开发,可本地安装后使用 node 直接运行。
安装
cd mcp-server
npm install
npm run build构建产物为 dist/index.cjs(单文件,已打包全部依赖)。
在 Claude Desktop 中配置
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS):
{
"mcpServers": {
"openclaw": {
"command": "node",
"args": ["/path/to/openclaw/mcp-server/dist/index.cjs"],
"env": {
"OPENCLAW_URL": "ws://127.0.0.1:18789",
"OPENCLAW_TOKEN": "your-gateway-token"
}
}
}
}在 Cursor 中配置
编辑 ~/.cursor/mcp.json(或通过 Cursor Settings → MCP):
{
"mcpServers": {
"openclaw": {
"command": "node",
"args": ["/path/to/openclaw/mcp-server/dist/index.cjs"],
"env": {
"OPENCLAW_TOKEN": "your-token"
}
}
}
}在 VS Code Copilot Chat 中配置
编辑 .vscode/mcp.json(工作区级)或用户 settings.json(mcp.servers):
{
"servers": {
"openclaw": {
"type": "stdio",
"command": "node",
"args": ["/path/to/openclaw/mcp-server/dist/index.cjs"],
"env": {
"OPENCLAW_TOKEN": "your-token"
}
}
}
}开发模式
npm run dev # 直接运行 TypeScript,无需编译
npm run build # 编译为 dist/index.cjs常见问题
连接失败 / 认证错误
确认 OpenClaw Gateway 正在运行:
openclaw channels status确认 token 正确:
openclaw config get gateway.auth.token若提示
missing scope,检查 token 是否具有operator.admin权限
MCP 宿主显示 [warning] [server stderr]
正常现象。MCP 协议规定 stdout 专用于 JSON-RPC,所有状态日志必须写 stderr,宿主会统一标记为 [server stderr]。
发布到 npm
本包已完整配置 bin 入口与单文件 CJS bundle,维护者可按以下步骤发布新版本:
# 首次登录
npm login
# 构建并发布(已在 prepublishOnly 中自动执行 build)
npm run release
# 等价于:npm publish --access publicLicense
MIT © OpenClaw Contributors
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP federation gateway: route, govern and observe agent tools across clouds and MCP servers.
Open-source MCP gateway with per-agent tool permissions, call approvals and tool-change review.
MCP gateway and cloud hosting for MCP servers, agents and apps like RAG, managed from your agent.
Skills, agents and memory in the cloud, plus a gateway to your other MCP servers.
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server that exposes OpenClaw Gateway tools to Claude Code and other MCP clients, enabling messaging, session management, scheduling, node control, web search, memory search, and TTS.2115MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for WebSocket operations, enabling connect, send, receive, and manage WebSocket connections and servers.MIT
- FlicenseNot gradedqualityDmaintenanceExposes app-registered tools as an MCP server for OpenClaw, forwarding actual tool execution back to the app over a WebSocket bridge.-
- AlicenseNot gradedqualityAmaintenanceEnables MCP clients such as Claude.ai and Claude Desktop to securely connect to self-hosted OpenClaw gateways, chat with assistants, check gateway health, list configured instances, and manage long-running tasks across multiple instances.614 npmMIT