Back to Blog
MCPBudget EnforcementTutorial

MCP Budget Enforcement: Set Per-Tool Costs and Stop Runaway Agent Spend

Practical answer

MCP budget enforcement means pricing every tool call, giving each agent a spend allowance, checking budget before the MCP server executes, and returning a structured error when a tool would exceed the limit.

Per-tool costs, spending caps, and real-time enforcement for MCP servers

March 5, 2026 10 min read

MCP (Model Context Protocol) is becoming the standard way AI agents interact with tools. But MCP has no built-in concept of cost. A tools/call request to a cheap lookup function and a $2 code execution tool look identical at the protocol level. This guide shows how to add spending controls to any MCP server.

The Problem with Unmetered MCP

When you connect an AI agent to MCP servers, the agent can call any tool it has access to, as many times as it wants. There's no protocol-level mechanism for:

  • Assigning costs to different tool calls
  • Tracking cumulative spend per agent
  • Enforcing a budget ceiling
  • Attributing costs to teams or departments
  • Delegating budget from a parent agent to sub-agents

Most MCP gateways solve the connectivity problem — routing, auth, discovery. But connectivity without cost control is like an open highway with no toll booths. Traffic flows, but nobody's tracking who owes what.

Step 1: Define Per-Tool Costs

The first step is mapping tool calls to costs. SatGate's MCP proxy lets you define a cost profile with per-tool pricing:

# satgate-mcp.yaml: per-tool costs
tools:
  defaultCost: 1
  costs:
    web_search: 2
    code_execute: 10
    file_read: 1
    database_query: 5
    send_email: 3
    "premium_*": 20  # prefix wildcard

Wildcard matching (premium_*) lets you price tool families without listing every variant. Any tool not matched gets thedefaultCost.

Step 2: Mint Tokens with Budgets

Agents authenticate with capability tokens (macaroons) that carry their budget as a cryptographic caveat:

# Mint a token with a 500-credit budget in MCP Setup
# (cloud.satgate.io). There is no CLI flag for this.
#   agent        research-bot
#   budget       500 credits
#   tools        the ones it may call
#   expires      24h
#   cost center  engineering

The budget is embedded in the token itself. The gateway doesn't need a database lookup to know the ceiling — it reads the caveat. Spend tracking uses a lightweight ledger (Redis-backed by default).

Step 3: Agent Sees Its Own Budget

SatGate injects economic metadata into the MCP tools/list response, so agents can make cost-aware decisions:

// tools/list response (with SatGate metadata)
{
  "tools": [
    {
      "name": "web_search",
      "description": "Search the web [SatGate: 2 credits per call]",
      "x-satgate": {
        "cost_credits": 2,
        "budget_remaining": 487,
        "calls_affordable": 243
      }
    }
  ]
}

Smart agents can use this metadata to choose cheaper alternatives when budget is low, or batch operations to minimize calls.

Step 4: Enforce at the Gateway

When an agent makes a tools/call, the MCP proxy intercepts the JSON-RPC message, looks up the tool cost, checks the agent's remaining budget, and either:

Forwards the request if budget is sufficient (deducts the cost from the ledger)

Returns a budget error if the agent has exceeded its cap — with remaining balance and cost in the error payload

This happens at the proxy layer, before the request reaches your MCP server. Your tools don't need any changes.

Step 5: Delegation Trees

In multi-agent systems, a coordinator agent often delegates tasks to specialist agents. With macaroon-based delegation, the coordinator can mint sub-tokens from its own token:

# Coordinator has 500 credits. In the dashboard
# (Delegation & Budgets), hand out narrower tokens:
#   research-agent   100 credits   search tools
#   code-agent       200 credits   code tools

# Coordinator keeps 200 for itself
# Total across tree: still ≤ 500

The parent's budget is the ceiling. Sub-agents can never collectively exceed what was delegated. If you revoke the parent token, governed child requests are denied at policy check.

Step 6: Monitor and Attribute

Every tool call generates an event with full attribution:

  • Agent identity: which agent made the call
  • Tool name: which tool was invoked
  • Cost: credits charged
  • Budget remaining: after this call
  • Cost center: department/team tag
  • Delegation chain: full path from root to leaf agent

The SatGate dashboard aggregates this into a Shadow Report — showing spend by agent, by tool, by team, with trends over time. Start in Observe mode to see the data, then switch to Control when you're ready to enforce.

MCP Budget Enforcement FAQ

What is MCP budget enforcement?

MCP budget enforcement prices each MCP tool call, assigns an agent or workflow budget, checks remaining budget before the tool executes, and blocks calls that would exceed the limit.

How do you set per-tool MCP costs?

Set a default cost for ordinary MCP tools, then override expensive tools with explicit prices or wildcard rules. The gateway resolves the tool cost before each tools/call request and deducts it from the agent budget atomically.

Where should MCP budget checks happen?

Budget checks should happen before the request goes through, and before the MCP server executes the tool. Dashboards and alerts are useful for reporting, but they cannot stop runaway tool calls after an autonomous agent has already spent the money.

Can MCP budget enforcement hard-cap specific expensive tools?

Yes. MCP budget enforcement can assign higher prices, stricter daily caps, approval requirements, or deny rules to expensive tools such as code execution, web search, database queries, or deployment actions.

Quick Start

Run the open-source MCP proxy on your own machine:

# 1. Install the MCP proxy
go install github.com/satgate-io/satgate/cmd/satgate-mcp@latest

# 2. Configure (satgate-mcp.yaml)
upstreams:
  tools:
    transport: stdio
    command: ["npx", "-y", "your-mcp-server"]
budget:
  backend: memory
  limit: 100          # credits
tools:
  defaultCost: 1
  costs:
    expensive_tool: 10
enforcement:
  mode: hard

# 3. Run it from your MCP client config
#    "command": "satgate-mcp",
#    "args": ["--config", "/path/to/satgate-mcp.yaml"]

# The binary takes only --config and --version.
# For per-agent tokens with their own budgets, use
# MCP Setup on SatGate Cloud.

Try it live

See MCP budget enforcement in the interactive sandbox — no setup required.

Put a budget on your MCP tools

Connect Cursor, Claude Code, Claude Desktop or OpenClaw to SatGate, give the agent a credit budget, and set per-tool costs in the dashboard.