MCP budget and risk authority for Cycles — runtime governance for Claude, Cursor, and Windsurf
- ✓Open-source license (Apache-2.0)
- ✓Actively maintained (<30d)
- ✓Clear description
- ✓Topics declared
claude mcp add cycles -- npx -y @runcycles/mcp-server{
"mcpServers": {
"cycles": {
"command": "npx",
"args": ["-y", "@runcycles/mcp-server"],
"env": {
"CYCLES_BASE_URL": "<cycles_base_url>",
"CYCLES_API_KEY": "<cycles_api_key>",
"MCP_HTTP_AUTH_TOKEN": "<mcp_http_auth_token>"
}
}
}
}CYCLES_BASE_URLCYCLES_API_KEYMCP_HTTP_AUTH_TOKENMCP Servers overview
[](https://www.npmjs.com/package/@runcycles/mcp-server)
[](https://www.npmjs.com/package/@runcycles/mcp-server)
[](https://github.com/runcycles/cycles-mcp-server/actions)
[](LICENSE)
[](https://modelcontextprotocol.io)
[](https://github.com/runcycles/cycles-mcp-server/actions)
[](https://safeskill.dev/scan/runcycles-cycles-mcp-server)
# Cycles MCP Server — AI agent runtime control over Model Context Protocol
**MCP server that gives any MCP-compatible AI agent (Claude Code, Cursor, Windsurf, custom agents) runtime budget, action, and audit authority — enforce LLM cost limits, tool call caps, action permissions, and audit trails before execution, with zero agent code changes.** Connect via MCP and use the budget tools (`cycles_reserve`, `cycles_commit`, `cycles_release`, `cycles_decide`) directly from the agent's tool-calling loop. Powered by [Cycles](https://runcycles.io). See [Security Model & Enforcement Boundary](#security-model--enforcement-boundary) for what is enforced server-side versus cooperatively in the agent loop.
## Why use this?
Autonomous AI agents (Claude, GPT, custom agents) call LLMs, invoke tools, and hit external APIs — but have no built-in way to cap how much they spend. A single agent loop can burn through hundreds of dollars before anyone notices. Multiply that across tenants and teams, and cost control becomes a real problem.
This MCP server gives any MCP-compatible agent a **runtime budget authority**: a set of tools to check, reserve, spend, and release budget before and after every costly operation. The agent asks "can I afford this?" before acting, and reports what it actually used afterward.
**Who needs this:**
- **Platform teams** building multi-tenant agent systems that need per-customer or per-workspace spend limits
- **Agent developers** who want agents to self-regulate — degrade to cheaper models when budget is low, skip optional tool calls, reduce retries
- **Enterprises** deploying AI agents that need guardrails so a runaway agent can't blow through a budget
**Why MCP specifically:**
MCP is the standard protocol that AI hosts (Claude Desktop, Claude Code, Cursor, Windsurf, custom agents) use to discover and call tools. By exposing Cycles as an MCP server, any MCP-compatible agent gets budget awareness as a plug-in — just add the server to your config. No SDK integration in the agent's own code required.
The server also ships built-in [prompts](#prompts) so an AI assistant can help you design your budget strategy, generate integration code, and diagnose budget overruns — not just enforce budgets at runtime.
## Use Cases
### Coding agent with a per-task dollar cap
You run a Claude Code agent that writes and iterates on code. Each task should cost no more than $5. The agent calls `cycles_reserve` before every LLM call with a cost estimate in `USD_MICROCENTS`. If the reservation comes back `DENY`, the agent stops and reports "budget exhausted" instead of silently racking up charges. When the call completes, `cycles_commit` records the actual token cost so the running total stays accurate.
### Multi-tenant SaaS with per-customer budgets
Your platform lets customers deploy AI assistants. Each customer has a monthly budget. The agent calls `cycles_check_balance` at the start of a conversation to see what's left, then `cycles_reserve` before each tool invocation (web search, code execution, API calls). If customer Acme is near their limit, the decision comes back `ALLOW_WITH_CAPS` — the agent automatically drops to a cheaper model and skips optional tools. Customer budgets are isolated; one customer's heavy usage never affects another.
### Multi-agent pipeline with shared budget
You have an orchestrator that fans out to specialist agents — a researcher, a coder, and a reviewer. All three draw from the same workflow budget. Each agent calls `cycles_reserve` before its work; the Cycles server tracks concurrent reservations so the total never exceeds the workflow limit. If the researcher burns through 80% of the budget, the coder's next reservation gets `DENY` and the orchestrator can decide to skip the review step instead of going over budget.
### Long-running data pipeline with heartbeats
An agent processes a large dataset in chunks, each chunk taking several minutes. It calls `cycles_reserve` with a 5-minute TTL before each chunk, then `cycles_extend` every 60 seconds to keep the reservation alive while processing. If the agent crashes, the reservation expires automatically and the locked budget returns to the pool — no manual cleanup needed.
### Fire-and-forget usage metering
You have an existing system that already makes LLM calls and you just want to track spend, not gate it. After each call completes, the agent fires `cycles_create_event` with the actual cost. No reservation needed — the event is applied atomically to all budget scopes (tenant, workspace, app). You get a real-time spend dashboard without changing your existing call flow.
## Installation
```bash
npm install @runcycles/mcp-server
```
## Setup
### Claude Desktop
**One-click (recommended):** download `cycles-mcp-server-<version>.mcpb` from the [latest release](https://github.com/runcycles/cycles-mcp-server/releases/latest) and open it with Claude Desktop (double-click, or Settings → Extensions → drag it in). Claude Desktop shows a config screen for your Cycles server URL and API key — or enable mock mode to explore the tools without a server (no enforcement).
**Manual (JSON config):** add to your `claude_desktop_config.json`:
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
```json
{
"mcpServers": {
"cycles": {
"command": "npx",
"args": ["-y", "@runcycles/mcp-server"],
"env": {
"CYCLES_BASE_URL": "http://localhost:7878",
"CYCLES_API_KEY": "your-api-key-here"
}
}
}
}
```
For local development without an API key, use mock mode:
```json
{
"mcpServers": {
"cycles": {
"command": "npx",
"args": ["-y", "@runcycles/mcp-server"],
"env": {
"CYCLES_MOCK": "true"
}
}
}
}
```
### Claude Code
```bash
claude mcp add cycles -- npx -y @runcycles/mcp-server
```
Set your environment variables:
```bash
export CYCLES_BASE_URL=http://localhost:7878
export CYCLES_API_KEY=your-api-key-here
```
### Cursor / Windsurf / Other MCP Hosts
Use stdio transport with:
```
command: npx
args: ["-y", "@runcycles/mcp-server"]
env: { CYCLES_API_KEY: "your-key", CYCLES_BASE_URL: "http://localhost:7878" }
```
## Configuration
```bash
export CYCLES_API_KEY=your-api-key-here # required (unless CYCLES_MOCK=true)
export CYCLES_BASE_URL=http://localhost:7878 # required — your Cycles server URL
export CYCLES_MOCK=false # true disables live enforcement and returns synthetic responses
export CYCLES_ALLOW_MOCK_IN_PRODUCTION=false # must be true to use mock mode with NODE_ENV=production
export PORT=3000 # optional, for HTTP transport
export HOST=127.0.0.1 # optional HTTP bind address; unset binds all interfaces
export MCP_HTTP_AUTH_TOKEN=replace-me # optional bearer token required on /mcp when set
```
Mock mode prints a prominent warning on every startup, and generated mock reservation/event IDs begin with `mock_`. The server refuses to start with `CYCLES_MOCK=true` and `NODE_ENV=production` unless `CYCLES_ALLOW_MOCK_IN_PRODUCTION=true` is also set.
For HTTP transport, set `MCP_HTTP_AUTH_TOKEN` to require `Authorization: Bearer <token>` on every `/mcp` request. Blank or whitespace-only configured tokens are rejected at startup. `/health` remains public. If no token is configured while HTTP binds to a non-loopback address, the server prints a prominent warning.
**Need an API key?** API keys are created via the Cycles Admin Server (port 7979). See the [deployment guide](https://runcycles.io/quickstart/deploying-the-full-cycles-stack#step-3-create-an-api-key) to create one, or run:
```bash
curl -s -X POST http://localhost:7979/v1/admin/api-keys \
-H "Content-Type: application/json" \
-H "X-Admin-API-Key: admin-bootstrap-key" \
-d '{"tenant_id":"acme-corp","name":"dev-key","permissions":["reservations:create","reservations:commit","reservations:release","reservations:extend","reservations:list","balances:read","decide","events:create"]}' | jq -r '.key_secret'
```
The key (e.g. `cyc_live_abc123...`) is shown only once — save it immediately. For key rotation and lifecycle details, see [API Key Management](https://runcycles.io/how-to/api-key-management-in-cycles).
> **Individual vs. team use:** For individual use or evaluation, set `CYCLES_MOCK=true` — no server or API key required. If you're deploying agents for multiple users or workspaces, see the [multi-tenant setup guide](https://runcycles.io/how-to/understanding-tenants-scopes-and-budgets-in-cycles).
## Running
```bash
# stdio transport (default — for Claude Desktop / Claude Code)
npx @runcycles/mcp-server
# HTTP transport (Streamable HTTP on port 3000)
npx @runcycles/mcp-server --transport http
```
## Tools
| Tool | Protocol Endpoint | Description |
|------|-------------------|-------------|
| `cycles_reserve` | `POST /v1/reservations` | Reserve budget before a costly operation |
| `cycles_commit` | `POST /v1/reservations/{id}/commit` | Commit actual usage after operation completes |
| `cycles_releasWhat people ask about cycles-mcp-server
What is runcycles/cycles-mcp-server?
+
runcycles/cycles-mcp-server is mcp servers for the Claude AI ecosystem. MCP budget and risk authority for Cycles — runtime governance for Claude, Cursor, and Windsurf It has 0 GitHub stars and was last updated today.
How do I install cycles-mcp-server?
+
You can install cycles-mcp-server by cloning the repository (https://github.com/runcycles/cycles-mcp-server) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is runcycles/cycles-mcp-server safe to use?
+
Our security agent has analyzed runcycles/cycles-mcp-server and assigned a Trust Score of 87/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.
Who maintains runcycles/cycles-mcp-server?
+
runcycles/cycles-mcp-server is maintained by runcycles. The last recorded GitHub activity is from today, with 1 open issues.
Are there alternatives to cycles-mcp-server?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy cycles-mcp-server to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/runcycles-cycles-mcp-server)<a href="https://claudewave.com/repo/runcycles-cycles-mcp-server"><img src="https://claudewave.com/api/badge/runcycles-cycles-mcp-server" alt="Featured on ClaudeWave: runcycles/cycles-mcp-server" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
The fastest path to AI-powered full stack observability, even for lean teams.
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface