Base Gas Mcp

io.github.memosr由 GitHub 帳號 memosr 發布v0.3.2更新於 Oct 26, 2026

Live Base gas, tx cost in USD, 4-chain comparison and gas history. Paid per call in USDC via x402.

已驗證STDIO僅桌面金融資料與分析

概覽

AI 產生的概覽

本機 MCP 伺服器,讓助理取得 Base 即時 gas、以美元計的交易成本、四鏈 gas 比較與歷史資料,每次呼叫透過 x402 以 USDC 付費。

可以做什麼
  • 取得 Base 目前 gas:基礎費、低/中/高優先費、以美元、ETH 與 gwei 表示的交易成本,以及可直接簽署的 maxFeePerGas 數值
  • 比較同一筆交易在 Base、OP Mainnet、Arbitrum One 與以太坊上的成本,由便宜到貴排序
  • 查看指定小時數內的 Base gas 歷史,包含最小值、最大值、平均值、中位數,以及目前 gas 偏高或偏低的判斷
  • 找出過去一週最便宜的小時與應避開的時段,並提供節省的百分比與美元金額
  • 免費查詢服務狀態與已蒐集的歷史資料,不需要錢包
適用情境
適合需要助理回答 Base 交易美元成本、判斷目前哪條鏈較便宜,或挑選低 gas 時段來安排批次交易的場合。
執行需求
需要 Node.js 18 或更新版本,以 stdio 方式在本機執行(npx 或複製專案)。需要一個持有少量 USDC 的 Base 主網錢包(不需 ETH),透過用戶端設定以 BUYER_PRIVATE_KEY 傳入;伺服器不讀取 .env 檔案。可選 MAX_USD_PER_CALL、BASE_GAS_ORIGIN 與 BUILDER_CODE。需要能連線至付費端點的網路。
安裝前請注意
BUYER_PRIVATE_KEY 是控制真實資金的真實私鑰,應使用只放少量資金的獨立一次性錢包,切勿使用存有大額資金錢包的私鑰。每次付費呼叫約花費 0.002 至 0.02 美元 USDC,單筆付款受 MAX_USD_PER_CALL(預設 0.05)限制。付款會被簽署並送往所設定的 origin,請確認 BASE_GAS_ORIGIN 指向可信位址。免費的狀態查詢工具不需要錢包。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Base Gas Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

base-gas-mcp

An MCP server for live Base gas data, paid per call in USDC over the x402 payment protocol. No API key and no account: the agent pays a fraction of a cent from a wallet you control.

It answers the questions an RPC call cannot: what a transaction costs in dollars, which chain is cheapest right now, whether gas is high or low, and which hours to avoid.

Tools

ToolPriceWhat it returns
get_base_gas~$0.002Base fee, low/medium/high priority fees, the cost of a transaction in USD, ETH and gwei, and ready-to-sign maxFeePerGas / maxPriorityFeePerGas (wei). Optional gasLimit.
compare_gas_costs~$0.01The same transaction on Base, OP Mainnet, Arbitrum One and Ethereum, in USD, cheapest first. Optional gasLimit.
get_gas_history~$0.01Base gas over the last hours (default 24): min/max/average/median and whether gas is cheap, normal, expensive or flat now.
get_cheapest_window~$0.02From 7 days of history: hours to avoid, cheapest hour (UTC), and the saving in percent and USD.
get_service_statusfreeWhether the service is up and how much history it has collected. Needs no wallet.

Prices are set by the endpoint and published in its OpenAPI document. Every paid result includes the settlement transaction hash.

gasLimit guide: 21000 ETH transfer (default), ~65000 ERC-20 transfer, ~85000 NFT mint, ~180000 Uniswap swap, ~1500000 contract deploy.

Safety

  • The server only ever pays one origin, set by you (BASE_GAS_ORIGIN, defaulting to the live base-gas-x402 API). No tool takes a URL, so text the model reads cannot redirect your wallet to another paid endpoint.
  • Per-payment cap. Any payment above MAX_USD_PER_CALL (default 0.05) is refused before anything is signed.
  • Payments are EIP-3009 authorizations: the wallet needs USDC only, no ETH.
  • Use a separate wallet holding a few dollars. The key is read from the environment to sign payments and is never logged or returned.

