Get the FREE Ultimate OpenClaw Setup Guide →

openclaw

🦞 MCP server for OpenClaw - secure bridge between Claude.ai and your self-hosted OpenClaw assistant with OAuth2 authentication

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio freema-openclaw-mcp npx openclaw-mcp \
  --env OPENCLAW_URL="http://127.0.0.1:18789" \
  --env OPENCLAW_TIMEOUT_MS="300000" \
  --env OPENCLAW_GATEWAY_TOKEN="your-gateway-token"

How to use

OpenClaw MCP Server provides a bridge between the OpenClaw AI assistant and Claude-based interfaces via the MCP protocol. It exposes a set of tools that let Claude or Claude-like clients send chat messages to OpenClaw, check gateway health, and manage long-running tasks. The available tools include synchronous actions such as openclaw_chat (send a message and receive a response) and openclaw_status (verify gateway health). For longer-running operations, you can queue work with openclaw_chat_async, poll progress with openclaw_task_status, list tasks with openclaw_task_list, or cancel tasks with openclaw_task_cancel. Configure authentication, CORS, and issuer settings to ensure secure, OAuth-protected access when running behind a reverse proxy.

How to install

Prerequisites:

  • Node.js v20 or newer
  • npm (comes with Node.js) or npm/yarn for package management
  • Access token or gateway URL/secret as needed for your environment
  1. Install Node.js (v20+)

  2. Install or run the MCP server via npx

    • If you want to run directly from the npm package registry without a local install:
      • npm install -g openclaw-mcp
      • Then start with: openclaw-mcp
    • Or run via npx (as in the example):
      • npx openclaw-mcp
  3. Prepare configuration (example using the Local Claude Desktop setup):

    • Create a configuration entry for your MCP client, for example in Claude Desktop: { "mcpServers": { "openclaw": { "command": "npx", "args": ["openclaw-mcp"], "env": { "OPENCLAW_URL": "http://127.0.0.1:18789", "OPENCLAW_GATEWAY_TOKEN": "your-gateway-token", "OPENCLAW_TIMEOUT_MS": "300000" } } } }
  4. Run the server

    • If using the provided environment variables, start the server with the environment set as shown above.
    • For Docker-based setup, follow the Docker instructions in the README (pull image and run with docker-compose as shown).
  5. Optional: Secure the deployment

    • Enable authentication in production (AUTH_ENABLED=true) and set MCP_CLIENT_ID/CLIENT_SECRET.
    • Configure MCP_ISSUER_URL when serving behind a reverse proxy to ensure OAuth metadata advertises the public URL.
  6. Verify connectivity

    • Use openclaw_chat or openclaw_status to confirm the MCP server is reachable and responding as expected.

Additional notes

Tips and common considerations:

  • Always enable authentication in production (AUTH_ENABLED=true) and generate a secure MCP_CLIENT_SECRET.
  • When running behind reverse proxies, set MCP_ISSUER_URL (or use --issuer-url) to your public HTTPS URL to avoid OAuth metadata advertising http://localhost:3000.
  • Set CORS_ORIGINS to include the domains that will access the MCP server (e.g., https://claude.ai).
  • For local development, you can run npx openclaw-mcp directly, but for production consider the Docker path or a proper Node deployment.
  • The default port for the MCP bridge in examples is 3000; ensure that port is exposed in your environment and not blocked by a firewall.
  • If you use the Docker approach, pin a specific image tag in production instead of latest to avoid unexpected changes.

Related MCP Servers

Sponsor this space

Reach thousands of developers ↗