Skip to main content

What is the Mandate MCP server?

The @mandate.md/mcp-server package is a Model Context Protocol server built on Cloudflare Workers. It exposes two tools: search (look up Mandate schemas and examples) and execute (call the Mandate API for validation, registration, and status checks). Any MCP-compatible client can connect to it via SSE transport. The server uses @cloudflare/agents v0.0.16 and extends McpAgent<Env>.

Tools

ToolDescription
searchLook up Mandate schemas, policy fields, and example payloads. Use this before calling execute to understand the correct request format. Query examples: "validate schema", "register schema", "policy fields".
executeCall the Mandate API. Actions: validate (check if a transaction is allowed), register (create a new agent), status (get intent status).

Deploy to Cloudflare Workers

Clone the package, install dependencies, set secrets, and deploy.
cd packages/mcp-server
bun install
bunx wrangler secret put MANDATE_RUNTIME_KEY
bunx wrangler deploy
The MANDATE_API_URL defaults to https://app.mandate.md in wrangler.toml. Override it if you run a self-hosted Mandate instance.

Local development

cd packages/mcp-server
bun install
bun run dev
This starts the MCP server on http://localhost:8787. The SSE endpoint is at /sse and the MCP endpoint is at /mcp.

Environment variables

VariableRequiredDefaultDescription
MANDATE_RUNTIME_KEYYes-Mandate runtime key. Set via wrangler secret put.
MANDATE_API_URLNohttps://app.mandate.mdMandate API base URL.

Client configuration

Claude Desktop

{
  "mcpServers": {
    "mandate": {
      "url": "https://your-worker.workers.dev/sse"
    }
  }
}

Codex CLI

[mcp.mandate]
transport = "sse"
url = "https://your-worker.workers.dev/sse"

Cursor / Windsurf

Add the SSE URL in your editor’s MCP settings. The server uses standard SSE transport, so any MCP-compatible editor works.

Testing with MCP Inspector

Use the MCP Inspector to test your deployed server interactively.
bunx @anthropic-ai/mcp-inspector
Enter your Worker URL (e.g., https://your-worker.workers.dev/sse) and test the search and execute tools directly.

Alternative: CLI MCP mode

If you do not need a Cloudflare Workers deployment, the Mandate CLI includes a built-in MCP server that runs locally via stdio transport.
npx @mandate.md/cli --mcp
This exposes the same tools (search, execute) over stdio. Use it for local development or when your MCP client supports stdio but not SSE.
The Workers MCP server does not store any state. Every execute call is a stateless API request to the Mandate backend. Your runtime key is stored as a Cloudflare secret and never exposed to clients.

Next Steps

CLI MCP Flag

Run Mandate MCP locally with the CLI’s —mcp flag.

Integrations Overview

Compare all Mandate integration options.

Validate Transactions

Understand the validate flow that the execute tool calls.