xyz.chain-ops/mgo
Compare live gas across up to 9 EVM chains and get the cheapest one. x402 pay-per-call on Base.
التثبيت
أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: .cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).
claude mcp add --transport http mgo 'https://api.mgo.chain-ops.xyz/mcp'
{
"mcpServers": {
"mgo": {
"type": "http",
"url": "https://api.mgo.chain-ops.xyz/mcp"
}
}
}
التوثيق
مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.
المحتويات
MGO — Multi-chain Gas Optimizer
An x402-native API that compares real-time gas prices across up to 9 EVM chains and recommends the cheapest one. Built for trading agents, DeFi bots, and any AI agent that needs to optimize transaction costs.
Quick Start
# 1. Install dependencies
npm install
# 2. Set environment variables
cp .env.example .env
# Set WALLET_ADDRESS (USDC receiving wallet on Base) and CDP_API_KEY_ID/SECRET (facilitator auth)
# 3. Run locally (same entry point as production)
npm start
# 4. Test
# Open in browser: http://localhost:3000/gas/demo
Tiers
| Feature | Demo (Free) | Basic ($0.001) | Premium ($0.002) |
|---|---|---|---|
| Chains | 4 | 4 | 9 |
| Gas prices | Yes | Yes | Yes |
| Cheapest chain recommendation | No | Yes | Yes |
| Savings % calculation | No | Yes | Yes |
| Cost savings estimate | No | Yes | Yes |
| BNB, Polygon, Avalanche, zkSync, Hyperliquid | No | No | Yes |
| Rate limit | 10/hr, 100/day | Unlimited | Unlimited |
Endpoints
| Endpoint | Payment | Description |
|---|---|---|
GET /gas/demo | Free | Raw gas prices only (10/hr rate limit) |
GET /gas/basic | $0.001 USDC (x402) | 4-chain comparison + recommendation + savings |
GET /gas/premium | $0.002 USDC (x402) | 9-chain full comparison |
GET /prices | Free | Native token USD prices (ETH, BNB, POL, AVAX, HYPE), 60s cache |
POST /mcp | Free / x402 | MCP Streamable HTTP endpoint (tools: get_gas_demo, get_cheapest_chain, get_gas_basic, get_gas_premium) |
GET /openapi.json | Free | OpenAPI 3.1 spec |
GET /llms.txt, /skill.md | Free | AI agent discovery files |
GET /.well-known/x402, /.well-known/x402.json, /.well-known/mcp.json, /.well-known/agent-card.json | Free | Discovery metadata |
GET /health | Free | Server health check |
Payment Flow (x402 v2)
GET /gas/basicor/gas/premium→402with requirements in thePAYMENT-REQUIREDheader (base64 JSON). A v1-shaped copy is also in the body for legacy clients.- Client signs an EIP-3009 USDC authorization on Base (
eip155:8453) - Resend with
PAYMENT-SIGNATUREheader → facilitator (Coinbase CDP) verifies → data response withPAYMENT-RESPONSEreceipt → USDC settled on-chain
If the upstream RPC / price feed is unavailable the API answers 503 and no payment is settled.
// Client example (@x402/fetch, x402 v2)
const { wrapFetchWithPayment } = require("@x402/fetch");
const { x402Client } = require("@x402/core/client");
const { ExactEvmScheme } = require("@x402/evm/exact/client");
const { privateKeyToAccount } = require("viem/accounts");
const client = new x402Client().register("eip155:*", new ExactEvmScheme(privateKeyToAccount(process.env.EVM_PRIVATE_KEY)));
const paidFetch = wrapFetchWithPayment(fetch, client);
const res = await paidFetch("https://api.mgo.chain-ops.xyz/gas/basic");
MCP (Claude / Cursor / any MCP client)
Remote Streamable HTTP server, no install:
{
"mcpServers": {
"mgo-gas": { "url": "https://api.mgo.chain-ops.xyz/mcp" }
}
}
Also published as npm package chain-ops-mgo and in the official MCP Registry (xyz.chain-ops/mgo). Paid tools return the decoded x402 payment requirements; pay with an x402 client against the resource URL.
Operations
- Access log +
/stats(Upstash Redis, key viaSTATS_KEY; send it asx-stats-keyheader) - Demo rate limit and the CoinGecko price cache are shared through the same Redis
- Secrets never live in this repo: see
.env.example
Deploy to Vercel
npm i -g vercel
vercel --prod
Platform Registration
- BlockRun — Register MCP server URL
- Dexter — One-line facilitator config
- x402.org — Automatic llms.txt crawling
الأسئلة الشائعة
ما هو xyz.chain-ops/mgo؟
Compare live gas across up to 9 EVM chains and get the cheapest one. x402 pay-per-call on Base.
كيف أثبّت xyz.chain-ops/mgo؟
يعمل كخادم بعيد. في Claude Code: claude mcp add --transport http mgo 'https://api.mgo.chain-ops.xyz/mcp'. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.
هل يحتاج xyz.chain-ops/mgo إلى مفتاح API؟
لا يذكر إدراجه في السجل أي مفتاح أو سر إلزامي. قد تتطلب بعض الميزات حسابًا لدى الخدمة التي يتصل بها.
هل xyz.chain-ops/mgo مفتوح المصدر؟
نعم. شيفرته متاحة على GitHub بترخيص MIT.
من يصون xyz.chain-ops/mgo؟
ينشره dlrjsdl200-byte. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.
من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.