Polygon MCP 服务器是一个为 Claude AI 提供链上工具的 Model Context Protocol (MCP) 服务器,它能让 Claude AI 与 Polygon 权益证明区块链进行交互,为用户提供便捷的区块链操作体验。
在使用 Polygon MCP 服务器前,你需要完成安装和配置,然后就可以运行服务器并与 Claude 一起使用了。
git clone https://github.com/your-username/polygon-mcp.git
cd polygon-mcp
npm install
npm run build
在根目录下创建一个 .env 文件,包含以下变量:
SEED_PHRASE="你的12个单词的种子短语"
npm start
要将此 MCP 服务器与 Claude 一起使用,需要将其添加到您的 MCP 配置文件中:
{
"mcpServers": {
"polygon": {
"command": "node",
"args": ["/path/to/polygon-mcp/build/index.js"],
"env": {
"SEED_PHRASE": "你的12个单词的种子短语"
},
"disabled": false,
"autoApprove": []
}
}
}
{
"mcpServers": {
"polygon": {
"command": "node",
"args": ["/path/to/polygon-mcp/build/index.js"],
"env": {
"SEED_PHRASE": "你的12个单词的种子短语"
},
"disabled": false,
"autoApprove": []
}
}
}
调用 Polygon 权益证明区块链上的合约函数。
| 参数 | 详情 |
|---|---|
contractAddress |
要调用的合约地址 |
functionName |
要调用的函数名称 |
functionArgs |
函数的入参 |
abi |
合约的 ABI |
value (可选) |
与交易一起发送的 MATIC 价值 |
获取 Polygon 权益证明区块链上 ERC20 代币的余额。
| 参数 | 详情 |
|---|---|
contractAddress |
要获取余额的合约地址 |
在 Polygon 权益证明区块链上转移 ERC20 代币。
| 参数 | 详情 |
|---|---|
contractAddress |
转出代币的合约地址 |
toAddress |
收款人地址 |
amount |
转移的代币数量 |
查询 Polygon 权益证明区块链上的当前 gas 价格。
本项目采用 MIT 许可证。