paybondpaybond
Sign in

Recipe · MCP hosts

Spend controls for MCP hosts

Authorize agent spend through paybond-mcp-server — spend verify before paid tools, evidence submit after, for Claude Desktop, Codex, and stdio MCP hosts.

  1. 1Wire
  2. 2Authorize
  3. 3Smoke

You'll build

MCP host tools that authorize spend before paid tool calls

MCP hosts (Claude Desktop, Codex, Cursor, custom orchestrators) launch Paybond as a stdio MCP server. The server exposes a tenant-bound tool surface: verify capabilities, authorize spend through Paybond before side-effecting work, and submit evidence — same tenant boundary as the SDKs.

Adapter reference: /docs/kit/mcp-server.

  • stdio MCP server

    paybond-mcp-server exposes tenant-bound tools for Claude Desktop, Codex, Cursor, and custom hosts.

  • Authorize before paid tools

    paybond_authorize_agent_spend verifies Harbor spend before side-effecting host tools.

  • Evidence submit

    paybond_submit_spend_evidence binds completion digests — strict policy by default.

  • Same tenant boundary

    MCP tools use the same authenticated session as Kit SDKs — never trust host-supplied tenant ids alone.

Why Paybond (not just MCP host approvals)?

MCP host approvals do not enforce a spend limit, a per-operation permission check (capability token), or a signed completion receipt tied to a spend agreement (intent).

MCP host alone versus Paybond Harbor spend controls
  • Model / input guardrails

    MCP host alone
    Yes — SDK or host checks and approvals
    With Paybond
    Yes — plus Harbor authorize at the tool boundary
  • Spend boundary

    MCP host alone
    No per-tool Harbor budget or capability token
    With Paybond
    Per-call and intent budgets enforced before invoke
  • Signed evidence

    MCP host alone
    SDK traces / logs only
    With Paybond
    Signed completion digests bound to the intent
  • Intent binding

    MCP host alone
    No Harbor intent or settlement receipt
    With Paybond
    Capability token + intentId from authenticated bind
  • Paid tool deny / HITL

    MCP host alone
    Host or SDK approvals only
    With Paybond
    spend verify, deny, or HITL hold before side effects

How it works

MCP hosts call Paybond tools over stdio: create/fund intent, authorize spend, run vendor work, then submit evidence.

MCP host flow

  1. Host launches paybond-mcp-server

    stdio MCP with PAYBOND_API_KEY from login

  2. Authorize spend

    paybond_authorize_agent_spend before paid tools

    • intent_id + capability_token
    • Verify operation + amount
    • Deny or HITL hold
  3. Vendor tool runs

    Host executes the side-effecting work

  4. Submit evidence

    paybond_submit_spend_evidence with completion payload

MCP hosts call Paybond tools over stdio: create/fund intent, authorize spend, run vendor work, then submit evidence.

3-minute quickstart

Smoke the Harbor MCP contract — no MCP host required for this check:

Terminal
Terminal commandSwipe to inspect long lines
paybond login
paybond agent sandbox smoke \
  --operation paid-tool \
  --requested-spend-cents 100 \
  --evidence-preset cost_and_completion \
  --result-body '{"status":"ok","cost_cents":100}' \
  --format table

For MCP-native sandbox tools inside a running host, call paybond_bootstrap_sandbox_guardrail before the paid tool and paybond_submit_sandbox_guardrail_evidence after.

When the smoke succeeds you should see:

  • ✓ Spend approved
  • ✓ Tool completed
  • ✓ Evidence verified (cost_and_completion)

What success looks like

Example status after a Paybond-guarded MCP hosts tool call: approved spend, requested amount, and verified cost_and_completion evidence.

What success looks like

Authorized tool call · illustrative

Sandbox path
Operation
paid-tool
Status
Approved
Requested
$1.00
Evidence
Verified
Preset
cost_and_completion

Launch the server

terminal

TS
Terminal commandSwipe to inspect long lines
npx -y -p @paybond/kit paybond-mcp-server

Required: PAYBOND_API_KEY (from paybond login.env.local). For MCP hosts in production, create a restricted MCP key (paybond_rk_*) in Console under Machine access → API keys (or paybond keys create --kind restricted --preset mcp-readonly) so the credential itself limits which tools the host can see. Interactive hosts (Cursor/Claude/VS Code) can instead complete MCP OAuth consent and present a short-lived paybond_oat_* bearer — manage sessions and the per-environment MCP toggle under Machine access → MCP access. Standard paybond_sk_* keys still work with optional PAYBOND_MCP_TOOL_POLICY for local development.

Optional policy hot-reload:

Terminal
Terminal commandSwipe to inspect long lines
export PAYBOND_POLICY_FILE="./paybond.policy.yaml"
export PAYBOND_POLICY_RELOAD="watch"

Inspect the scope catalog offline: paybond mcp scopes list.

Wire host config

Claude Desktop / Codex config

Add Paybond as a stdio MCP server so the host can authorize spend and submit evidence.

{
  "mcpServers": {
    "paybond": {
      "command": "npx",
      "args": ["-y", "-p", "@paybond/kit", "paybond-mcp-server"],
      "env": {
        "PAYBOND_ENV_FILE": ".env.local"
      }
    }
  }
}

Full coding-agent setup: /docs/kit/coding-agent-setup.

Production MCP flow

  1. paybond_create_spend_intent or paybond_fund_intentintent_id and capability_token
  2. paybond_authorize_agent_spend before the paid or side-effecting tool
  3. Execute vendor work
  4. paybond_submit_spend_evidence with completion payload

PAYBOND_MCP_EVIDENCE_POLICY defaults to strict — evidence submit tools refuse calls until validation succeeds for the preset and payload.

Scaffold a paid-tool guard

Terminal
Terminal commandSwipe to inspect long lines
npx -p @paybond/kit paybond-init \
  --preset paid-tool-guard \
  --framework provider-agnostic \
  --out paybond-paid-tool-guard.ts

For multi-tool agents in application code, graduate to agent middleware.

Production checklist

Production checklist for Paybond MCP host spend controls.

Production checklist

Works with

Works with

  • MCP
  • Anthropic
  • OpenAI
  • Agent-agnostic

Ready to test?

Developer reference: /docs/kit/mcp-server.