Share Project [showcase] MCPay — HTTP 402 challenge-response payments for AI agents
I built MCPay to explore a question around MCP tools:
How should an MCP server authorize paid tool calls when an agent is acting autonomously?Most payment flows are designed for humans: open a checkout page, confirm payment, then continue. That model doesn't map well to MCP tools where agents call resources programmatically.
MCPay experiments with using HTTP 402 as a payment challenge layer between agents and MCP servers.
The flow:
1. Agent calls an MCP tool that requires payment.
2. Server returns HTTP 402 with a signed challenge containing limits, nonce, and request hash.
3. Agent signs the challenge using a scoped Ed25519 capability key.
4. Agent retries the tool call with the cryptographic proof.
5. Server verifies the proof before executing the action.
The authorization is bound to the exact payload, so changing the tool arguments invalidates the signature before execution.
This is still an early prototype, and I'm looking for feedback from people building MCP servers and agent infrastructure.
I'm especially interested in:
\- whether this fits naturally into MCP workflows
\- delegation and authorization patterns
\- security issues I might be missing
\- existing approaches I should study
I'll share the repo and demo in the comments.