mgo-gas
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 to your USDC receiving wallet on Base
# 3. Run locally
npm run dev
# 4. Test
# Open in browser: http://localhost:3000/gas/demoTiers
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 |
| Free | Raw gas prices only (10/hr rate limit) |
| $0.001 USDC (x402) | 4-chain comparison + recommendation + savings |
| $0.002 USDC (x402) | 9-chain full comparison |
| Free | AI agent discovery file |
| Free | Server health check |
Payment Flow (x402 Protocol)
GET /gas/basicor/gas/premium→ 402 response with payment requirementsClient signs EIP-712 USDC authorization (using x402-axios or x402-fetch)
Resend with
X-PAYMENTheader → facilitator verifies → data response → on-chain settlement
// Client example (x402-axios)
const { withPayment } = require("x402-axios");
const client = withPayment(axios.create(), walletClient);
const response = await client.get("https://api.mgo.chain-ops.xyz/gas/basic");MCP Server (Claude / Cursor)
npm run mcpAdd to Claude Desktop config:
{
"mcpServers": {
"mgo-gas": {
"command": "node",
"args": ["/path/to/x402-gas-api/mcp-server.js"]
}
}
}Deploy to Vercel
npm i -g vercel
vercel --prodPlatform Registration
BlockRun — Register MCP server URL
Dexter — One-line facilitator config
x402.org — Automatic llms.txt crawling
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dlrjsdl200-byte/x402-gas-api'
If you have feedback or need assistance with the MCP directory API, please join our Discord server