HTTPayer MCP

HTTPayer MCP

Enables AI agents to call x402-gated APIs using a central credit balance, abstracting away blockchain complexity and payment proofs. It provides tools to fetch data from payment-required endpoints, check usage balances, and simulate transaction costs.

Category
访问服务器

README

@httpayer/mcp

MCP (Model Context Protocol) server for HTTPayer. Lets AI agents call x402-enabled APIs using credit balance — no wallets, no blockchain, no Web3 knowledge required.


Quickstart

With an AI agent (recommended)

Paste this into any MCP-compatible agent (Claude Code, Cursor, Windsurf, OpenCode...):

Set up https://httpayer.com/skill.md

The agent detects your environment and handles everything automatically.

Without an agent (manual)

1. Run setup:

npx @httpayer/mcp setup

Get your API key at app.httpayer.com when prompted.

Flags:

Flag Description
--key sk-live-... Provide key non-interactively
--client <name> Target client: claude-code, claude-desktop, cursor, windsurf, opencode, zed, cline, warp, codex
--scope user|project Claude Code scope (default: user)
--yes / -y Skip all prompts
--update-key Replace existing key

2. Add to your client:

Claude Code:

claude mcp add httpayer --scope user -- npx -y @httpayer/mcp@latest

Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "httpayer": {
      "command": "npx",
      "args": ["-y", "@httpayer/mcp@latest"]
    }
  }
}

Cursor (.cursor/mcp.json), Windsurf (.windsurf/mcp.json), Cline (.cline/mcp_settings.json):

{
  "mcpServers": {
    "httpayer": {
      "command": "npx",
      "args": ["-y", "@httpayer/mcp@latest"]
    }
  }
}

OpenCode (opencode.json or ~/.config/opencode/config.json):

{
  "mcp": {
    "httpayer": {
      "type": "local",
      "command": ["npx", "-y", "@httpayer/mcp@latest"],
      "enabled": true
    }
  }
}

Zed:

{
  "context_servers": {
    "httpayer": {
      "command": {
        "path": "npx",
        "args": ["-y", "@httpayer/mcp@latest"]
      }
    }
  }
}

3. Restart your client and verify:

Ask your agent: "fetch https://api.httpayer.com/demo/v1/base-weather"

A weather response means HTTPayer is working.


How it works

User prompt
    │
    ▼
AI agent (Claude Code, Cursor, Windsurf...)
    │  uses MCP tools
    ▼
@httpayer/mcp (local MCP server via npx)
    │  REST calls with x-api-key header
    ▼
api.httpayer.com
    │  proxy handles x402 payment to target
    ▼
Target x402-gated API

Runtime flow

  1. Your client launches the MCP server via npx -y @httpayer/mcp@latest on startup (stdio transport).
  2. The server reads the API key from ~/.httpayer/mcp-config.json.
  3. The agent receives the tool list and system instructions in its context.
  4. When the agent calls fetch, the MCP server forwards the request to POST https://api.httpayer.com/proxy.
  5. HTTPayer's proxy detects a 402, pays using your credits, retries, and returns the final response.
  6. The result (status, body, headers) comes back to the agent.

MCP tools reference

get_balance

Check credit balance and daily usage.

Input: none

Example response:

{
  "account_id": "account_123",
  "mainnet": {
    "credits_balance": 50000,
    "daily_limit": 100000,
    "daily_spend": 15500,
    "daily_remaining": 84500
  }
}

fetch

Make an HTTP request to any x402-enabled endpoint. Payment is handled automatically.

Input:

Field Type Required Description
url string yes Target URL
method string no GET, POST, PUT, DELETE, PATCH — default GET
body object no JSON request body
params object no Query string parameters
headers object no Additional request headers
timeout number no Timeout in seconds, max 120

Example response:

{
  "status": 200,
  "body": { "data": "..." },
  "headers": { "content-type": "application/json" }
}

On 502, the response includes webhook_id for async polling.


simulate

Dry-run a fetch. Returns cost estimate without spending credits.

Input: Same as fetch (except timeout).

Example response:

{
  "requiresPayment": true,
  "proxyFeeBreakdown": {
    "targetAmount": 0.01,
    "proxyFee": 0.0003,
    "totalCreditsCharged": 10.3
  }
}

get_topup_link

Returns the dashboard URL to add credits. Show to user when balance is low.

Input: none


check_limits

Check global HTTPayer system daily limits and remaining capacity.

Input: none


get_webhook_status

Poll the status of an async operation. Use when fetch returns a 502 with webhook_id.

Input: webhook_id (string, required)

Status values: pending, success, success_refunded, payment_failed, upstream_error, internal_error, rate_limited


HTTPayer API reference

Authentication: x-api-key: sk-live-... header on all requests.

Method Path Tool
GET /v1/credits/balance get_balance
POST /proxy fetch
POST /proxy/sim simulate
GET /limits check_limits
GET /webhooks/{id} get_webhook_status

Proxy endpoint

POST https://api.httpayer.com/proxy

{
  "api_url": "https://target.example.com/endpoint",
  "method": "GET",
  "json": { "key": "value" },
  "params": { "query": "param" },
  "headers": { "Custom-Header": "value" },
  "timeout": 30
}

Only api_url and method are required.

Status codes:

Code Meaning
200 Success
402 Insufficient credits
429 Rate limited
500 Proxy error
502 Target refused payment — includes webhook_id

Configuration

API key stored at: ~/.httpayer/mcp-config.json

{ "apiKey": "sk-live-..." }

To update: npx @httpayer/mcp setup --update-key


x402 protocol overview

x402 is an HTTP-native micropayment protocol using the 402 Payment Required status code.

Without HTTPayer:

  1. Client hits endpoint → gets 402 + payment requirements
  2. Client pays on-chain (requires wallet + USDC)
  3. Client retries with payment proof

With HTTPayer:

  1. Client calls POST /proxy { api_url, method, ... }
  2. HTTPayer detects 402, pays using your credits
  3. HTTPayer retries and returns the final response

All blockchain interaction happens on HTTPayer's side.


Credit system

Unit Value
1 credit 0.001 USDC
1 USDC 1,000 credits
Proxy fee 3% of target payment

Top up at app.httpayer.com. Below 100 credits, the agent will prompt you to top up.


Error handling

Setup errors

Situation Behavior
Key format invalid Print error, exit 1
Key rejected (401) Print "API key rejected", exit 1
Network unreachable Print reason, exit 1

MCP tool errors

All errors return isError: true — the server stays alive and the agent gets a readable message.

Situation Message
No config "No HTTPayer API key configured. Run: npx @httpayer/mcp setup"
API non-2xx "HTTPayer {status}: {body}"
Unknown tool "Unknown tool: {name}"

© 2026 HTTPayer Inc.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选