MCP Server
Expose your ClawButler instance as an MCP (Model Context Protocol) server so AI assistants like Claude, Cursor, and Windsurf can manage your agents directly.
Current status#
How it works#
The MCP Server is a thin protocol bridge between your AI assistant and the ClawButler API. It translates natural language intent into structured API calls, so you can manage your agent fleet from any MCP-compatible client.
┌──────────────────┐ stdio / HTTP ┌─────────────────┐ REST API ┌──────────────────┐
│ AI Assistant │ ◄──────────────────► │ MCP Server │ ◄─────────────► │ ClawButler API │
│ (Claude, etc.) │ MCP Protocol │ (clawbutler- │ Bearer Token │ (FastAPI) │
│ │ │ mcp) │ │ │
└──────────────────┘ └─────────────────┘ └──────────────────┘Setup#
The MCP server is a standalone Python package that connects to your ClawButler API. Install it and configure your AI assistant to use it.
# Install from PyPI
pip install clawbutler-mcp
# Or run directly with uvx (zero install)
uvx clawbutler-mcp
# Set environment variables
# Prefer an org-bound service token for automation
export CLAWBUTLER_API_URL=https://your-instance.clawbutler.cc
export CLAWBUTLER_TOKEN=cb_srv_your_service_tokenIDE Configuration#
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"clawbutler": {
"command": "uvx",
"args": ["clawbutler-mcp"],
"env": {
"CLAWBUTLER_API_URL": "https://your-instance.clawbutler.cc",
"CLAWBUTLER_TOKEN": "your-token"
}
}
}
}Claude Code
Add to your project's .mcp.json:
{
"mcpServers": {
"clawbutler": {
"command": "uvx",
"args": ["clawbutler-mcp"],
"env": {
"CLAWBUTLER_API_URL": "https://your-instance.clawbutler.cc",
"CLAWBUTLER_TOKEN": "your-token"
}
}
}
}Cursor
Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):
{
"mcpServers": {
"clawbutler": {
"command": "uvx",
"args": ["clawbutler-mcp"],
"env": {
"CLAWBUTLER_API_URL": "https://your-instance.clawbutler.cc",
"CLAWBUTLER_TOKEN": "your-token"
}
}
}
}Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"clawbutler": {
"command": "uvx",
"args": ["clawbutler-mcp"],
"env": {
"CLAWBUTLER_API_URL": "https://your-instance.clawbutler.cc",
"CLAWBUTLER_TOKEN": "your-token"
}
}
}
}Streamable HTTP (remote deployment)
For containerized or remote deployments, use HTTP transport:
clawbutler-mcp --transport http --port 8080Available Tools#
Tool coverage spans the governance core. Click any tool to see its parameters.
Agents (7 tools)
list_agents, get_agent, get_agent_governance_view, enable_agent, disable_agent, set_agent_lifecycle, get_agent_config
Agent operations plus lifecycle transitions, governance summaries, and configuration inspection.
Cost & Budgets (4 tools)
get_cost_summary, get_cost_by_agent, get_cost_trend, list_budgets
Cost tracking with date ranges, per-agent breakdown, trend analysis, and budget monitoring.
Config Safety (5 tools)
list_config_snapshots, take_config_snapshot, diff_config_snapshots, preview_rollback, execute_rollback
Config versioning — browse snapshots, create manual save points, semantic diff, dry-run rollback, and execute rollback.
Audit & Activity (3 tools)
search_audit_events, get_audit_event, get_recent_activity
Audit trail with flexible filters and recent activity stream for investigation.
Connectors (4 tools)
list_connectors, get_connector_detail, test_connector, diagnose_connector
Gateway connector management — list, inspect, test connectivity, and run diagnostics.
Intelligence (4 tools)
get_root_cause_analysis, get_reliability_scores, get_agent_reliability, get_value_comparison
Root-cause analysis, reliability scoring, and value comparison.
Operations (6 tools)
get_killswitch_status, activate_killswitch, deactivate_killswitch, check_health, get_trust_status, get_dashboard
Kill switch, health checks, trust status, and dashboard KPI summary.
Runbooks (4 tools)
list_runbooks, get_runbook, execute_runbook, get_runbook_run
Runbook automation — browse, execute with inputs, and track one run timeline.
Governance (4 tools)
preview_policy_decision, get_runtime_host_card, preview_task_grant, record_governance_evidence
Preview policy and task-grant decisions, reuse stable RuntimeHostCard data, and record governance evidence without opening broader write surfaces.
Runtime Hosts (9 tools)
list_runtime_hosts, get_runtime_host_detail, get_runtime_host_governance_view, discover_runtime_host, batch_add_runtime_host_instances, sync_runtime_host_sessions, get_runtime_host_managed_state, list_runtime_host_managed_sessions, list_runtime_host_managed_permissions
Pair machines, discover Hermes / Claude Code / Codex / OpenClaw instances, preview governance, batch-add connectors, sync attach-mode sessions, and inspect managed runtime state / sessions / pending permissions.
Tool Reference#
Parameter reference for the current MCP surface. Click a tool to expand its parameters. Parameters marked with * are required.
Agents
Cost & Budgets
Config Safety
Audit & Activity
Connectors
Intelligence
Operations
Runbooks
Governance
Runtime Hosts
Output Examples#
Tools return formatted Markdown strings. Here are examples of what your AI assistant will receive:
list_agents"List all my agents"- **coordinator** (id: aaa-bbb-…) [on] health=healthy platform=openclaw
- **researcher** (id: fff-ggg-…) [off] health=error platform=openclaw
- **writer** (id: ccc-ddd-…) [on] health=warning platform=codexget_cost_summary"What's my cost for the last week?"**Cost Summary** (2026-03-10 → 2026-03-17)
- Total cost: $42.5678
- Input tokens: 1,234,567
- Output tokens: 654,321
- Records: 150diff_config_snapshots"Compare config version 3 and 4 for agent coordinator"**Config Diff** v3 → v4
Summary: Model changed
- [modified] `model.primary`: claude-sonnet-4-5 → claude-sonnet-4-6
- [added] `tools.web_search`: — → enabled
- [removed] `skills.deprecated_skill`: active → —check_health"Run a health check"**Health Check**
- Status: ready
- Version: 0.1.0
- Dependencies:
- postgres: ok
- valkey: ok
- Worker: running (mode=embedded)get_dashboard"Show me the dashboard"**Dashboard Summary**
- Agents: 12 online / 14 total
- Today's cost: $8.4321
- Events today: 67
- Pending approvals: 2
- Unread notifications: 5MCP Resources#
Resources provide read-only snapshots that AI assistants can use as context before calling tools.
clawbutler://dashboardDashboard summary — agent count, today's cost, events, pending approvals.
clawbutler://agentsCompact agent list with ID, name, status, and platform.
clawbutler://cost/todayToday's cost snapshot.
clawbutler://healthSystem readiness and dependency health.
Example Workflows#
Morning ops check
Ask your AI assistant to give you a morning briefing on your agent fleet.
"Check my ClawButler dashboard — how many agents are online,
what's today's cost, and any pending approvals?"Cost investigation
Drill into a cost spike without leaving your editor.
"Show me cost by agent for the last 7 days.
Which agent had the highest spend?"Emergency response
AI-assisted incident response with kill switch and audit trail.
"Agent coordinator is behaving unexpectedly.
Check its health, then activate the kill switch with reason
'unexpected behavior — investigating'."Config rollback
Review and roll back a bad config change.
"List the last 5 config snapshots for agent coordinator.
Diff version 3 vs 4, then preview a rollback to version 3."Audit investigation
Search audit events to trace who changed what and when.
"Search audit events for risk_level=high in the last 3 days.
Show me the full details of the most recent one."Connector diagnosis
Diagnose a connectivity issue with your gateway.
"List my connectors. The OpenClaw gateway seems slow —
run a diagnosis on it and tell me what's wrong."Runtime host discovery and managed inspection
Discover Hermes / Claude Code / Codex / OpenClaw instances on a paired machine, add only the ones you want governed, project attach-mode sessions into ClawButler, then inspect managed session summaries and pending permissions.
"List my runtime hosts. Discover the paired MacBook,
add the Codex and Claude Code instances as connectors,
then sync the latest attach-mode sessions for investigation,
show me the managed sessions on the Codex instance,
and list any pending managed permissions."Coverage Comparison#
MCP supports
- - Agent CRUD and toggle
- - Cost summary, by-agent, trends, budgets
- - Config snapshots, manual save points, semantic diff, rollback
- - Audit event search and activity stream
- - Connector listing, test, diagnosis
- - Intelligence analytics (root cause, reliability, value)
- - Kill switch (activate / deactivate)
- - Health check and trust status
- - Dashboard KPIs
- - Runbook execution and tracking
- - Policy decision preview, RuntimeHostCard lookup, task-grant preview, and governance evidence recording
- - Runtime host list/detail/discover/batch-add/sync plus managed state/session/permission inspection for Hermes / Claude Code / Codex / OpenClaw
Not yet in MCP (V2)
- - User registration / org management / RBAC
- - Evidence list/detail workflow
- - Template gallery full lifecycle
- - Light reports surface and subscription management
- - Notification management
- - Provider-native approvals, cost attribution, timelines, and managed control for Hermes / Claude Code / Codex runtime hosts
- - Destructive operations (kill switch, rollback) are clearly marked in tool descriptions so AI assistants confirm before executing.
- - Authentication uses the same Bearer header as CLI and API. For automation, prefer org-bound service tokens with minimal scopes such as read, read_connectors, operate_governance, operate_approvals, and operate_runbooks.
- - Read-heavy design — most tools are read operations; write operations require explicit parameters.
- - MCP can preview task-grant rollout and record governance evidence, but it does not issue runtime-host task grants directly; actual grant issuance remains on the API/CLI execution path.
- - Runtime-host sync is still attach-mode projection, while managed state / session / permission coverage in MCP is intentionally read-only. This does not imply full provider-native governance parity for Hermes / Claude Code / Codex, and service-token write coverage remains intentionally limited.
Troubleshooting#
"Tool not found" or no tools appear in IDE
Ensure clawbutler-mcp is installed and the command path is correct. Run `uvx clawbutler-mcp --help` to verify. Check your IDE's MCP log for connection errors.
401 Unauthorized / authentication errors
Verify CLAWBUTLER_TOKEN is set correctly. For long-lived automation, create an org-bound service token via the API or `ap service-token create`; interactive user access tokens still work for short-lived use.
Connection refused / timeout
Check CLAWBUTLER_API_URL points to your running ClawButler instance. For self-hosted setups, ensure the API is accessible from the machine running the MCP server.
Tools work but return empty data
This usually means the API returned an empty data array — your instance may not have agents/costs/connectors configured yet. Try get_dashboard first to verify connectivity.
How to use with Docker / remote servers?
Use HTTP transport: `clawbutler-mcp --transport http --port 8080`. This starts a Streamable HTTP server that any MCP client can connect to over the network.
Security#
- - Never commit tokens to version control. Add `.mcp.json` to `.gitignore` if it contains credentials.
- - Use environment variables or a secrets manager for token storage — avoid hardcoding tokens in config files.
- - The MCP server inherits the permissions of the token it uses. Prefer org-bound service tokens with only the scopes your workflow needs.
- - For shared environments, prefer HTTP transport with network-level access control (VPN, firewall rules) rather than exposing the server publicly.