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 "Install 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 MCPget 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: Token Info MCP Server
环境要求
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函数的调用结果
| Name | Required | Description | Default |
|---|---|---|---|
| contract_address | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It mentions calling '所有无参数的 view 函数' (all parameterless view functions), which implies read-only behavior, but doesn't explicitly state whether this is a read operation, what permissions are needed, potential rate limits, or error conditions. For a tool that interacts with blockchain contracts without annotation coverage, this leaves significant behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and appropriately sized. It starts with the core purpose, then has clear 'Args' and 'Returns' sections. Every sentence adds value: the purpose statement, parameter explanation, and return description. It could be slightly more concise by combining the purpose and returns, but overall it's efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations, no output schema, and a single parameter with good description coverage, the description is moderately complete. It explains what the tool does and what it returns at a high level ('合约的详细信息,包括基础信息和所有view函数的调用结果' - detailed contract information including basic info and all view function call results). However, for a tool that presumably makes blockchain calls, it lacks details about network behavior, error handling, or response format specifics.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description provides excellent parameter semantics beyond the schema. The schema only shows 'contract_address' as a string with 0% description coverage. The description adds: 'EVM 合约地址 (0x开头的42位十六进制字符串)' (EVM contract address - 42-character hexadecimal string starting with 0x), which gives crucial format and validation details. This fully compensates for the schema's lack of description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: '获取 EVM 合约的完整链上信息,包括调用所有无参数的 view 函数' (Get complete on-chain information for EVM contracts, including calling all parameterless view functions). It specifies the verb ('获取' - get), resource ('EVM 合约' - EVM contract), and scope ('完整链上信息' - complete on-chain information). However, it doesn't explicitly distinguish from its sibling 'contract_summary', which likely provides less detailed information.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context through '完整链上信息' (complete on-chain information) and '所有无参数的 view 函数' (all parameterless view functions), suggesting this is for comprehensive analysis rather than a summary. However, it doesn't explicitly state when to use this tool versus 'contract_summary' or provide any exclusion criteria. The guidance is implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
contract_summaryB
获取合约基本摘要信息,不调用合约函数,快速获取合约概况
Args:
contract_address: EVM 合约地址 (0x开头的42位十六进制字符串)
Returns:
合约的基本摘要信息
| Name | Required | Description | Default |
|---|---|---|---|
| contract_address | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a read operation that doesn't call contract functions, which is helpful. However, it doesn't disclose important behavioral traits like whether this requires specific permissions, rate limits, error conditions, or what format the summary information will be returned in. For a tool with zero annotation coverage, this leaves significant gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately concise with clear sections (purpose, Args, Returns). The first sentence states the core purpose, and subsequent sections efficiently document parameters and returns. There's minimal wasted text, though the structure could be slightly more polished.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has no annotations, no output schema, and only one parameter, the description provides adequate basic information but has clear gaps. It explains the purpose and parameter format well, but doesn't describe what '合约的基本摘要信息' (basic contract summary information) actually contains or provide behavioral context about permissions, errors, or limitations. For a read-only tool, this is minimally viable but incomplete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful semantic context for the single parameter beyond what the schema provides. While the schema only shows 'contract_address' as a string, the description specifies it must be 'EVM 合约地址 (0x开头的42位十六进制字符串)' - an EVM contract address starting with 0x and 42 hexadecimal characters. This provides crucial format requirements not captured in the schema's 0% description coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states what the tool does ('获取合约基本摘要信息' - get basic contract summary information) with a specific verb and resource. It distinguishes from potential sibling operations by stating '不调用合约函数' (does not call contract functions), though it doesn't explicitly differentiate from the sibling 'contract_info' tool. The purpose is clear but lacks explicit sibling differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides some usage context by stating this is for '快速获取合约概况' (quickly get contract overview) and that it doesn't call contract functions. However, it doesn't explicitly state when to use this tool versus the sibling 'contract_info' tool or provide clear alternatives. The guidance is implied rather than explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
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.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
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.
Safety-first EVM and Bitcoin RPC tools for balances, contracts, blocks, and transactions
Etherscan Api - 71 tools for data, metrics, and on-chain analytics
Related MCP Servers
- AlicenseDqualityDmaintenanceA comprehensive toolkit for Ethereum blockchain analysis within Claude AI, enabling contract auditing, wallet analysis, profitability tracking, and on-chain data retrieval.112,01319MIT
- 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
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ACaiSec/ContractInfoMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server