MGO — Multi-chain Gas Optimizer

io.github.dlrjsdl200-byte由 GitHub 账号 dlrjsdl200-byte 发布v1.2.0更新于 Oct 24, 2026

Cheapest EVM chain across up to 9 networks with savings %. Free demo tools, paid tools via x402.

发布方自己的服务:Agent.chain.tokyo Address Contracts

已验证STDIO仅桌面云端与基础设施金融

概览

AI 生成的概览

比较最多 9 条 EVM 链的实时 Gas 价格,并推荐最便宜的链,提供免费与按次付费工具。

可以做什么
  • 比较 Gas 价格并给出 DEX 兑换的最便宜链建议,附相对以太坊的节省比例
  • 获取 ETH、BNB、POL、AVAX、HYPE 等原生代币的美元价格
  • 在 4 条链上运行免费演示查询,每小时限 10 次
  • 查询付费的基础版(4 条链)与高级版(9 条链)Gas 报告,可通过 x402 SDK 自动付款或自行提供付款头
适用场景
适合在跨链桥、部署或兑换等 EVM 交易之前使用,让助手把操作导向手续费最低的链。也适合快速比较各链的 Gas 与原生代币价格。
运行要求
以 stdio 在本地运行,通常通过 npx 启动 npm 包 chain-ops-mgo。免费工具无需密钥或注册。付费工具自动付款需要 MGO_PRIVATE_KEY(在 Base 上持有 USDC 的 EVM 私钥),并安装 @chain-ops/agent-sdk 与 viem;MGO_MAX_PRICE 可选,用于限制单次花费。需要能访问服务商 API 的网络。
安装前请注意
付费工具会花费真实的 Base 链上 USDC,每次调用一笔微支付;未提供 MGO_PRIVATE_KEY 时只返回付款要求。私钥是具备支付能力的钱包机密,建议使用专用的低余额钱包,并把 MGO_MAX_PRICE 设得很低。Gas 与价格数据来自第三方 API,免费演示接口有频率限制。

安装

在 SourceWeft 中

  1. 打开 控制台中的 MGO — Multi-chain Gas Optimizer,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

chain-ops-mgo

Multi-chain Gas Optimizer — Compare real-time gas prices across 9 EVM chains and get the cheapest-chain recommendation. Pay-per-call via x402 on Base. No API key, no signup.

When to use: call it before any EVM transaction (bridge, deploy, swap) to route to the lowest-fee chain — e.g. "Use Optimism — saves 97% vs Ethereum". Built for AI agents: one USDC microtransaction per call. Ships as a Node client and a stdio MCP server.

[npm version] [Powered by @chain-ops/agent-sdk] [ClawHub]

MCP server (Claude Desktop, Cursor, any MCP client)

No install needed:

json
{  "mcpServers": {    "mgo-gas": {      "command": "npx",      "args": ["-y", "chain-ops-mgo"],      "env": { "MGO_PRIVATE_KEY": "0x...", "MGO_MAX_PRICE": "10000" }    }  }}

Tools: get_gas_demo, get_cheapest_chain (free), get_gas_basic ($0.001), get_gas_premium ($0.002). Without MGO_PRIVATE_KEY the paid tools return the x402 payment requirements instead of data. With it (plus @chain-ops/agent-sdk and viem installed) they pay automatically, capped at MGO_MAX_PRICE micro-USDC (default 10000 = $0.01). Prefer not to run anything? The same tools are hosted at https://api.mgo.chain-ops.xyz/mcp (official MCP Registry: xyz.chain-ops/mgo).

Install (library)

Free endpoints only:

bash
npm install chain-ops-mgo

Auto-payment (recommended for paid endpoints):

bash
npm install chain-ops-mgo @chain-ops/agent-sdk viem

Quick Start

Free — no payment

javascript
const { getCheapestChain } = require('chain-ops-mgo');
const result = await getCheapestChain();console.log(result);// {//   chain: 'Optimism', chainId: 10, nativeToken: 'ETH',//   gasPriceGwei: '0.0010',//   dexSwapCostNative: '0.00000016',//   dexSwapCostUsdc: 0.00039,        // from the free /prices feed; omitted if unavailable//   savingsVs: 'Ethereum',//   savingsPercent: '97.4%'// }

Paid — auto-payment via SDK (recommended)

javascript
const { getGasBasicWithPayment } = require('chain-ops-mgo');
const data = await getGasBasicWithPayment({  account: process.env.PRIVATE_KEY, // 0x...  network: 'base',});
console.log(data.recommendation.action);// "Use Optimism — saves 97.4% vs Ethereum"

The SDK handles the x402 402-handshake (parse requirements, sign the EIP-3009 USDC authorization, retry). One USDC microtransaction per call ($0.001 basic, $0.002 premium), hard-capped at maxPrice (default $0.01).

Endpoints

FunctionPriceChainsNotes
getGasDemo()Free4Raw gas prices (native units), rate limited 10/hr
getPrices()Free—Native token USD prices (ETH, BNB, POL, AVAX, HYPE), 60s cache
getCheapestChain()Free4Cheapest chain for a DEX swap, USD via getPrices()
getGasBasicWithPayment({ account })$0.001 USDC4Auto-pay via SDK + recommendation
getGasPremiumWithPayment({ account })$0.002 USDC9Auto-pay via SDK + 9 chains incl. BNB, Polygon, Avalanche, zkSync, Hyperliquid
getGasBasic({ paymentHeader })$0.001 USDC4Manual mode — bring your own x402 header
getGasPremium({ paymentHeader })$0.002 USDC9Manual mode — bring your own x402 header

Auto-pay options

javascript
await getGasPremiumWithPayment({  account: '0x...',         // private key OR a viem Account object  network: 'base',          // currently only 'base'  maxPrice: 5_000n,         // optional cap in micro-USDC ($0.005); default 10_000n});

If @chain-ops/agent-sdk is not installed, the auto-pay functions throw a clear error pointing to the install command. Free functions work without it.

Manual mode (advanced)

If you build your own x402 client, you can supply a pre-built header:

javascript
const { getGasBasic } = require('chain-ops-mgo');
const data = await getGasBasic({  paymentHeader: { 'PAYMENT-SIGNATURE': '<base64 x402 v2 payload>' }, // or 'X-PAYMENT' for v1});

Without a payment header, paid functions throw Error: Payment required with err.status === 402 and err.paymentInfo (the decoded PAYMENT-REQUIRED header: accepts[], resource, ...).

Payment

Uses x402 protocol on Base (eip155:8453) with USDC. No API key, no subscription, no account required.

Links

License

MIT

来源:README.md,提交 1539937

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v1.2.0最新Oct 20, 2026
  2. v1.0.0Sep 16, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Chain 集成