Contract Inspector MCP
Allows configuration of API keys and RPC URLs through environment variables for secure credential management.
Enables retrieval of Ethereum contract information, executing view functions without parameters, and obtaining contract data by combining Etherscan and RPC data sources.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Contract Inspector MCP get the contract summary for 0xdac17f958d2ee523a2206206994597c13d831ec7"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Contract Inspector MCP Service
基于 MCP 协议的本地以太坊合约信息获取工具,支持在 Cursor 等 AI 工具中使用。采用 uv 作为现代化的 Python 项目管理工具。
重要说明:这是一个本地 MCP 服务,Cursor 会自动管理服务的启动和停止,无需用户手动启动服务器。
功能
🔍 获取 EVM 合约链上信息
📊 调用所有无参数 view 函数
🌐 整合 Etherscan 和 RPC 数据
⚡ 并发处理,性能优化
📋 标准 JSON 格式输出
Related MCP server: Web3 Assistant MCP
环境要求
Python 3.10+
uv 包管理器
快速开始
1. 安装 uv(如果尚未安装)
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# 或使用 pip
pip install uv2. 设置项目
# 克隆/进入项目目录
cd ContractInfoMCP
# 创建虚拟环境并安装所有依赖(一键搞定)
uv sync3. 配置环境
# 复制环境变量模板
cp env.example .env
# 编辑 .env 文件,填入您的 API keys
# 需要配置:
# - RPC_URL:您的以太坊 RPC 节点地址(如 Infura、Alchemy 等)
# - ETHERSCAN_API_KEY:您的 Etherscan API 密钥4. 完成配置
配置完成后,您只需要在 Cursor 中添加 MCP 配置即可。无需手动启动任何服务器,Cursor 会自动管理本地 MCP 服务的生命周期。
在 Cursor 中配置
在 Cursor 的 MCP 设置中添加以下配置。Cursor 会根据此配置自动启动和管理 MCP 服务。
请将 <project_path> 替换为您项目的实际绝对路径:
macOS/Linux 用户:
{
"mcpServers": {
"contract-inspector": {
"command": "<project_path>/.venv/bin/python",
"args": ["-m", "contract_inspector.main"],
"cwd": "<project_path>"
}
}
}Windows 用户:
{
"mcpServers": {
"contract-inspector": {
"command": "<project_path>/.venv/Scripts/python.exe",
"args": ["-m", "contract_inspector.main"],
"cwd": "<project_path>"
}
}
}路径配置说明
将 <project_path> 替换为您项目的实际绝对路径:
获取项目路径:
# 在项目目录中运行
pwd # macOS/Linux
echo %cd% # Windows CMD
echo $PWD # Windows PowerShell配置示例:
macOS/Linux:
/Users/username/Projects/ContractInfoMCPWindows:
C:\\Users\\username\\Projects\\ContractInfoMCP
使用示例
配置完成后,当您在 Cursor 中首次使用 MCP 工具时,Cursor 会自动启动本地服务。您可以直接在 Cursor 聊天中输入:
查询 0xdac17f958d2ee523a2206206994597c13d831ec7 地址的基本信息Cursor 会自动调用相应的 MCP 工具来处理您的请求。
MCP 工具
ContractInfo
功能:获取合约完整信息,调用所有不需要参数的 view 函数
参数:
contract_address(合约地址)输出:JSON 格式的合约信息和函数调用结果
ContractSummary
功能:获取合约基本摘要,不调用函数
参数:
contract_address(合约地址)输出:合约基本信息
项目结构
contract_inspector/
├── main.py # MCP 服务器入口
├── contract_analyzer.py # 核心分析逻辑
├── etherscan_client.py # Etherscan API
├── web3_client.py # Web3 RPC 客户端
├── config.py # 配置管理
└── utils.py # 工具函数故障排除
常见问题
"uv: command not found"
安装 uv:
pip install uv
"No solution found when resolving dependencies"
检查 Python 版本是否 >= 3.10
运行:
uv --version和python --version
"ModuleNotFoundError: No module named 'contract_inspector'"
这通常是Cursor没有使用正确的虚拟环境导致的,请执行以下步骤:
# 确保在项目目录中 cd <project_path> # 以可编辑模式重新安装包 uv pip install -e . # 验证模块可以正确导入 .venv/bin/python -c "import contract_inspector; print('模块导入成功')" # 获取正确的项目路径 pwd # 将输出的路径用于Cursor配置MCP 配置问题
确保 Cursor 配置文件中的
cwd路径正确指向项目根目录确保使用绝对路径而不是相对路径
检查虚拟环境中的Python可执行文件是否存在
如果 Cursor 无法启动 MCP 服务,检查配置文件语法是否正确
本地 MCP 服务无响应
检查
.env文件是否正确配置了 API 密钥查看 Cursor 的 MCP 日志获取详细错误信息
确认项目依赖已通过
uv sync正确安装
如何检查 MCP 服务状态
在 Cursor 中查看 MCP 连接状态(通常在设置或状态栏中显示)
如果需要调试,可以手动测试:
uv run python -c "import contract_inspector; print('模块可用')"查看 Cursor 的 MCP 日志文件以获取详细的错误信息
许可证
MIT License
Available Tools
2 toolscontract_infoA
获取 EVM 合约的完整链上信息,包括调用所有无参数的 view 函数
Args:
contract_address: EVM 合约地址 (0x开头的42位十六进制字符串)
Returns:
合约的详细信息,包括基础信息和所有view函数的调用结果
Inputs: contract_address (required).
contract_summaryB
获取合约基本摘要信息,不调用合约函数,快速获取合约概况
Args:
contract_address: EVM 合约地址 (0x开头的42位十六进制字符串)
Returns:
合约的基本摘要信息
Inputs: contract_address (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have overlapping purposes focused on retrieving EVM contract information, which creates some ambiguity. While contract_info provides detailed data including view function results and contract_summary offers a quicker overview, an agent might struggle to choose between them for basic needs. The descriptions help clarify the depth difference, but the core domain overlap remains.
Tool names follow a perfectly consistent pattern with clear verb_noun structure (contract_info, contract_summary). Both use snake_case and share the same prefix ('contract_'), making them predictable and easy to understand. There are no deviations or mixed conventions in the naming scheme.
With only 2 tools, the server feels under-scoped for a 'Contract Inspector' domain. While the tools cover information retrieval, there are obvious gaps in functionality like contract interaction, deployment, or verification. A typical contract inspection toolset would include more operations, making this count insufficient for comprehensive use.
The tool surface is severely incomplete for contract inspection. It only provides read-only information retrieval with no ability to interact with contracts (e.g., call functions with parameters, send transactions), verify source code, or manage deployments. This will cause significant agent failures when trying to perform common contract-related tasks beyond basic queries.
Related MCP Connectors
Read-only smart-contract security intelligence for autonomous agents.
Resolve any EVM contract ABI (even unverified, via decompilation), read, simulate, prepare txs.
EVM audit (Slither + source + security.txt + MCP-probe + wallet-exposure). 6 tools + /trace.
Read-only honeypot, holder and liquidity scam checks for tokens across 64 networks.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides comprehensive smart contract analysis for EVM tokens, including proxy contract detection, ownership chain discovery, and OpenZeppelin AccessControl role management across multiple blockchain networks.-
- FlicenseBqualityDmaintenanceEnables secure interaction with blockchain smart contracts across multiple chains, including ABI analysis, contract method invocation (view/nonpayable/payable), and local wallet management for Ethereum and Base networks.31-
- FlicenseNot gradedqualityDmaintenanceProvides tools for querying onchain data across 12+ blockchain networks, including token balances, transaction analysis, and smart contract security auditing. It enables users to interact with multiple EVM-compatible chains and perform deep contract evaluations through natural language interfaces.1-
- AlicenseAqualityDmaintenanceFetches verified EVM smart contract source code, scans for vulnerabilities, analyzes token holder distribution, and generates audit reports.5MIT