X402 Payment Gated Http
About
X402 Payment Gated Http is an MCP server that lets AI agents call HTTP APIs using the x402 protocol. When an API responds with a 402 Payment Required status, the server automatically handles the payment challenge, builds the proof, retries the request, and returns the final…
Details
- Author
- merkleworks
- Downloads
- 289
- Categories
- Other, Infrastructure
Jump to
- paid_http_request – sends an HTTP request and automatically handles 402 challenges.
- discover_x402_api – finds payable endpoints (e.g., from /.well-known/x402 or probing).
- pay_x402_endpoint – calls a known x402 endpoint with full control.
- parse_x402_challenge / verify_x402_proof – inspect and verify x402 headers.
- Runs entirely via npx; no separate installation steps required.
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
X402 Payment Gated HttpCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install via npx @merkleworks/x402-mcp. Configure in your MCP client (e.g., Cursor’s .cursor/mcp.json) by pointing the command to that package. Then invoke tools such as paid_http_request with a URL and method to make payment-gated HTTP calls.
discover_x402_api
Discover x402 payable API endpoints on a host. Fetches /.well-known/x402 manifest or probes the URL for a 402 challenge. Returns a list of payable endpoints with their prices in satoshis.
pay_x402_endpoint
Call an x402-gated API endpoint with automatic payment. Sends the request, handles the 402 challenge, constructs a BSV payment transaction, delegates for fee completion, broadcasts to the network, and retries with proof. Returns the API response after successful payment.
parse_x402_challenge
Parse an X402-Challenge header value into structured JSON. Decodes the base64url payload and returns the challenge fields: nonce UTXO, price, payee, expiry, request binding, and whether the challenge has expired.
verify_x402_proof
Verify an X402-Proof header against a challenge and request details. Performs structural validation, binding checks, hash verification, and expiry checks. Does not verify mempool acceptance or client signatures (those require network access).
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"x402 payment gated http": {
"x402": {
"command": "npx",
"args": [
"@merkleworks/x402-mcp"
]
}
}
}
}
McpServers
{
"x402": {
"command": "npx",
"args": [
"@merkleworks/x402-mcp"
]
}
}
What it does
x402 Payment-Gated HTTP lets AI agents call HTTP APIs that use the x402 protocol. If the API responds with 402 Payment Required, the MCP server handles the challenge, builds the payment, and retries with a proof, then returns the final response.
Primary tool
- paid_http_request — Send a request to a URL; if the server returns 402, the flow (parse challenge → pay → retry with proof) runs automatically and the tool returns the API response.
Other tools
- discover_x402_api — Find payable endpoints (e.g. from /.well-known/x402 or by probing).
- pay_x402_endpoint — Call a known x402 endpoint with full control.
- parse_x402_challenge / verify_x402_proof — Inspect and verify x402 headers.
Install
``bash`
npx @merkleworks/x402-mcp
.cursor/mcp.json
Example (Cursor)
Add to :`
json`
{
"mcpServers": {
"x402": {
"command": "npx",
"args": ["@merkleworks/x402-mcp"]
}
}
}
paid_http_request
Example tool call
- Tool: { "url": "https://your-x402-api.example.com/v1/expensive", "method": "GET" }`
- Input:
-
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



