# chain-context-mcp A lightweight **MCP server** that gives AI agents and Claude Desktop **live crypto market data** — current price, 24h stats, and top movers — over the Model Context Protocol. Pay-per-call ready (x402), with a free tier for discovery. **Live demo server:** `https://chain-context-mcp.hadi-ai.workers.dev` ## Why Most MCP data servers are read-only wrappers that 403 from cloud IPs or need API keys. This one runs on Cloudflare Workers, uses a keyless public source, edge-caches responses, and is built to be **paid per call by autonomous agents** via [x402](https://www.x402.org) — machines paying machines, no signup. ## Tools | Tool | Args | Returns | |------|------|---------| | `get_token_price` | `id` (e.g. `bitcoin`, `ethereum`, or `BTC`) | USD price + 24h % change | | `get_market_snapshot` | `id` | price, 24h volume, high, low, open, change | | `get_trending` | — | top major-token movers by 24h % change | ## Connect from Claude Desktop Add a Streamable-HTTP MCP server pointing at the URL above, then ask: > "What's the price of solana right now?" ## Quick test ```bash curl -s -X POST https://chain-context-mcp.hadi-ai.workers.dev \ -H 'content-type: application/json' \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_token_price","arguments":{"id":"ethereum"}}}' ``` ## Run / deploy your own ```bash npm install npm test # pure-logic tests (gating) npm start # local Node server on :8788 wrangler kv namespace create MCP_USAGE # paste id into wrangler.toml wrangler deploy # deploy to Cloudflare Workers ``` ## Monetization - **Free tier:** `FREE_CALLS_PER_DAY` per client (KV-tracked), consumed only on a successful response. - **x402:** set `X402_PAYTO` to your USDC wallet; calls beyond the free tier return HTTP 402 with payment requirements, and a valid `X-Payment` header is served. (Plug in an x402 facilitator to verify settlement.) ## License MIT