API加密货币价格 MCP 服务器

加密货币价格 MCP 服务器

让 Claude、Cursor 和其他 MCP 客户端使用实时加密货币价格、K线、期货和预测概率。

服务器已上线,地址为 https://api.coinprice.dev/mcp,支持 streamable HTTP。它有五个工具。三个无需密钥:get_price、list_coins 和 search_docs。get_history 和 get_markets 需要免费 API 密钥,以 Authorization: Bearer 头发送。以 coin_test_ 开头的测试密钥返回虚构数据,永远不会计费。获取密钥。

连接

在 Claude Code 中,用一条命令添加服务器。加上请求头即可解锁需要密钥的工具。

Shell
claude mcp add --transport http coinprice https://api.coinprice.dev/mcp# with a key, for get_history and get_marketsclaude mcp add --transport http coinprice https://api.coinprice.dev/mcp \  --header "Authorization: Bearer $COINPRICE_API_KEY"

Cursor 和 VS Code 等允许设置自定义请求头的客户端,可以用上面的 URL 和 Authorization 头添加远程 HTTP MCP 服务器,以使用需要密钥的工具。无需密钥的工具可在任何支持远程服务器的客户端中使用。

工具

工具功能密钥参数
get_price一个或多个币种的当前价格,含24小时涨跌幅。不需要ids(最多 50 个 id 或代码)、currency(默认 usd)
list_coins按24小时成交量排名的币种,或匹配搜索的币种。不需要query、limit(1 到 100,默认 20)
search_docs搜索 API 文档。不需要query
get_history单个币种的K线。是id、interval(1m、5m、15m、1h、4h、1d)、limit(1 到 500,默认 100)、from、to
get_markets期货市场(价格、资金费率、未平仓合约)或预测市场概率。是type(futures 或 predictions)、coin、symbol、limit(1 到 100)

调用工具

curl
curl -s -X POST https://api.coinprice.dev/mcp \  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_price","arguments":{"ids":["bitcoin","ethereum"]}}}'

响应是一个 JSON-RPC 封装。工具的结果是 result.content[0].text 中的一个 JSON 字符串;解码后即可读取价格。无需密钥的响应还会带有 get_key 字段。

JSON-RPC 响应,真实响应,2026-11-24 07:20 UTC
{  "id": 1,  "jsonrpc": "2.0",  "result": {    "content": [      {        "text": "{\"get_key\":\"Free API key (more calls, history, futures and predictions): https://coinprice.dev/signup\",\"prices\":[{\"change_24h_pct\":-1.8524344173520557,\"currency\":\"usd\",\"id\":\"bitcoin\",\"price\":60252.585,\"symbol\":\"btc\",\"timestamp\":\"2026-11-24T07:20:59Z\"},{\"change_24h_pct\":-1.7347602401662998,\"currency\":\"usd\",\"id\":\"ethereum\",\"price\":1692.265,\"symbol\":\"eth\",\"timestamp\":\"2026-11-24T07:20:59Z\"}]}",        "type": "text"      }    ],    "isError": false  }}
解码后的文本,同一响应
{  "get_key": "Free API key (more calls, history, futures and predictions): https://coinprice.dev/signup",  "prices": [    {      "change_24h_pct": -1.8524344173520557,      "currency": "usd",      "id": "bitcoin",      "price": 60252.585,      "symbol": "btc",      "timestamp": "2026-11-24T07:20:59Z"    },    {      "change_24h_pct": -1.7347602401662998,      "currency": "usd",      "id": "ethereum",      "price": 1692.265,      "symbol": "eth",      "timestamp": "2026-11-24T07:20:59Z"    }  ]}

未带密钥调用需要密钥的工具

未带密钥调用需要密钥的工具时,返回 HTTP 200 和 isError: true,而不是错误状态码。其中的文字会说明从哪里获取密钥。

JSON,未带密钥调用 get_history 的真实响应,2026-11-24 05:53 UTC
{  "error": "unauthorized",  "message": "get_history needs an API key. Get a free one at https://coinprice.dev/signup and send it as 'Authorization: Bearer <key>'."}

限额

  • 不带密钥的调用限制为每个 IP 地址每分钟 30 次,initialize 和 tools/list 也计入。
  • 使用密钥时,每次工具调用都计入你套餐的调用次数。出错或没有找到结果时会退还。
  • From 80% of your monthly calls, tool answers carry usage_note: the calls used, the next plan's calls and the upgrade link.
  • get_history 的 from 和 to 只接受 ISO 日期或时间,不接受 Unix 秒。间隔默认为 1d。超出范围的 limit 会回到 100,而不是报错。
  • get_markets 在 limit 超出范围时使用 20。
  • get_price 最多接受 50 个 id。

通过 REST 获取相同数据

这些工具读取的价格与 REST API 相同。对于非 AI 客户端的代码,请使用 REST:API 参考列出了所有路由。

问题

MCP 服务器现在可用吗?

可用。它已上线,地址是 https://api.coinprice.dev/mcp。

需要 API 密钥吗?

get_price、list_coins 和 search_docs 不需要。get_history 和 get_markets 需要以 Authorization 头发送的免费密钥。

哪些客户端可用?

任何支持通过 streamable HTTP 连接远程服务器的 MCP 客户端,包括 Claude Code、Cursor 和 VS Code。

它返回什么数据?

当前价格、币种搜索、K线、期货市场和预测概率,数据与 REST API 相同。