{"slug": "show-hn-tarfio-bounded-spending-controls-for-mcp-tools", "title": "Show HN: Tarfio bounded spending controls for MCP tools", "summary": "Tarfio, a private beta service announced on September 8, 2026, introduces bounded spending controls for MCP tools, enabling AI-agent teams to set hard limits on test-credit budgets, maximum price per call, allowed tools, expiry, and revocation. The service, which does not yet enable live payments or creator payouts, allows MCP creators to set test-credit prices per successful tool call without embedding billing logic, and includes features such as signed spend sessions, outcome receipts, replay protection, and idempotent processing. Tarfio is in development for a hosted beta with planned monthly subscription plans for selected tools.", "body_md": "**Give AI agents a budget, not your credit card.**\n\n  Hard spending limits for MCP tools and test-credit pricing for successful tool calls.\n\n**Private beta with test credits. Live payments and creator payouts are not enabled.**\n\nTarfio gives AI-agent teams bounded access to MCP tools. A spend session can limit the total test-credit budget, maximum price per call, allowed tools, expiry, and revocation.\n\nMCP creators can set a test-credit price for each successful tool action without putting billing logic inside every tool handler. Tarfio records outcomes and receipts and protects covered paths from duplicate processing.\n\n- Set a test-credit price per successful tool call.\n- Keep your MCP at its own URL and behind its own gateway.\n- Give agent teams a clear outcome and receipt for each logical call.\n- Prepare monthly plans for selected tools before the hosted beta opens.\n\n- Set a total test-credit budget for an agent session.\n- Limit the maximum price of one tool call.\n- Choose which tools the agent may use.\n- Set an expiry and revoke access when needed.\n- Review outcomes and receipts without counting covered retries twice.\n\n**Status as of September 8, 2026: private beta with test credits. Live payments, cards, and creator payouts are not enabled.**\n\nTarfio currently covers:\n\n- test-credit pricing per successful tool call;\n- creator-defined tool prices;\n- signed bounded spend sessions;\n- total budgets and maximum price per call;\n- allowed-tool restrictions, expiry, and revocation;\n- outcomes and receipts;\n- replay protection and idempotent processing for covered paths;\n- catalog and discovery;\n- a Go API, gateway, worker, PostgreSQL migrations, dashboard, and local SDK source.\n\nHosted access is not open yet. The current beta does not accept, hold, transfer, or pay out real funds.\n\n**Status: In development for the hosted beta.**\n\nThe planned monthly mode lets an MCP creator publish a versioned plan for one MCP server and selected tools. A plan has a monthly price in test credits and an included number of successful calls.\n\nThe subscription design uses UTC billing periods, reserves allowance before a tool call, consumes allowance only for eligible successful outcomes, and stops calls when the included allowance reaches zero. Overage billing and silent fallback to per-call billing are not planned for this beta.\n\n```\nflowchart LR\n    Agent([AI Agent])\n    API[Tarfio API]\n    Gateway[Tarfio Gateway]\n    Database[(PostgreSQL)]\n    Tool[MCP Tool]\n    Worker[Usage Worker]\n\n    Agent -->|Create bounded spend session| API\n    API -->|Reserve test credits| Database\n    API -->|Return signed spend token| Agent\n    Agent -->|tools/call with token and nonce| Gateway\n    Gateway -->|Claim logical call| Database\n    Gateway -->|Forward request| Tool\n    Tool -->|Return outcome| Gateway\n    Gateway -->|Deliver outcome| Agent\n    Gateway -.->|Upload usage batch| API\n    API -.->|Store idempotent usage| Database\n    Worker -->|Apply test-credit ledger entries| Database\n\n    classDef primary fill:#111827,color:#ffffff,stroke:#111827,stroke-width:2px\n    classDef service fill:#f8fafc,color:#111827,stroke:#94a3b8,stroke-width:1.5px\n    classDef storage fill:#ecfccb,color:#111827,stroke:#65a30d,stroke-width:1.5px\n    class Agent,API,Gateway primary\n    class Tool,Worker service\n    class Database storage\n```\n\nThe gateway records dispatch before contacting the upstream tool. If a process or network failure happens after dispatch, the tool may have executed even if the caller receives an error. For eligible successful outcomes, durable usage preparation happens before response delivery. Tarfio does not claim exactly-once tool delivery or exactly-once charging.\n\nThe beta rejects metered `2xx text/event-stream` responses before forwarding upstream success headers or body bytes and records no usage for them. Unmetered MCP traffic can still stream through the gateway.\n\nSpend tokens contain readable claims protected by Ed25519 signatures. They are not encrypted. The API holds the active signing private key; gateways receive a public verification keyring and select keys by the protected JWT `kid` header.\n\nThe beta also uses:\n\n- `HttpOnly` ,`SameSite=Strict` browser cookies;\n- bcrypt password hashes;\n- hashed invite and session tokens in PostgreSQL;\n- server-scoped, versioned gateway credentials;\n- HTTPS outside explicit local-development mode;\n- integer minor units and database transactions;\n- redirect blocking, header stripping, and request size and time limits in the gateway.\n\nDatabase rows are not encrypted by the application. Protect PostgreSQL storage, backups, signing keys, gateway secrets, and deployment environment files with operator-controlled encryption and access controls.\n\nRead [Security Policy](/yiaany/Tarfio/blob/main/SECURITY.md) and [Threat Model](/yiaany/Tarfio/blob/main/docs/threat-model.md) before exposing a deployment.\n\nRequirements: Docker Engine with Compose v2, Go 1.25+, and 4 GB of available memory.\n\n```\ncp deploy/.env.beta.example deploy/.env.beta\ngo run ./cmd/mcpay-keygen --key-id beta-2026-08\n```\n\nPut the generated keys in `deploy/.env.beta`, replace every `replace-*` value, and start the stack:\n\n```\ndocker compose --env-file deploy/.env.beta -f deploy/compose.beta.yml config\ndocker compose --env-file deploy/.env.beta -f deploy/compose.beta.yml build\ndocker compose --env-file deploy/.env.beta -f deploy/compose.beta.yml up -d\ndocker compose --env-file deploy/.env.beta -f deploy/compose.beta.yml ps\n```\n\nOpen `http://localhost:8080`. Any top-up is a test credit with no cash value.\n\nVerify the stack:\n\n```\nMCPAY_BETA_URL=http://localhost:8080 ./scripts/verify-central-beta.sh\n./scripts/verify-central-beta.ps1 -BaseUrl http://localhost:8080\n```\n\nSee [Central Beta Runbook](/yiaany/Tarfio/blob/main/docs/central-beta-runbook.md), [Deployment](/yiaany/Tarfio/blob/main/docs/beta-deployment.md), and [Backup/Restore Drill](/yiaany/Tarfio/blob/main/docs/backup-restore-drill.md).\n\nCreate a server and action in the dashboard, issue a server-scoped gateway credential, and run the gateway beside the MCP server. Use persistent local storage for `--state-file` and do not share one state file between processes.\n\n```\ngo run ./cmd/mcpay-gateway \\\n  --target https://your-mcp-server.example \\\n  --mcp-path /mcp \\\n  --server-id srv_example \\\n  --environment beta \\\n  --token-issuer mcpay.beta \\\n  --control-plane-api https://api.example/v1/gateway/servers/srv_example \\\n  --nonce-claim-api https://api.example/v1/gateway/nonces/claim \\\n  --usage-api https://api.example/v1/usage-records \\\n  --usage-api-token \"$MCPAY_GATEWAY_API_TOKEN\" \\\n  --state-file ./mcpay-gateway.db\n```\n\nMetered requests in the test-credit beta carry `Authorization: Bearer <spend-token>` and `X-MCPay-Nonce: <nonce>`. The gateway removes both headers before forwarding upstream.\n\nThe control-plane gateway configuration supplies `verification_keys`. For a standalone gateway without `--control-plane-api`, pass `--verification-keys \"$MCPAY_VERIFICATION_KEYS\"`.\n\nThe JavaScript and Python SDKs are **not published to npm or PyPI as of September 8, 2026**. Install them from this repository only.\n\n```\nnpm install\nnpm run build --workspace=@mcpay/sdk-js\n```\n\nWorkspace code can then import `@mcpay/sdk-js`. For use from another local Node project, install the repository path after building:\n\n```\nnpm install ../Tarfio/packages/sdk-js\n```\n\nInstall the Python SDK in editable mode from the repository root:\n\n```\npython -m pip install -e ./packages/sdk-python\n```\n\nSee [JavaScript SDK](/yiaany/Tarfio/blob/main/packages/sdk-js/README.md) and [Python SDK](/yiaany/Tarfio/blob/main/packages/sdk-python/README.md). Direct SDK wrappers use volatile process state in development; the persistent gateway is the supported beta path for crash recovery.\n\n```\ngo test ./...\ngo test -race ./...\ngo vet ./...\ngo build ./cmd/...\nnpm ci\nnpm run build\nnpm run test\npython -m pip install build\npython -m build packages/sdk-python\npython -m unittest discover -s packages/sdk-python/tests\n```\n\nPostgreSQL tests require a disposable migrated database in `MCPAY_TEST_DATABASE_URL`. They truncate application tables; never point them at retained data.\n\n| Path | Purpose | \n|---|---|\n| `apps/api` | HTTP control-plane handlers and authentication | \n| `apps/dashboard` | Private-beta dashboard | \n| `cmd/mcpay-api` | API process | \n| `cmd/mcpay-gateway` | MCP and HTTP authorization proxy | \n| `cmd/mcpay-worker` | Usage, retry, reconciliation, and expiry loop | \n| `internal/controlplane` | PostgreSQL ledger and usage transactions | \n| `internal/gateway` | Authorization proxy and persistent gateway state | \n| `internal/sessions` | Spend claims and Ed25519 token code | \n| `packages/sdk-js` | JavaScript SDK source | \n| `packages/sdk-python` | Python SDK source | \n| `migrations` | Ordered PostgreSQL schema migrations | \n\nTarfio is source-available under the Business Source License 1.1. BSL 1.1 is not an OSI-approved open-source license. The Additional Use Grant and change date are defined in [LICENSE](/yiaany/Tarfio/blob/main/LICENSE). The dashboard has a separate MIT license and upstream attribution in [apps/dashboard/LICENSE](/yiaany/Tarfio/blob/main/apps/dashboard/LICENSE).", "url": "https://wpnews.pro/news/show-hn-tarfio-bounded-spending-controls-for-mcp-tools", "canonical_source": "https://github.com/yiaany/tarfio", "published_at": "2026-09-08 16:34:10+00:00", "updated_at": "2026-09-08 16:58:08.074796+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "ai-infrastructure"], "entities": ["Tarfio"], "alternates": {"html": "https://wpnews.pro/news/show-hn-tarfio-bounded-spending-controls-for-mcp-tools", "markdown": "https://wpnews.pro/news/show-hn-tarfio-bounded-spending-controls-for-mcp-tools.md", "text": "https://wpnews.pro/news/show-hn-tarfio-bounded-spending-controls-for-mcp-tools.txt", "jsonld": "https://wpnews.pro/news/show-hn-tarfio-bounded-spending-controls-for-mcp-tools.jsonld"}}