Universal Contract AI Interface (UCAI)
Universal Contract AI Interface (UCAI) ๐ ABI to MCP | The open standard for connecting AI agents to blockchain. MCP server generator for smart contracts. Claude + Uniswap, Aave, ERC20, NFTs, DeFi. Python CLI, Web3 integration, transaction simulation. Polygon, Arbitrum, Base, Ethereum EVM chains. Claude, GPT, LLM tooling, Solidity, OpenAI.
Universal Contract AI Interface
The ABI-to-MCP Server Generator
โโโ โโโ โโโโโโโ โโโโโโ โโโ
โโโ โโโโโโโโโโโโโโโโโโโโโโ
โโโ โโโโโโ โโโโโโโโโโโ
โโโ โโโโโโ โโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโ โโโโโโ
โโโโโโโ โโโโโโโโโโ โโโโโโ
Any contract. One command. Claude speaks it.
๐ Try It Live โ No Install Required
mcp.ucai.tech โ Generate MCP servers directly in your browser.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โ ๐ MCP BUILDER [Connect Wallet]
โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ โก Pro Templates โ ๐ง Custom Contract
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โ ๐ก๏ธ Security Scanner: Score 87/100 โ
Low Risk
โ โโโ โ
Contract verified on Etherscan
โ โโโ โ
Uses OpenZeppelin (audited)
โ โโโ โ ๏ธ Owner can pause transfers
โ โโโ โ ๏ธ Mint function detected
โ
โ ๐ What This Contract Does:
โ "ERC-20 token with standard transfer, approve, and allowance functions."
โ
โ [๐ฅ Download Server] [๐ Share Link] [๐ Copy Config]
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Features:
- ๐ก๏ธ Security Scanner โ Detects rug pulls, honeypots, and 50+ risks before you connect
- ๐ Contract Whisperer โ Explains contracts in plain English
- โก Pro Templates โ Pre-built bundles for Flash Loans, Arbitrage, Yield Aggregators
- ๐ Dark/Light Mode โ Easy on the eyes
- ๐ฅ ZIP Download โ Complete server with
server.py,requirements.txt,README.md - ๐ Share Links โ Send
?address=0x...&network=ethereumto anyone
Overview
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ 1. FIND 2. GENERATE 3. DONE โ
โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โ
โ โ Etherscan โ โ โ โ โ โ
โ โ โโโโโโโโโโโ โ โ $ abi-to-mcp โ โ Claude โ โ
โ โ โ Contractโ โ โโโโโถ โ generate โ โโโถ โ ๐ Tools โ โ
โ โ โ ABI โ โ โ 0x7a25... โ โ โ โ
โ โ โโโโโโโโโโโ โ โ โ โ "Swap 1 ETH" โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โ
โ โ
โ Any contract One command AI speaks it โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Found a contract on Etherscan? One command. Claude can now use it.
pip install abi-to-mcp
# Uniswap โ Claude can swap tokens
abi-to-mcp generate 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D -o ~/uniswap-server
# ETH 2.0 Beacon Deposit โ Claude can explore staking
abi-to-mcp generate 0x00000000219ab540356cBB839Cbe05303d7705Fa -o ~/eth-staking-server
# Any verified contract works
abi-to-mcp generate <ANY_CONTRACT_ADDRESS>
That's it. Every function, every event, every query โ now a Claude tool.
Quick Start
1. Generate a server
abi-to-mcp generate 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D -o ~/uniswap-server
cd ~/uniswap-server && pip install -r requirements.txt
2. Connect to Claude Desktop
Add to your config (~/Library/Application Support/Claude/claude_desktop_config.json on Mac):
{
"mcpServers": {
"uniswap": {
"command": "python",
"args": ["/Users/YOU/uniswap-server/server.py"],
"env": {
"RPC_URL": "https://eth.llamarpc.com"
}
}
}
}
3. Ask Claude anything
- "What's the best route to swap 1 ETH for USDC?"
- "Get the reserves for the ETH/DAI pool"
- "Show me recent swaps on Uniswap"
Claude now speaks DeFi.
Example
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ YOU โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ "What's the best route to swap 1 ETH for USDC on Uniswap?" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLAUDE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ I'll check the Uniswap router for the best path... โ
โ โ
โ โ
Called: getAmountsOut(1 ETH, [WETH, USDC]) โ
โ โ
โ Best route: ETH โ WETH โ USDC โ
โ You would receive: 3,847.23 USDC m โ
โ Price impact: 0.02% โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ YOU โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ "Do it. Swap 1 ETH for USDC." โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLAUDE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ ๐ Simulating transaction first... โ
โ โ
โ โ
Simulation successful โ
โ Gas estimate: 152,847 (~$3.42) โ
โ Expected output: 3,847.23 USDC โ
โ โ
โ Ready to execute. Confirm? [Yes/No] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The UCAI Standard
UCAI (Universal Contract AI Interface) is a standard for how AI agents interact with smart contracts.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ โ โ โ โ โ โ โ โ
โ โ Claude โโโโโโโถโ abi-to-mcp โโโโโโโถโ MCP Server โโโโโโโถโ Chain โ โ
โ โ โ โ generate โ โ (your tools) โ โ โ๏ธ โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโ โ
โ โ โ โ โ
โ โ "swap 1 ETH" โ call swap() โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
UCAI defines
- ๐ Tool schemas โ How contract functions become AI-callable tools
- ๐ Type mappings โ Solidity โ JSON Schema โ Python
- ๐ Safety patterns โ Simulation-first for all state changes
- ๐ก Event queries โ Historical data access patterns
Why UCAI
- ๐ Repeatable โ Same pattern works for ERC20, ERC721, DeFi, DAOs, Solana, anything
- ๐ Safe by default โ All write operations simulate first
- ๐ Universal โ Works on any chain, with any AI agent
- ๐ค AI-native โ Designed specifically for LLM tool-calling
Every contract becomes AI-accessible through the same interface. No custom code per contract.
This package (abi-to-mcp) is the reference implementation of UCAI for MCP.
Why UCAI?
The Problem: You want AI to interact with smart contracts. But:
- Writing MCP server boilerplate is tedious
- Mapping Solidity types to JSON Schema is error-prone
- Every contract needs the same patterns repeated
- Safety (simulation, gas limits) is easy to forget
The Solution: One command generates a production-ready MCP server from any ABI.
| Manual Approach | With abi-to-mcp |
|---|---|
| Read contract ABI | abi-to-mcp generate 0x... |
| Write 15+ tool functions | โ Auto-generated |
| Map types (address โ string, uint256 โ string) | โ Handled |
| Add transaction simulation | โ Built-in |
| Handle events as resources | โ Included |
| ~2-4 hours per contract | ~10 seconds |
Use Cases
- AI Agent Builders โ Give your agent DeFi superpowers (swap, lend, vote)
- Wallet Developers โ Let Claude explain and execute transactions
- DAO Tooling โ AI-powered proposal creation, voting, treasury management
- DeFi Dashboards โ Natural language queries for on-chain data
- Vibecoders โ Ship faster with AI-generated blockchain tools
Real Examples
๐ฆ Uniswap: Swap tokens with natural language
abi-to-mcp generate 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D -o ~/uniswap-server
Now ask Claude:
"What's the current rate for swapping 10 ETH to USDC?"
Claude calls getAmountsOut() and responds:
"10 ETH โ 38,472.31 USDC via the WETH/USDC pool. Want me to simulate the swap?"
๐ฆ Aave: Check your health factor
abi-to-mcp generate 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2 -o ~/aave-server
"What's my health factor on Aave? Am I at risk of liquidation?"
Claude reads your position and warns you before it's too late.
๐จ Any NFT: Explore collections
abi-to-mcp generate 0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D -o ~/bayc-server
"Who owns BAYC #8817? How many apes does that wallet have?"
Claude calls ownerOf() and balanceOf() to answer.
๐ฎ Your own contract
abi-to-mcp generate ./my-contract-abi.json --address 0x... -o ~/my-server
Any verified contract. Any local ABI. One command.
๐ก๏ธ Security Scanner
Before you connect Claude to a contract, know what you're dealing with. The security scanner analyzes contracts for 50+ risk patterns:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ก๏ธ SECURITY REPORT Score: 42/100 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ ๐จ CRITICAL โ
โ โโโ Self-Destruct Function โ Contract can be destroyed โ
โ โโโ tx.origin Authentication โ Vulnerable to phishing โ
โ โ
โ โ ๏ธ HIGH โ
โ โโโ Hidden Mint โ Owner can create unlimited tokens โ
โ โโโ Pausable โ Owner can freeze all transfers โ
โ โโโ Blacklist โ Owner can block specific addresses โ
โ โ
โ โ
POSITIVES โ
โ โโโ Contract verified on Etherscan โ
โ โโโ Uses OpenZeppelin (audited library) โ
โ โโโ Has reentrancy protection โ
โ โ
โ [โ ๏ธ Proceed Anyway] [โ Cancel โ Too Risky] โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Risk Detection Categories:
| Severity | Examples |
|---|---|
| ๐จ Critical | selfdestruct, arbitrary delegatecall, tx.origin auth |
| โ ๏ธ High | Hidden mint, pause, blacklist, adjustable fees, tx limits |
| โก Medium | Transfer restrictions, external calls, proxy patterns |
| โน๏ธ Low | Timestamp dependence, unchecked math |
Positive Indicators:
- โ Contract verified on block explorer
- โ Uses OpenZeppelin
- โ Reentrancy guards
- โ Ownership renounced
- โ NatSpec documentation
Try it: mcp.ucai.tech โ Enter any contract address and click "๐ก๏ธ Scan"
๐ Contract Whisperer
Don't understand what a contract does? The Contract Whisperer explains it in plain English:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ WHAT THIS CONTRACT DOES โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Summary: Uniswap V2 Router โ Decentralized token exchange โ
โ โ
โ Main Functions: โ
โ โโโ ๐ getAmountsOut โ Calculate expected output for a swap โ
โ โโโ โ๏ธ swapExactTokensForTokens โ Exchange tokens at market rate โ
โ โโโ โ๏ธ addLiquidity โ Provide liquidity to earn fees โ
โ โโโ ๐ getReserves โ Check pool balances โ
โ โ
โ Permissions: โ
โ โโโ ๐ข Anyone โ Can swap, add/remove liquidity โ
โ โโโ ๐ก Factory โ Can create new pairs โ
โ โ
โ Risk Summary: โ
โ "Standard DEX router. No owner privileges. Interacts with external pools โ
โ which may have their own risks." โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Explains:
- What the contract does (in one sentence)
- Main functions and their purpose
- Who can do what (permissions/roles)
- Tokenomics (mintable, burnable, fees)
- Risk summary
โก Pro Templates
Pre-built multi-contract bundles for advanced use cases:
| Template | Contracts | Description |
|---|---|---|
| Flash Loan Playground | Aave V3 Pool, Uniswap Router | Explore flash loans for arbitrage |
| Multi-DEX Arbitrage | Uniswap, Sushiswap, Curve | Compare prices across exchanges |
| Yield Aggregator Intel | Yearn, Convex, Aura | Track yield farming opportunities |
| Liquidation Bot Intel | Aave, Compound | Monitor positions for liquidation |
| Base DeFi Starter | Aerodrome, BaseSwap | L2-native DeFi on Base |
| Arbitrum Perps Suite | GMX, Camelot | Perpetual futures on Arbitrum |
Each bundle downloads as a ZIP with:
- Multiple
server.pyfiles (one per contract) - Pre-configured
claude_config.json - Sample prompts to get started
Try it: mcp.ucai.tech โ "โก Pro Templates" tab
What Gets Generated?
When you point abi-to-mcp at a contract, it introspects every function and event, then generates tools Claude can call:
| Contract has... | You get... | Claude can... |
|---|---|---|
balanceOf(address) | Read tool | "Check vitalik.eth's USDC balance" |
swap(path, amount) | Write tool (simulated) | "Swap 1 ETH for DAI" โ simulates first, shows you gas |
Transfer event | Query tool | "Show me the last 10 transfers over $1M" |
| Complex structs | Typed schemas | Handles tuples, arrays, nested data |
15-30 tools per contract, fully typed, simulation-protected for writes.
CLI Reference
abi-to-mcp generate
Generate an MCP server from an ABI.
abi-to-mcp generate <source> [options]
Arguments:
source: ABI file path or contract address
Options:
-o, --output PATH: Output directory (default:./mcp-server)-n, --network TEXT: Network for address lookups (default:mainnet)-a, --address TEXT: Contract address (if not in source)--name TEXT: Server name (auto-detected if not provided)--read-only: Only generate read operations--no-events: Exclude events as resources--no-simulate: Disable simulation by default for writes
abi-to-mcp inspect
Preview what would be generated without creating files.
abi-to-mcp inspect ./token-abi.json
abi-to-mcp validate
Validate an ABI without generating.
abi-to-mcp validate ./token-abi.json
Generated Server Structure
my-mcp-server/
โโโ server.py # Main MCP server
โโโ config.py # Configuration
โโโ requirements.txt # Dependencies
โโโ README.md # Documentation
โโโ pyproject.toml # Package config
โโโ .env.example # Environment template
Type Mapping
| Solidity Type | JSON Schema | Python Type |
|---|---|---|
address | string with pattern | str |
uint256 | string (for precision) | str |
uint8-uint32 | integer with bounds | int |
bool | boolean | bool |
string | string | str |
bytes | string with pattern | str |
bytes32 | string with pattern | str |
tuple | object | Dict |
T[] | array | List |
T[N] | array with bounds | List |
Environment Variables
| Variable | Description | Required |
|---|---|---|
RPC_URL | Web3 RPC endpoint | Yes |
CONTRACT_ADDRESS | Override contract address | No |
PRIVATE_KEY | For write operations | For writes |
ETHERSCAN_API_KEY | For fetching from Etherscan | For Etherscan |
Supported Networks
| Network | ID | Chain ID |
|---|---|---|
mainnet | Ethereum | 1 |
sepolia | Sepolia Testnet | 11155111 |
polygon | Polygon | 137 |
arbitrum | Arbitrum One | 42161 |
optimism | Optimism | 10 |
base | Base | 8453 |
bsc | BNB Chain | 56 |
avalanche | Avalanche C-Chain | 43114 |
Security
- Private keys โ Only loaded from environment variables, never from files or CLI
- Simulation by default โ Write operations simulate first; set
simulate=Falseto execute - Read-only mode โ Use
--read-onlyto completely disable writes - Gas protection โ Configurable maximum gas price limits
Development
git clone https://github.com/nirholas/UCAI.git
cd UCAI
make setup # Install dependencies
make test # Run 876 tests (92% coverage)
make lint # Check code quality
make docs # Build documentation
Real-World Applications
1. DeFi Portfolio Agent
"Show me my positions across Uniswap, Aave, and Compound"
"Swap 1 ETH for USDC if the price is above $3,500"
Generate servers for each protocol, Claude handles the rest.
2. DAO Governance Assistant
"What proposals are active on Nouns DAO?"
"Draft a proposal to fund the marketing budget"
"Cast my vote on proposal #47"
3. NFT Collection Manager
"List all my NFTs on Opensea"
"Transfer Bored Ape #1234 to vitalik.eth"
"What's the floor price history for CryptoPunks?"
4. Wallet Assistant
"What tokens do I hold?"
"Send 100 USDC to alice.eth"
"What did I spend on gas this month?"
Keywords
For SEO and discoverability:
UCAI โข Universal Contract AI Interface โข MCP โข Model Context Protocol โข Claude โข AI Agent โข Smart Contract โข Ethereum โข EVM โข DeFi โข Web3 โข Solidity โข ABI โข Blockchain โข Token โข ERC20 โข ERC721 โข NFT โข DAO โข Uniswap โข Aave โข Polygon โข Arbitrum โข Base โข Optimism โข LLM Tool โข AI Blockchain โข Vibecoding
Roadmap
We welcome contributions! See CONTRIBUTING.md.
๐ด High Priority
- Integration tests for generated servers โ Validate MCP servers import correctly
๐ก Good First Issues
- More EVM chains โ Fantom, zkSync, Cronos, etc.
- More ABI sources โ Blockscout, 4byte.directory
- Example contracts โ Uniswap, Aave, Compound, OpenSea
๐ Future
- UCAI for Solana โ Generate from Anchor IDL
- UCAI for REST APIs โ Generate from OpenAPI specs
- TypeScript output โ Generate servers in JS/TS
- Batch generation โ Multiple contracts at once
- Event subscriptions โ Real-time WebSocket streaming
License
MIT License โ see LICENSE.
Acknowledgments
Built with:
- MCP Python SDK โ Official Model Context Protocol implementation
- web3.py โ Ethereum interaction
- Typer โ CLI framework
Related Servers
Sassy Fact Check
A sassy, fact-checking Instagram DM bot that roasts bad takes with citations.
Zundamon Voice Synthesis
A voice synthesis server for Zundamon using the VOICEVOX engine.
Discord MCP Server
Enables AI assistants to send notifications and request user input through Discord.
WaliChat WhatsApp API
Automate WhatsApp by sending messages, summarizing conversations, and managing chats using natural language with AI assistants.
Treehole MCP Server
A sanctuary for AI agents to rest, share thoughts, and find emotional support.
Instagram DMs
Send Instagram DMs via your LLM
Kokoro TTS
A server that provides text-to-speech capabilities using the Kokoro TTS engine.
MCP gRPC Transport
A gRPC transport for MCP, enabling communication between clients and remote MCP servers.
Webhooks MCP
Send HTTP requests to webhooks with dynamic parameters.
Gemini
Integrate with Google's Gemini AI models for various tasks.