Skip to main content
Glama
Openterms-mcp

Openterms-mcp

by jstibal

Openterms

Open source cryptographic consent receipts + programmable guardrails + provider verification for AI agents.

Your agent proves what it agreed to. Your policy controls what it's allowed to do. The API provider can verify both.

License Tests

Live Demo · Quickstart · Self-Host · MCP Server · Contributing · Open Receipt Spec

What It Does Openterms sits between your AI agent and the actions it takes. Three layers:

  1. Receipts — Before your agent calls an API, it gets an Ed25519-signed receipt. Canonical JSON (RFC 8785), SHA-256 hash, real cryptography. Anyone can verify it using public keys — no API key needed, no trust in the server required.

  2. Policy Engine — Daily spending caps, action type whitelists, escalation thresholds. The policy engine evaluates before the receipt is signed. Denied actions never get a receipt.

  3. Provider Verification — API providers register their terms URL and verify agent consent before serving requests. One public GET call. Both sides of the transaction trust the proof.

Quickstart 60 seconds to your first receipt:

git clone https://github.com/jstibal/openterms.git cd openterms pip install flask pyjwt cryptography pyyaml bash quickstart.sh Or with Docker:

git clone https://github.com/jstibal/openterms.git cd openterms docker compose up --build

In another terminal:

bash quickstart.sh Receipt issuance is free — no wallet, no deposit, no payment required.

Self-Host Run your own Openterms instance:

Option 1: Direct

pip install flask pyjwt cryptography pyyaml python run.py

Server at http://localhost:5000

Option 2: Docker

docker compose up --build

Option 3: Point MCP server at your instance

export OPENTERMS_API_URL=http://localhost:5000 python openterms_mcp_server.py Everything runs locally. SQLite database, no external dependencies.

Hosted Service Don't want to self-host? Use the hosted instance at openterms.com — same open source code, managed for you.

MCP Server 10 tools for AI agents:

Tool What it does issue_receipt Signed receipt before any action, with provider verification headers verify_receipt Verify receipt cryptographic integrity (public) verify_receipt_by_hash Look up and verify by canonical hash (public) check_balance Workspace balance get_pricing Per-receipt pricing list_receipts Recent receipts get_policy Active guardrails — call on startup simulate_policy Pre-check: would this action be allowed? policy_decisions Audit trail of every allow/deny/escalate provider_activity Receipt stats for your API (provider auth) MCP Config { "mcpServers": { "openterms": { "command": "python3", "args": ["openterms_mcp_server.py"], "env": { "OPENTERMS_API_URL": "https://openterms.com", "OPENTERMS_API_KEY": "openterms_your_key_here" } } } }

How Provider Verification Works Agent Openterms API Provider | | | |-- issue_receipt ------->| | |<-- receipt + headers ---| | | |-- webhook notification -->| | | | |-- API call + headers ---|-------------------------->| | |<-- verify/{hash} ---------| | |-- receipt data ---------->| |<--------- response -----|---------------------------|

Agent issues receipt → gets X-Openterms-Receipt header Agent includes header in API call Provider calls GET /v1/receipts/verify/{hash} — public, no auth Valid → serve. Invalid → reject.

API Endpoints

Core Method Path Auth Description POST /v1/receipts Bearer Issue signed receipt POST /v1/receipts/verify None Verify receipt GET /v1/receipts/verify/{hash} None Verify by hash GET /v1/receipts Bearer List receipts GET /.well-known/jwks.json None Public signing keys Policy Engine Method Path Auth Description GET /v1/policy Bearer Active policy PUT /v1/policy Admin Create/update policy POST /v1/policy/simulate Bearer Test hypothetical action GET /v1/policy/decisions Bearer Decision audit trail Provider Verification Method Path Auth Description POST /v1/providers None Register as provider POST /v1/providers/verify Provider Verify domain GET /v1/provider/stats Provider Receipt stats GET /v1/provider/receipts Provider Recent receipts

Tests

make test

120 tests passing (80 core + 40 provider verification)

Architecture openterms/ ├── app.py # Flask API (1135 lines) ├── db.py # SQLite database (15 tables) ├── openterms_mcp_server.py # MCP server + CLI (10 tools) ├── core/ │ ├── canonical.py # RFC 8785 canonicalization │ └── signing.py # Ed25519 signing + JWKS ├── services/ │ ├── receipt_service.py # Receipt pipeline │ ├── ledger_service.py # Balance tracking │ └── policy_engine.py # Rule evaluation ├── tests/ │ ├── test_core.py # 80 tests │ └── test_mvp3.py # 40 tests ├── Dockerfile ├── docker-compose.yml ├── quickstart.sh └── .env.example

