Skip to main content

MCP proxy that records and cryptographically signs AI agent tool calls

Project description

Receipts MCP Proxy

receipts_mcp/ is a stdio MCP server that sits between an MCP client and one or more upstream MCP servers.

For each tool call:

  1. The client calls the Receipts proxy.
  2. The proxy forwards the call to the real upstream MCP server.
  3. The real output is captured.
  4. The proxy POSTs that result to POST /tools/record on the Receipts backend.
  5. The real result is returned to the client even if receipting fails.

Upstream tools are namespaced as <server>__<tool> so collisions do not clobber each other.

If no upstream config file exists, the proxy falls back to the built-in demo tools:

  • write_file
  • http_fetch
  • db_query

Those demo tools are forwarded to the backend's /tools/call endpoint.

Setup

pip install receipts-mcp
cp upstreams.json.example upstreams.json

Configuration

receipts_mcp/config.py reads environment variables and an upstreams JSON file.

Environment variables:

Variable Default Purpose
RECEIPTS_URL http://localhost:8000 Receipts backend URL
RECEIPTS_API_KEY empty Proxy-role API key used for /tools/record
UPSTREAMS_PATH receipts_mcp/upstreams.json Path to upstream config
TOOL_TIMEOUT_SECONDS 60 Max time for an upstream tool call
RECORD_TIMEOUT_SECONDS 5 Max time for backend receipting

The upstreams file supports:

  • stdio
  • sse
  • streamable_http

${ENV_VAR} references inside env and headers are expanded from the process environment.

Example:

{
  "include_demo_tools": false,
  "upstreams": {
    "github": {
      "transport": "stdio",
      "command": "/path/to/github-mcp",
      "args": [],
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      }
    }
  }
}

Claude Code / Cursor config

Add this to ~/.claude/claude_mcp_config.json or the equivalent Cursor MCP config:

{
  "mcpServers": {
    "receipts": {
      "command": "/home/shreyansh/receipts/.venv/bin/python3",
      "args": ["-m", "receipts_mcp.server"],
      "cwd": "/home/shreyansh/receipts",
      "env": {
        "RECEIPTS_URL": "http://localhost:8000",
        "RECEIPTS_API_KEY": "<proxy-key>",
        "UPSTREAMS_PATH": "receipts_mcp/upstreams.json",
        "PYTHONPATH": "/home/shreyansh/receipts"
      }
    }
  }
}

Restart the MCP client after changing the config.

Runtime behavior

  • One proxy process gets one mcp-<hex> session ID.
  • All tool calls from that process share that session so they can be reconciled together.
  • If the backend is unreachable, the tool result still returns and the receipt is skipped.
  • If the backend rejects the API key, the proxy logs it as a configuration error.

Run

python3 -m receipts_mcp

or

python3 -m receipts_mcp.server

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

receipts_mcp-0.1.2.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

receipts_mcp-0.1.2-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file receipts_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: receipts_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for receipts_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 35269afea3421e65312b6dcd5767a300af58540d28120c6ee7e6eca6c3a62b7f
MD5 53b20ae9bd8b7f58156560fe0e0e469b
BLAKE2b-256 0899126db61348d80831ef5a32c6c31c9ca2fa6dbccc82c0a7c8bffbaf8350d2

See more details on using hashes here.

File details

Details for the file receipts_mcp-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: receipts_mcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for receipts_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 818ccfe1ef72550662f39bf6f38e25b5c998b78ab73f47174d0a8167d43191d4
MD5 e8296f2d9cba048e366ed5ebb5161cee
BLAKE2b-256 c40a9d89ceb807d417c7659f7fff895c2efcd9e1ad22068323e206a1063b694a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page