Mercury402: Treasury/FRED financial data over x402

io.github.dudman1由 GitHub 账号 dudman1 发布v0.1.4更新于 Nov 2, 2026

Treasury/FRED financial data over x402: pay-per-call US yields, macro and forex in USDC on Base

已验证Streamable HTTP可网页运行金融数据与分析

概览

AI 生成的概览

让助手浏览并调用 Mercury402 按次付费的美国国债、FRED、外汇与宏观数据 API,通过 x402 在 Base 上用 USDC 付款。

可以做什么
  • 列出全部 78 个数据端点,含路径、方法、分类、说明、价格与参数,可按分类或关键词筛选
  • 调用目录中的端点访问实时 API,传入路径以及查询参数或请求体参数
  • 未开启付费模式时返回 402 报价与付款说明,开启后返回接口的 JSON 数据
  • 即使在付费模式下也可将 pay 设为 false,仅获取报价
适用场景
适合助手需要美国国债收益率、FRED 序列、外汇、利差、盈亏平衡通胀、宏观组合或 AI 简报,且你愿意按次以 Base 上的 USDC 付费时使用。免费模式下它只是端点目录与报价浏览器。
运行要求
通过 npx 运行 npm 包需 Node.js 20.10+,也可使用托管远程端点。付费模式需设置 MERCURY402_PAYER_PRIVATE_KEY(持有 Base 上 USDC 的专用钱包),可选设置 MERCURY402_MAX_PRICE_USD;需能访问 Mercury402 API。未声明需要账号或 API 密钥。
安装前请注意
付费模式会花真实资金:每次调用约 0.05–0.50 美元,由 MERCURY402_MAX_PRICE_USD 限制单次上限。私钥以明文保存在客户端配置中,请使用专用低余额钱包,并避免写入会被提交到 git 的项目级配置。托管端点仅用于发现,只返回 402 报价。可选 HTTP 传输无身份验证,付费模式下仅限本机回环。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Mercury402: Treasury/FRED financial data over x402,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.dudman1%2Fmercury402-mcp/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "mercury402-treasury-fred-financial-data": {
      "type": "http",
      "url": "https://mcp.mercury402.com/mcp"
    }
  }
}

README

Mercury402 MCP Server

An MCP server that lets Claude and other MCP clients discover and call Mercury402's pay-per-call financial data API: Treasury yields, FRED series, forex, yield spreads, breakeven inflation, macro bundles, composites and AI briefings.

Mercury402 is paid per call with x402: an unpaid request returns HTTP 402 with a payment descriptor; the client pays USDC on Base and gets JSON back.

  • Default (free) mode: browse all endpoints and prices; calling an endpoint returns the price and payment instructions from the 402. No wallet, no spending.
  • Paid mode (opt-in): set MERCURY402_PAYER_PRIVATE_KEY and the server pays the 402 (USDC on Base, capped per call) and returns the data.

Tools

ToolWhat it doesNetworkSpends money
list_endpointsLists all 78 endpoints: path, method, category, description, price (USD), parameters. Optional category and search filters.NoNo
get_endpoint_dataCalls an endpoint on the live API. Returns the data, or the 402 quote + how to pay.YesOnly in paid mode

get_endpoint_data arguments

ArgTypeNotes
pathstringCatalog path. Path params inline (/v1/fred/UNRATE) or as a template (/v1/fred/{series_id})
paramsobjectPath params, plus query params (GET) or JSON body fields (POST)
paybooleanPaid mode only. false = return the quote without paying. Default true

Only paths in the catalog can be called; anything else is rejected before a request is made.

Install

Requires Node.js 20.10+. The package is mercury402-mcp on npm; MCP clients can launch it with npx, so there is nothing to install by hand.

bash
npx -y mercury402-mcp        # starts the server on stdio (what MCP clients do for you)

Claude Code

bash
claude mcp add mercury402 -- npx -y mercury402-mcp

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows), then restart Claude Desktop:

json
{  "mcpServers": {    "mercury402": {      "command": "npx",      "args": ["-y", "mercury402-mcp"]    }  }}

Paid mode (optional)

By default the server never spends money: it lists endpoints and returns price quotes. To have it pay per call, give it a payer wallet:

Warning: the private key is stored in plaintext in your MCP client config (claude_desktop_config.json, or ~/.claude.json for Claude Code). Use a dedicated wallet holding only a small USDC balance on Base, never your main wallet, and keep MERCURY402_MAX_PRICE_USD low. With Claude Code, don't add the key with --scope project: that writes it to .mcp.json, which is usually committed to git.

