MCP Servers

Configure Model Context Protocol (MCP) servers that your agents can use as tools.

What are MCP servers?

MCP (Model Context Protocol) servers are external tool servers that expose capabilities to your agents via a standardized protocol. ElasticClaw can start MCP servers as subprocesses inside each agent sandbox and register their tools with the agent's gateway.

Supported sources:

  • npx — NPM packages (e.g. @modelcontextprotocol/server-github)
  • uvx — Python packages via uv
  • smithery — Smithery registry packages
  • docker — Docker images
  • sse — Server-Sent Events endpoints (remote)

Configure an MCP server

Configure MCP server definitions in the server settings UI under Settings → MCP Servers. Workspaces opt into the servers they need from elasticclaw-config.yaml.

yaml
mcp_servers:
  - name: github
    source: npx
    package: "@modelcontextprotocol/server-github"
    enabled: true
    config:
      repository: "elasticclaw/elasticclaw"
    secrets:
      GITHUB_TOKEN: github_mcp_token

  - name: postgres
    source: docker
    image: mcp/postgres
    enabled: true
    config:
      database_url: "postgresql://localhost/mydb"

  - name: remote-tools
    source: sse
    url: https://tools.example.com/sse
    enabled: true

Secrets resolution

The secrets map under each MCP server maps environment variable names to secret names configured for that MCP server in settings.

yaml
mcp_servers:
  - name: github
    secrets:
      GITHUB_TOKEN: github_mcp_token

Enabling in workspaces

Add mcps to your workspace'selasticclaw-config.yaml to enable specific MCP servers for agents created from that workspace:

yaml
# elasticclaw-config.yaml
mcps:
  - name: github
    config:
      repository: "my-org/my-repo"   # workspace-level override

Each agent will start the configured MCP servers as subprocesses and register their tools with the OpenClaw gateway.

API endpoints

GET /api/mcp — List MCP servers (redacted, no secret values)

PUT /api/mcp — Upsert an MCP server

DELETE /api/mcp?name=<name> — Remove an MCP server