Roadmap

Phase Status What it does MVP1 ✅ Shipped Signed receipts — record what happened MVP2 ✅ Shipped Policy engine — enforce what's allowed MVP3 ✅ Shipped Provider verification — both sides trust the proof

ORS Spec 🔄 In progress Open Receipt Specification — portable format

Integrations 🔄 In progress LangChain, CrewAI one-line callbacks

MVP4 Planned Receipt chaining, agent certification

Contributing

See CONTRIBUTING.md. We especially welcome framework integrations, language SDKs, and feedback on the Open Receipt Specification.

License Apache 2.0 — see LICENSE.

Copyright 2026 Staticlabs Inc.

Available Tools

10 tools
check_balanceA

Check workspace USDC balance (minor units, 1 USDC = 1,000,000).

Inputs: no named parameters.

get_policyA

Get the active policy (guardrails) for this workspace. Returns the rules that govern what this agent is allowed to do. An agent SHOULD call this on startup to understand its constraints.

Inputs: no named parameters.

get_pricingA

Get current per-receipt pricing. Public — no API key needed.

Inputs: no named parameters.

issue_receiptA

Issue a cryptographically signed terms receipt BEFORE your agent takes an action. Returns an Ed25519-signed receipt proving consent to terms. If this returns POLICY_DENIED or POLICY_ESCALATION_REQUIRED, STOP and notify the user.

Inputs: agent_id (required), action_type (required), terms_url (required), terms_hash (required), +3 more.

list_receiptsC

List recent receipts for this workspace.

Inputs: limit, action_type.

policy_decisionsA

View recent policy evaluation decisions (allow/deny/escalate) for this workspace. Useful for auditing and understanding what the policy engine has been doing.

Inputs: limit, decision.

provider_activityA

View receipt activity against your terms URL (requires provider API key via OPENTERMS_PROVIDER_KEY). Shows stats, unique agents, and recent receipts for your API.

Inputs: limit.

simulate_policyA

Test whether a hypothetical action would be allowed by the current policy WITHOUT actually issuing a receipt. Use this to pre-check before acting.

Inputs: action_type (required), terms_url (required), action_context.

verify_receiptB

Verify a receipt's cryptographic integrity. Public — no API key needed.

Inputs: receipt_id (required), canonical_hash (required), signature (required), key_id (required).

verify_receipt_by_hashA

Verify a receipt by its canonical hash. Public — no API key needed. Use this to check if an agent has a valid consent receipt before serving a request. Returns receipt details and cryptographic verification result.

Inputs: canonical_hash (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes: issuing, verifying, listing, policy simulation, and provider stats are separate concerns. The only ambiguity is between verify_receipt and verify_receipt_by_hash, though their descriptions clarify the different input methods.

    Naming Consistency4/5

    Most tool names follow a consistent lowercase verb_noun pattern such as verify_receipt, issue_receipt, and get_policy. Two noun-phrase names, policy_decisions and provider_activity, deviate slightly but are still readable and predictable.

    Tool Count5/5

    With 10 tools, the server is well-scoped for its terms/receipt policy domain. Each tool serves a distinct operational need: policy access, simulation, decisions, receipt issuance/verification, and workspace/provider management.

    Completeness4/5

    The tool set covers policy retrieval/simulation, receipt issuance/verification/listin, and workspace/provider accounting, so the core workflow is complete. Minor gaps exist such as no explicit receipt revocation or policy update, but these are not clearly required by the domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Governance primitives for autonomous agents. Verify actions against policy, record signed provenance, and bind intents cryptographically. Free tier available.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides cryptographic governance receipts for AI agents, enabling pre-execution evaluation and signed verdicts (EXECUTE/BLOCK/REVIEW/SHADOW) with offline-verifiable audit trails.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to propose wallet payments while a local, human-authored policy decides whether each transaction is approved, requires human confirmation, or is refused, and records every decision in a signed, append-only ledger.
      -
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enforces policy controls for AI agents, including spend limits, action approvals, kill switch, scoped credentials, dry-run diffs, loop prevention, and auditable hash-chained logs.
      MIT