Claude Code:

bash
claude mcp add mercury402 \  -e MERCURY402_PAYER_PRIVATE_KEY=<dedicated-wallet-private-key> \  -e MERCURY402_MAX_PRICE_USD=0.50 \  -- npx -y mercury402-mcp

Claude Desktop:

json
{  "mcpServers": {    "mercury402": {      "command": "npx",      "args": ["-y", "mercury402-mcp"],      "env": {        "MERCURY402_PAYER_PRIVATE_KEY": "<dedicated-wallet-private-key>",        "MERCURY402_MAX_PRICE_USD": "0.50"      }    }  }}

Alternative: run from a local checkout

bash
git clone https://github.com/dudman1/mercury402.gitcd mercury402/mcp-servernpm installnpm run build

Then point your client at the built file instead of npx:

bash
claude mcp add mercury402 -- node /absolute/path/to/mercury402/mcp-server/dist/index.js
json
{  "mcpServers": {    "mercury402": {      "command": "node",      "args": ["/absolute/path/to/mercury402/mcp-server/dist/index.js"]    }  }}

Streamable HTTP (optional)

bash
npx -y mercury402-mcp --http   # http://127.0.0.1:3402/mcp (stateless, JSON responses)

Stateless streamable HTTP: POST /mcp speaks MCP, GET / describes the server, and GET /healthz is a local health check. The HTTP endpoint has no authentication. It binds to 127.0.0.1 by default, checks the Host header against an allowlist (loopback names plus MCP_HTTP_ALLOWED_HOSTS), rate-limits per client IP and globally, and caps request bodies.

Paid mode over HTTP is loopback-only. The server refuses to start with MERCURY402_PAYER_PRIVATE_KEY set together with a non-loopback MCP_HTTP_HOST, a public MCP_HTTP_ALLOWED_HOSTS entry, MCP_HTTP_TRUST_PROXY, or MCP_PUBLIC_URL. In paid mode it also rejects browser requests (any Origin header). To serve it publicly behind a reverse proxy in free mode, see deploy/HOSTED.md.

Environment variables

VariableDefaultDescription
MERCURY402_PAYER_PRIVATE_KEYunset (paid mode off)EVM private key (hex, 0x optional) of the wallet that pays, in USDC on Base. Setting it turns on paid mode. It ends up in plaintext in your client config, so use a dedicated low-balance wallet. The server only uses it in-process to sign payments; it is never logged or returned by any tool or error
MERCURY402_MAX_PRICE_USD0.50Per-call spending cap in USD. A 402 quote above this is returned to the agent instead of being paid. Current prices are $0.05–$0.50 per call; range FRED queries cost 2×
MERCURY402_API_URLhttps://api.mercury402.comAPI base URL (https://mercury402.uk also works)
MERCURY402_TIMEOUT_MS60000Per-request timeout (paid calls wait for on-chain settlement)
MCP_HTTP_HOST / MCP_HTTP_PORT127.0.0.1 / 3402HTTP transport bind address (only with --http)
MCP_HTTP_ALLOWED_HOSTSunsetComma-separated extra Host header names to accept (e.g. mcp.example.com behind a proxy). Loopback names are always accepted; anything else gets 403
MCP_HTTP_TRUST_PROXYfalseRate-limit on Cloudflare's CF-Connecting-IP instead of the socket address. Enable only behind cloudflared/Cloudflare: the header is spoofable otherwise. X-Forwarded-For is never used
MCP_HTTP_RATE_LIMIT_PER_MIN60POST /mcp requests per client IP per minute (0 disables)
MCP_HTTP_GLOBAL_RATE_LIMIT_PER_MIN600POST /mcp requests per minute across all clients (0 disables)
MCP_HTTP_MAX_BODY_BYTES65536Largest accepted request body; larger gets 413
MCP_PUBLIC_URLunsetPublic /mcp URL that GET / advertises. Setting it marks the server as public, so paid mode refuses to start

Example tool calls

List the Treasury endpoints:

json
{ "name": "list_endpoints", "arguments": { "category": "treasury" } }

Categories: ai, breakeven-inflation, composite, forex, fred, macro, treasury, yield-spread.

Get a FRED series (free mode returns a quote):