The paid data source is a companion project: base-gas-x402.

Installation

Requirements

  • Node.js 18 or newer (built-in fetch is required)
  • A Base mainnet wallet holding a little USDC (no ETH needed)
bash
git clone https://github.com/memosr/base-gas-mcp.gitcd base-gas-mcpnpm install

Pass BUYER_PRIVATE_KEY through your MCP client's config (see below). The server does not read a .env file.

Or run the published package directly with npx base-gas-mcp (see the config blocks below).

Getting a buyer key

BUYER_PRIVATE_KEY is the private key of a Base mainnet wallet. Create a fresh wallet (for example in MetaMask, Coinbase Wallet, or with cast wallet new), export its private key, and fund it on Base with a few dollars of USDC.

Warning: this is a real private key that controls real funds. Use a separate, disposable wallet holding only small amounts. Never reuse a key from a wallet with significant funds, never commit it to git, and never paste it into chat. The server reads it only to sign payments and never logs or returns it.

Environment variables

VariableRequiredDescription
BUYER_PRIVATE_KEYYes32-byte hex private key (64 hex chars, 0x prefix optional) of a funded Base mainnet wallet.
MAX_USD_PER_CALLNoRefuse any single payment above this many USD. Default 0.05.
BASE_GAS_ORIGINNoThe only origin the server pays. Defaults to https://base-gas-x402-production.up.railway.app.
BUILDER_CODENoBase Builder Code attached to the payment payload for attribution. Defaults to bc_lhfd8zad.

Configuration

Claude Desktop

Add to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json, Windows: %APPDATA%\Claude\claude_desktop_config.json), then restart Claude Desktop:

json
{  "mcpServers": {    "base-gas": {      "command": "npx",      "args": ["-y", "base-gas-mcp"],      "env": {        "BUYER_PRIVATE_KEY": "0xYOUR_FUNDED_BASE_MAINNET_PRIVATE_KEY"      }    }  }}

To run from a local clone instead, point command at Node and use the absolute path to the server:

json
{  "mcpServers": {    "base-gas": {      "command": "node",      "args": ["/absolute/path/to/base-gas-mcp/src/server.js"],      "env": {        "BUYER_PRIVATE_KEY": "0xYOUR_FUNDED_BASE_MAINNET_PRIVATE_KEY"      }    }  }}

Claude Code

bash
claude mcp add base-gas \  --env BUYER_PRIVATE_KEY=0xYOUR_FUNDED_BASE_MAINNET_PRIVATE_KEY \  -- npx -y base-gas-mcp

Or from a local clone:

bash
claude mcp add base-gas \  --env BUYER_PRIVATE_KEY=0xYOUR_FUNDED_BASE_MAINNET_PRIVATE_KEY \  -- node /absolute/path/to/base-gas-mcp/src/server.js

The server reads its settings only from the environment the client passes. It does not load a .env file (since 0.3.1), so a .env in whatever folder the client opens cannot change where the wallet pays.

Example usage

Once configured, ask your agent:

  • "What does a Uniswap swap on Base cost right now, in dollars?" (get_base_gas with gasLimit 180000)
  • "Is Base or Arbitrum cheaper for a token transfer at the moment?" (compare_gas_costs)
  • "Is Base gas high right now, or should I wait?" (get_gas_history)
  • "When should I schedule a batch of transactions on Base?" (get_cheapest_window)

Each of these is one paid call. Check get_service_status first for free.

Tech stack

  • Node.js (ESM), served over stdio transport
  • @modelcontextprotocol/sdk for the MCP server
  • @x402/fetch, @x402/evm, and @x402/extensions for the payment-wrapped fetch, the EIP-3009 exact payment scheme, and builder-code attribution
  • viem for account handling and signing
  • zod for input validation

License

MIT, copyright (c) 2026 memosr.

來源:README.md,提交 ef01ef1

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

2
  1. v0.3.2最新Oct 18, 2026
  2. v0.3.1Oct 18, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分