Skip to main content
Glama

MetaMask MCP

模型上下文协议 (MCP) 服务器允许 LLM 通过 MetaMask 与区块链交互。

使用这些工具,您的私钥将安全地存储在您的加密钱包中,并且在签署消息或发送交易时永远不会与 AI 代理共享。

预览

https://github.com/user-attachments/assets/3fe8f20b-4666-4c36-8030-04d3e5d587c7

Related MCP server: EVM MCP Server

要求

  • Node.js(v20 或更高版本)

  • 下午

设置

  1. 克隆存储库

git clone https://github.com/Xiawpohr/metamask-mcp.git
cd metamask-mcp
  1. 安装依赖项

pnpm install
  1. 构建项目

pnpm build

与 Claude Desktop 一起使用

按照指南https://modelcontextprotocol.io/quickstart/user并添加以下配置:

{
  "mcpServers": {
    "metamask": {
      "command": "node",
      "args": [
        "/PATH/TO/YOUR_PROJECT/dist/index.ts"
      ]
    }
  }
}

工具

  • call :立即执行新的消息调用,而无需向网络提交交易。

  • get-chain-list :获取所有链信息的列表。

  • get-connect-uri :获取连接 URI 以连接到 MetaMask 钱包。

  • show-connect-qrcode :显示给定连接 URI 的连接二维码。

  • deploy-contract :根据字节码和构造函数参数将合约部署到网络。

  • disconnect :断开钱包连接。

  • estimate-fee-per-gas :估计一笔交易可能被纳入下一个区块的每 gas 费用(以 wei 为单位)。

  • estimate-gas :估计完成交易所需的气体,而无需将其提交给网络。

  • get-account :获取当前帐户。

  • get-native-currency-balance :获取地址的本国货币余额。

  • get-token-balance :获取地址的代币余额。

  • get-block-number :获取最近看到的区块的编号。

  • get-block :获取有关块编号、哈希值或标签处的块的信息。

  • get-chain-id :获取当前链 id。

  • get-chains :获取配置的链。

  • get-ens-address :获取名称的 ENS 地址。

  • get-ens-name :获取地址的主要 ENS 名称。

  • get-gas-price :获取当前的 gas 价格(以 wei 为单位)。

  • get-token :获取令牌信息。

  • get-transaction-reeceipt :根据交易哈希获取交易收据。

  • get-transaction :获取给定哈希或块标识符的交易。

  • read-contract :调用合约上的只读函数,并返回响应。

  • send-transaction :向网络发送交易。

  • sign-message :签署消息。

  • switch-chain :切换目标链。

  • verify-message :验证消息是否由提供的地址签名。

  • wait-for-transaction-receipt :等待交易被包含在区块中,然后返回交易收据。

  • write-contract :对合约执行写入功能。

提示

贡献

欢迎贡献代码!如有任何改进或错误修复,请提交 PR。

执照

MIT 许可证

Available Tools

28 tools
callB

Executing a new message call immediately without submitting a transaction to the network.

Inputs: to (required), data (required), value.

deploy-contractC

Deploy a contract to the network, given bytecode, and constructor arguments.

Inputs: abi (required), bytecode (required), args.

disconnectC

Disconnect the wallet.

Inputs: no named parameters.

estimate-fee-per-gasC

Estimate for the fees per gas (in wei) for a transaction to be likely included in the next block.

Inputs: chainId, formatUnits.

estimate-gasA

Estimate the gas necessary to complete a transaction without submitting it to the network.

Inputs: to (required), data, value, maxFeePerGas, +2 more.

get-accountB

Get the current account.

Inputs: no named parameters.

get-blockC

Fetch information about a block at a block number, hash or tag.

Inputs: chainId, blockHash, blockNumber, blockTag.

get-block-numberB

Fetch the number of the most recent block seen.

Inputs: chainId.

get-chain-idB

Get the current chain id.

Inputs: no named parameters.

get-chain-listB

Get a list of all chains information.

Inputs: no named parameters.

get-chainsC

Get the configured chains.

Inputs: no named parameters.

get-connect-uriB

Get the connect URI to connect to a MetaMask wallet.

Inputs: no named parameters.

get-ens-addressB

Fetch the ENS address for name.

Inputs: name (required), chainId, blockNumber.

get-ens-nameB

Fetch the primary ENS name for address.

Inputs: address (required), chainId, blockNumber.

get-native-currency-balanceC

Get the native currency balance of an address.

Inputs: address (required).

get-tokenC

Fetch the token information.

Inputs: address (required), chainId.

get-token-balanceC

Get token balance of an address.

Inputs: address (required), token (required).

get-transactionC

Fetch transaction given hash or block identifiers.

Inputs: hash (required), chainId.

get-transaction-receiptC

Fetch the Transaction Receipt given a Transaction hash.

Inputs: hash (required), chainId.

read-contractC

Call a read-only function on a contract, and returning the response.

Inputs: abi (required), address (required), functionName (required), args, +1 more.

send-transactionC

Send transactions to networks.

Inputs: to (required), data, value, maxFeePerGas, +2 more.

show-connect-qrcodeC

Show the connect QR code for a given connect URI.

Inputs: uri (required).

sign-messageC

Sign a message.

Inputs: message (required).

switch-chainC

Switch the target chain.

Inputs: chainId (required), addEthereumChainParameter.

verify-messageA

Verify that a message was signed by the provided address.

Inputs: address (required), message (required), signature (required).

wait-for-transaction-receiptC

Waits for the transaction to be included on a block, and then returns the transaction receipt.

Inputs: hash (required), confirmations, chainId.

wait-secondsB

Wait the given seconds.

Inputs: seconds (required).

write-contractC

Execute a write function on a contract.

Inputs: abi (required), address (required), functionName (required), args, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 28 tools

    Disambiguation4/5

    Most tools have distinct purposes, but some overlap exists, such as 'get-block' and 'get-block-number' which could cause minor confusion. However, descriptions clarify their differences, and the majority of tools target specific actions like contract operations, account management, and transaction handling without significant ambiguity.

    Naming Consistency4/5

    Tool names follow a consistent verb-noun pattern with hyphens (e.g., 'get-account', 'send-transaction'), but there are minor deviations like 'call' and 'disconnect' that lack nouns. Overall, the naming is predictable and readable, with only a few tools breaking the pattern.

    Tool Count3/5

    With 28 tools, the count is borderline high for a wallet integration server, potentially feeling heavy. While it covers many blockchain operations, some tools like 'wait-seconds' seem peripheral, and the set might benefit from consolidation to reduce complexity without losing core functionality.

    Completeness5/5

    The tool set provides comprehensive coverage for MetaMask wallet and blockchain interactions, including account management, contract operations (deploy, read, write), transaction handling, gas estimation, and network utilities. There are no obvious gaps, and it supports full CRUD-like workflows for the domain.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI agents to interact with 30+ Ethereum-compatible blockchain networks, providing services like token transfers, contract interactions, and ENS resolution through a unified interface.
      28
      96 npm
      380
      MIT
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      Comprehensive Model Context Protocol server that enables AI agents to interact with 30+ Ethereum-compatible blockchain networks, supporting token transfers, smart contract interactions, and ENS name resolution through a unified interface.
      1
      -
    • A
      license
      C
      quality
      D
      maintenance
      A suite of MCP servers that allow LLMs to interact with blockchains through MetaMask wallet without exposing private keys, facilitating secure AI-powered blockchain interactions and simplified user onboarding.
      25
      4
      ISC