json
{ "name": "get_endpoint_data", "arguments": { "path": "/v1/fred/UNRATE", "params": { "limit": 12 } } }
text
PAYMENT REQUIRED (HTTP 402) for https://api.mercury402.com/v1/fred/UNRATE?limit=12: $0.05 (50000 USDC atomic units on base, pay to 0x…). Payment required. Paid mode is disabled (MERCURY402_PAYER_PRIVATE_KEY not set).{  "status": "payment_required",  "quote": { "price_usd": 0.05, "amount_usdc_atomic": "50000", "network": "base", "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "pay_to": "0x…", "scheme": "exact", "x402_version": 1 },  "how_to_pay": ["…"],  ...}

Historical yield curve (POST, params become the JSON body):

json
{  "name": "get_endpoint_data",  "arguments": {    "path": "/v1/treasury/yield-curve/historical",    "params": { "start_date": "2026-07-01", "end_date": "2026-09-30" }  }}

Ask the data (AI, POST):

json
{  "name": "get_endpoint_data",  "arguments": { "path": "/v1/ai/ask", "params": { "question": "Is inflation cooling?", "series": ["/v1/fred/cpi", "/v1/fred/pce-core"] } }}

Quote only, even in paid mode:

json
{ "name": "get_endpoint_data", "arguments": { "path": "/v1/composite/economic-dashboard", "pay": false } }

In paid mode a successful call returns status: "ok", the endpoint's JSON under data, and a payment block with the price, payer address and decoded PAYMENT-RESPONSE settlement (transaction hash).

How paid mode works

  1. Request the endpoint; Mercury402 answers 402 with x402 payment requirements. The v1 JSON body (x402Version: 1, network base) is used; the v2 Payment-Required header is a fallback.
  2. The server picks the exact / USDC-on-Base option and checks it: network base (or eip155:8453), asset = Base USDC (0x8335…2913), price ≤ MERCURY402_MAX_PRICE_USD. Otherwise it returns the quote and does not pay.
  3. It signs an EIP-3009 transferWithAuthorization for exactly the quoted amount (locally, with a fresh random nonce) and resends the request with a PAYMENT-SIGNATURE header containing base64 JSON { x402Version: 2, accepted: <the 402 body's accepts[0]>, payload: { authorization, signature } }, the same shape that Mercury402's server verifies (require402Payment()). Mercury402 settles on-chain and returns the data.
  4. Paid requests are never retried automatically, so one tool call can't be charged twice.

Security notes: use a dedicated hot wallet with a small balance, because the key sits in plaintext in your client config. The server only reads it from the environment, uses it in-process for signing, and never logs, echoes, or includes it in tool output or errors.

Pricing notes

  • Most endpoints are $0.05; macro bundle/recession probability $0.10; AI briefing $0.10, AI ask $0.15; composites $0.40–$0.50.
  • /v1/fred/{series_id} costs 2× when both observation_start and observation_end are supplied.
  • Invalid FRED series ids and malformed historical date ranges get a free 400 before any 402.

Development

From a checkout of dudman1/mercury402:

bash
npm test                    # vitest; HTTP and payments are mocked, no network, no real transactions                            # test/server-contract.test.ts also boots ../src/server.js (needs `npm ci` at the                            # repo root; skipped otherwise) with on-chain settlement stubbednpm run typechecknpm run generate:catalog    # regenerate src/catalog.json after changing ../src/pricing.js or routesnpm pack --dry-run          # inspect the publish tarball

The endpoint catalog (src/catalog.json) is generated from ../src/catalog.js, the same module that builds the API's JSON manifest and /llms.txt (it reads src/pricing.js, src/new-routes.js and src/ai-routes.js). Tests in both packages fail if it drifts from src/pricing.js. tsc bakes the catalog into dist/catalog.json, so the published package never reads the repo at runtime; prepublishOnly regenerates the catalog, rebuilds, and runs the tests.

来源:mcp-server/README.md,提交 f7519bf

工具

2

list_endpoints

List Mercury402 endpoints

List Mercury402 financial data endpoints (78 total) with path, method, category, description, price in USD (paid per call in USDC on Base via x402) and accepted parameters. Free; makes no network calls.

输入参数searchcategory

get_endpoint_data

Call a Mercury402 endpoint

Call a Mercury402 endpoint on the live API. This hosted endpoint is discovery-only: endpoints return HTTP 402 and this tool returns the price and x402 payment instructions instead of data. Pay with your own x402 client, or run mercury402-mcp locally (npx -y mercury402-mcp) with your own wallet. Use list_endpoints first to find paths and parameters. Path params can be inline ("/v1/fred/UNRATE") or passed in params ("/v1/fred/{series_id}" + {"series_id":"UNRATE"}). Other params go to the query string (GET) or JSON body (POST).

输入参数paypath必填params

版本历史

1
  1. v0.1.4最新Oct 26, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分