关于 1scan - Blockchain Explorer API Gateway & MCP Server
1scan 将多个类 Etherscan 区块链浏览器 API 汇集到统一网关,并提供 AI 助手查询链上数据的 MCP 服务。适合需要从多条网络读取账户、交易、区块和合约信息的开发者。
主要功能
- 01统一访问多个浏览器 API
- 02API 负载均衡
- 03管理 API 速率限制
- 04通过 URL 参数指定 API 密钥
- 05提供链上数据查询工具
适用场景
- 01查询多条网络上的账户余额
- 02检查交易详情与区块信息
- 03读取代币转账及合约资料
MCP 相关
MCP 服务将区块链浏览器数据工具提供给 MCP 客户端,包括余额、交易、区块、代币和合约查询。支持 SSE 或 stdio 传输。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
http://localhost:3000/mcp/sseclaude mcp add --transport http 1scan http://localhost:3000/mcp/sse{"mcpServers":{"1scan":{"type":"http","url":"http://localhost:3000/mcp/sse"}}}在 Cursor 中打开{"servers":{"1scan":{"type":"http","url":"http://localhost:3000/mcp/sse"}}}在 VS Code 中打开{"mcpServers":{"1scan":{"type":"http","url":"http://localhost:3000/mcp/sse"}}}{"mcpServers":{"1scan":{"serverUrl":"http://localhost:3000/mcp/sse"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
工具
详细介绍
1scan - 区块链浏览器 API 网关与 MCP 服务
一个统一的 API 网关,可集成多个类似 etherscan 的区块链浏览器 API,并支持模型上下文协议(MCP),供 AI 助手使用。
概述
1scan 提供两个主要组件:
- API 网关:用于访问多个区块链浏览器 API 的统一端点
- MCP 服务:允许 AI 模型(例如 Cursor IDE 中的 Claude)直接查询区块链数据
支持的区块链网络
请向相应的区块链浏览器申请自己的 API 密钥
| 网络名称 | Chain ID | 浏览器链接 | 浏览器 API 端点 |
|---|---|---|---|
| Ethereum | 1 | https://etherscan.io | api.etherscan.io |
| Binance Smart Chain | 56 | https://bscscan.com | api.bscscan.com |
| Arbitrum One | 42161 | https://arbiscan.io | api.arbiscan.io |
| Polygon | 137 | https://polygonscan.com | api.polygonscan.com |
| Optimism | 10 | https://optimistic.etherscan.io | api-optimistic.etherscan.io |
| Avalanche C-Chain | 43114 | https://snowtrace.io | api.snowtrace.io |
| Base | 8453 | https://basescan.org | api.basescan.org |
| zkSync Era | 324 | https://explorer.zksync.io | block-explorer-api.mainnet.zksync.io |
| Gnosis | 100 | https://gnosisscan.io | api.gnosisscan.io |
| Fantom | 250 | https://ftmscan.com | api.ftmscan.com |
| Mantle | 5000 | https://mantlescan.info | api.mantlescan.info |
| Cronos | 25 | https://cronoscan.com | api.cronoscan.com |
| Polygon ZkEVM | 1101 | https://zkevm.polygonscan.com | api-zkevm.polygonscan.com |
| Linea | 59144 | https://lineascan.build | api.lineascan.build |
| Moonbeam | 1284 | https://moonscan.io | api.moonscan.io |
| Celo | 42220 | https://celoscan.io | api.celoscan.io |
| Scroll | 534352 | https://scrollscan.com | api.scrollscan.com |
| OpBNB | 204 | https://opbnbscan.com | api.opbnbscan.com |
| Moonriver | 1285 | https://moonriver.moonscan.io | api-moonriver.moonscan.io |
| Arbitrum Nova | 42170 | https://nova.arbiscan.io | api-nova.arbiscan.io |
| Blast | 81457 | https://blastscan.io | api.blastscan.io |
| Fraxtal | 252 | https://fraxscan.com | api.fraxscan.com |
| Wemix | 1111 | https://wemixscan.com | api.wemixscan.com |
| Xai | 660279 | https://xaiscan.io | api.xaiscan.io |
| World Chain | 480 | https://worldscan.org | api.worldscan.org |
| Ape | 33139 | https://apescan.io/ | api.apescan.io |
| Kroma | 255 | https://kromascan.com | api.kromascan.com |
| Taiko | 167000 | https://taikoscan.io | api.taikoscan.io |
| Bittorrent | 199 | https://bttcscan.com | api.bttcscan.com |
| Xdc | 50 | https://xdcscan.io | api.xdcscan.io |
功能
- 🔄 为多个区块链浏览器提供统一的 API 端点
- ⚖️ API 负载均衡
- 🔑 API 速率限制管理
- 🎯 通过 URL 参数支持自定义 API 密钥
- 🤖 MCP 服务,供 AI 助手查询区块链数据
安装
使用 Go 安装
go install github.com/huahuayu/1scan@latest
从源代码安装
# Clone the repository
git clone https://github.com/huahuayu/1scan.git
cd 1scan
# Build both 1scan API server and MCP server
make build
快速开始
1. 创建配置文件
创建一个 config.json 文件并填入你的 API 密钥:
{
"1": {
"endpoint": "api.etherscan.io",
"keys": {
"YOUR_ETHERSCAN_API_KEY_1": 5,
"YOUR_ETHERSCAN_API_KEY_2": 10
}
},
"56": {
"endpoint": "api.bscscan.com",
"keys": {
"YOUR_BSCSCAN_API_KEY": 5
}
}
}
每个链条目包含:
chainID:区块链网络 IDendpoint:区块链浏览器的 API 端点keys:API 密钥及其速率限制(每秒请求数)的映射
2. 运行 API 服务
# Run with default settings
1scan -config /path/to/config.json
# Or using make
make run-1scan
3. 运行 MCP 服务
# Run with default settings
1scanmcp -config /path/to/config.json # default serve at port 3000
# Or using make
make run-1scanmcp
# With custom settings
1scanmcp -config /path/to/config.json -port 3000 -path /mcp
与 Cursor IDE 集成
要在 Cursor IDE 中使用 1scan MCP:
-
启动 API 服务和 MCP 服务
# Terminal 1 make run-1scan # Terminal 2 make run-1scanmcp -
在 Cursor IDE 中,前往 Settings → AI → MCP Servers
-
添加一个新的 MCP 服务,并使用以下 URL:
{
"mcpServers": {
"1scan": {
"url": "http://localhost:3000/mcp/sse"
}
}
}
-
如有必要,重启 Cursor IDE
-
现在,你可以在 AI 对话中使用区块链数据:
Can you check the balance of address 0x742d35Cc6634C0532925a3b844Bc454e4438f44e on Ethereum?
MCP 服务配置
运行 MCP 服务时,可以使用以下参数进行自定义:
-port:MCP 服务运行的端口(默认值:"3000")-path:MCP 服务端点的路径(默认值:"/mcp")-config:配置文件的路径(默认值:"config.json")-transport:传输类型(sse 或 stdio)(默认值:"sse")
示例:
1scanmcp -port 3000 -config /path/to/config.json
可用的 MCP 工具
MCP 服务向 AI 模型提供以下工具:
getAccountBalance- 获取特定区块链上某个账户的余额getTokenBalance- 获取特定区块链上某个账户的代币余额getTransactionByHash- 根据哈希获取交易详情getBlockByNumber- 根据区块编号获取区块信息getContractABI- 获取已验证合约的 ABIgetContractSourceCode- 获取已验证合约的源代码getTokenInfo- 获取 ERC20 代币的信息getGasPrice- 获取特定区块链上的当前 Gas 价格getLogs- 获取符合指定参数的事件日志getTransaction- 根据交易哈希获取交易详情getTransactionCount- 获取从某个地址发出的交易数量getTransactionReceipt- 根据交易哈希获取交易回执getBlockTransactionCountByNumber- 获取某个区块中的交易数量getBlockTransactionCountByHash- 根据区块哈希获取某个区块中的交易数量getBlockByHash- 根据区块哈希获取区块信息getNormalTransactions- 根据地址获取普通交易getInternalTransactions- 根据地址或交易哈希获取内部交易getERC20Transfers- 根据地址或合约获取 ERC-20 代币转账事件getERC721Transfers- 根据地址或合约获取 ERC-721 NFT 转账事件getValidators- 获取验证者信息(适用于设有验证者集合的网络)getContractCreation- 获取合约创建信息getContractVerificationStatus- 检查合约验证状态
MCP 交互示例
以下是通过 MCP 接口与区块链数据交互的示例:
# Get account balance
What's the ETH balance of vitalik.eth (0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045) on Ethereum?
# Check a token balance
What's the USDC balance of address 0x28C6c06298d514Db089934071355E5743bf21d60 on Ethereum?
# Examine a transaction
Can you analyze transaction 0xdd6d7f687c9821404ae8c2ea7de5cfb5a23fc4c01ef1e7f535748cb147aa76dd on Ethereum?
# Look up block information
What transactions were in Ethereum block 18700000?
# Get contract ABI
Can you show me the ABI for the USDC contract (0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) on Ethereum?
# Analyze contract source code
I need to understand how the Uniswap V3 router works. Can you show me the source code for 0xE592427A0AEce92De3Edee1F18E0157C05861564 on Ethereum?
# Check multiple chains
What's the difference in gas fees between Ethereum and Arbitrum right now?
# Examine token information
Tell me about the tokenomics of the APE token on Ethereum.
MCP 工具完整列表
MCP 服务向 AI 模型提供以下工具:
getAccountBalance- 获取特定区块链上某个账户的余额getTokenBalance- 获取特定区块链上某个账户的代币余额getTransactionByHash- 根据哈希获取交易详情getBlockByNumber- 根据区块编号获取区块信息getContractABI- 获取已验证合约的 ABIgetContractSourceCode- 获取已验证合约的源代码getTokenInfo- 获取 ERC20 代币信息getGasPrice- 获取特定区块链上的当前 Gas 价格getLogs- 获取符合指定参数的事件日志getTransaction- 根据交易哈希获取交易详情getTransactionCount- 获取从某个地址发送的交易数量getTransactionReceipt- 根据交易哈希获取交易收据getBlockTransactionCountByNumber- 获取区块中的交易数量getBlockTransactionCountByHash- 根据区块哈希获取区块中的交易数量getBlockByHash- 根据区块哈希获取区块信息getNormalTransactions- 根据地址获取普通交易getInternalTransactions- 根据地址或交易哈希获取内部交易getERC20Transfers- 根据地址或合约获取 ERC-20 代币转账事件getERC721Transfers- 根据地址或合约获取 ERC-721 NFT 转账事件getValidators- 获取验证者信息(适用于具有验证者集的网络)getContractCreation- 获取合约创建信息getContractVerificationStatus- 检查合约验证状态
MCP 集成故障排除
如果你在从 Cursor 连接 MCP 服务时遇到问题:
-
确认两个服务都在运行:
# Check if servers are running ps aux | grep 1scanmcp -
确保在 Cursor 中配置了正确的 URL
许可证
MIT 许可证
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。