UCAI — ABI-to-MCP Server Generator
UCAI (Universal Contract AI Interface) turns any smart contract ABI into a ready-to-use MCP server. One command — any contract on any EVM chain — and your AI agent can interact with it.
The Concept
Smart Contract ABI (JSON)
│
▼
UCAI CLI
│
▼
MCP Server with tools for every function
│
▼
AI Agent calls contract functions naturally:
"What's the total supply of this ERC20?"
"How much can I borrow on Aave?"
Quick Start
Install
pip install abi-to-mcp
Generate MCP Server
# From a verified contract on Etherscan
ucai generate 0xD74f5255D557944cf7Dd0E45FF521520002D5748 --chain arbitrum
# From a local ABI file
ucai generate ./my-contract-abi.json --chain ethereum
# From a well-known protocol
ucai generate uniswap-v3-router --chain ethereum
Use with Claude Desktop
{
"mcpServers": {
"my-contract": {
"command": "ucai",
"args": ["serve", "0xD74f5255D557944cf7Dd0E45FF521520002D5748", "--chain", "arbitrum"]
}
}
}
How It Works
- ABI Parsing — Reads contract ABI (from Etherscan, local file, or known protocol)
- Tool Generation — Creates one MCP tool per contract function
- Type Mapping — Solidity types → JSON Schema types
- Read/Write Split — Read functions (view/pure) are safe; write functions need signing
- Documentation — Auto-generates descriptions from function signatures and NatSpec
Generated Tool Example
For a function like:
function balanceOf(address account) external view returns (uint256)
UCAI generates:
{
"name": "balanceOf",
"description": "Get the token balance of an account",
"parameters": {
"account": { "type": "string", "description": "The account address (address)" }
}
}
Supported Chains
| Chain | Explorer | Auto-ABI Fetch |
|---|---|---|
| Ethereum | Etherscan | ✅ |
| Arbitrum | Arbiscan | ✅ |
| Base | Basescan | ✅ |
| Polygon | Polygonscan | ✅ |
| BSC | BscScan | ✅ |
| Optimism | Optimistic Etherscan | ✅ |
| Avalanche | Snowtrace | ✅ |
Security Scanner
UCAI includes a built-in security scanner that checks:
| Check | What It Does |
|---|---|
| Reentrancy | Detects reentrancy vulnerabilities |
| Unlimited Approvals | Flags functions requesting unlimited token approvals |
| Admin Functions | Identifies privileged/owner-only functions |
| Proxy Patterns | Detects upgradeable proxy contracts |
| Self-Destruct | Flags contracts with selfdestruct capability |
ucai scan 0x... --chain ethereum
Web Builder
For non-developers, UCAI provides a web interface at mcp.ucai.tech:
- Paste contract address
- Select chain
- Click "Generate"
- Download MCP server config
Common Recipes
ERC-20 Token Tools
ucai generate 0x... --chain arbitrum
# → balanceOf, totalSupply, transfer, approve, allowance, etc.
Aave V3 Lending
ucai generate aave-v3-pool --chain arbitrum
# → supply, borrow, repay, withdraw, getUserAccountData, etc.
Sperax USDs
ucai generate 0xD74f5255D557944cf7Dd0E45FF521520002D5748 --chain arbitrum
# → balanceOf, totalSupply, mint, redeem, getCollateralRatio, etc.
The UCAI Standard
UCAI defines a standard for mapping Solidity ABIs to MCP tool definitions:
- Every
view/purefunction → read-only MCP tool - Every state-changing function → write MCP tool (requires signing)
- Events → subscription tools (where supported)
- Structs → nested JSON Schema objects
Links
- PyPI: https://pypi.org/project/abi-to-mcp/
- Web Builder: https://mcp.ucai.tech
- GitHub: https://github.com/nirholas/UCAI
- Docs: https://docs.ucai.tech
- Anthropic MCP Registry: https://registry.modelcontextprotocol.io