PortalMCP
Universal AI gateway that enables interaction with Ethereum blockchain through natural language across multiple AI platforms (Claude, ChatGPT, Gemini, etc.). Supports contract deployment, token operations, NFT minting, DeFi operations, and general blockchain transactions.
README
PortalMCP - Universal AI Gateway to Ethereum
A multi-platform AI integration layer for Ethereum blockchain. Works with Claude, ChatGPT, Gemini, LLaMA, Mistral, and any LangChain-supported model. Deploy contracts, swap tokens, mint NFTs, and more - all through natural language.
🌐 Supported AI Platforms
| Platform | Integration | Status |
|---|---|---|
| Claude Desktop | Native MCP | ✅ Full Support |
| ChatGPT | REST API / Custom GPT | ✅ Full Support |
| Cursor | Native MCP | ✅ Full Support |
| Windsurf | Native MCP | ✅ Full Support |
| OpenAI API | Function Calling | ✅ Full Support |
| Google Gemini | LangChain | ✅ Full Support |
| Mistral | LangChain | ✅ Full Support |
| Ollama | LangChain | ✅ Full Support |
| Any LLM | REST API | ✅ Full Support |
Architecture Overview
┌─────────────────┐
│ Claude/MCP │──── Native MCP Protocol
└────────┬────────┘
│
┌─────────────┐ ┌────────▼────────┐ ┌─────────────────┐
│ ChatGPT │───▶│ │───▶│ │
│ Gemini │ │ PortalMCP │ │ Ethereum │
│ Mistral │───▶│ │───▶│ Blockchain │
│ Ollama │ │ (Adapters) │ │ │
└─────────────┘ └─────────────────┘ └─────────────────┘
│ │
└── LangChain ──────┘
└── REST API ───────┘
PortalMCP bridges the gap between AI and blockchain, allowing you to perform complex Ethereum operations through simple natural language requests with ANY AI model.
Features
Contract Generation & Deployment
- Generate Solidity code via Claude
- Compile Solidity to bytecode
- Deploy to network (user signs via wallet)
Token Operations (ERC-20)
- Full ERC-20 creation flow
- Check token balances
- Transfer tokens
NFT Operations
- Deploy NFT contracts
- Mint NFTs
- Check NFT ownership
DeFi Operations
- Simple staking contracts
- Stake tokens
- DEX interactions
General Blockchain
- Get ETH balance
- Call any contract function
- Send transactions
Installation
Prerequisites
- Node.js v16 or higher
- npm or yarn
- An Ethereum wallet (MetaMask recommended)
- Access to Claude API
Setup
-
Clone the repository
git clone https://github.com/PortalFnd/portalmcp.git cd portalmcp -
Install dependencies
npm install -
Create a
.envfile based on.env.examplecp .env.example .env -
Add your API keys to the
.envfileANTHROPIC_API_KEY=your_claude_api_key INFURA_API_KEY=your_infura_key # or ALCHEMY_API_KEY=your_alchemy_key -
Build the project
npm run build -
Start the MCP server
npm start
Quick Start by Platform
🟣 Claude Desktop (Native MCP)
Add to claude_desktop_config.json (~/Library/Application Support/Claude/ on macOS):
{
"mcpServers": {
"portalmcp": {
"command": "node",
"args": ["/absolute/path/to/portalmcp/dist/index.js"],
"env": {
"ETHEREUM_NETWORK": "mainnet",
"INFURA_API_KEY": "your_infura_key",
"DEPLOYER_PRIVATE_KEY": "your_private_key"
}
}
}
}
🟢 ChatGPT (Custom GPT)
-
Start the REST API server:
npm run start:api -
Create a Custom GPT in ChatGPT
-
Add an Action with the OpenAPI spec from
http://localhost:3001/openapi.json -
For production, deploy to a public URL and use that instead
🔵 OpenAI Assistants API
import OpenAI from 'openai';
import { getOpenAITools, executeOpenAIToolCall } from 'portalmcp/adapters';
const openai = new OpenAI();
// Create assistant with Ethereum tools
const assistant = await openai.beta.assistants.create({
name: 'Ethereum Assistant',
model: 'gpt-4-turbo',
tools: getOpenAITools()
});
// Handle function calls
const result = await executeOpenAIToolCall('eth_get_balance', { address: '0x...' });
🟡 LangChain (Any LLM Provider)
import { getLangChainTools } from 'portalmcp/adapters';
import { ChatOpenAI } from '@langchain/openai';
import { ChatAnthropic } from '@langchain/anthropic';
import { ChatGoogleGenerativeAI } from '@langchain/google-genai';
const tools = getLangChainTools();
// Works with ANY provider!
const openai = new ChatOpenAI({ model: 'gpt-4-turbo' }).bindTools(tools);
const claude = new ChatAnthropic({ model: 'claude-3-opus' }).bindTools(tools);
const gemini = new ChatGoogleGenerativeAI({ model: 'gemini-pro' }).bindTools(tools);
🟠 REST API (Universal)
# Start server
npm run start:api
# Check balance
curl http://localhost:3001/eth/balance/0x742d35Cc6634C0532925a3b844Bc9e7595f...
# Swap tokens
curl -X POST http://localhost:3001/swap \
-H "Content-Type: application/json" \
-d '{"tokenIn":"ETH","tokenOut":"USDT","amount":"0.01"}'
# Get OpenAPI spec (for any integration)
curl http://localhost:3001/openapi.json
Note: Replace paths and keys with your actual values. For testnet development, change
ETHEREUM_NETWORKtosepolia.
Example Conversations
Creating a Token
User: "Create an ERC-20 token called 'MyToken' with symbol 'MTK' and supply of 1 million"
Claude (using MCP tools):
- Uses
eth_generate_contractto create Solidity code - Shows you the code for review
- Uses
eth_deploy_contractafter your approval - Returns contract address and details
Checking Balances
User: "What's my USDC balance on Ethereum?"
Claude: Uses eth_get_token_balance and responds: "Your USDC balance is 1,250.50 USDC"
NFT Creation
User: "Deploy an NFT collection called 'Digital Art' and mint token #1 to my address"
Claude:
- Uses
eth_create_nft_collection - Uses
eth_mint_nft - Provides transaction hashes and opensea links
Security Model
- Non-custodial: Never handle private keys
- User approval: All transactions require user wallet signature
- Code review: Show generated contracts before deployment
- Network isolation: Support testnets for development
Available MCP Tools
Contract Operations
eth_generate_contract- Generate Solidity code via Claudeeth_compile_contract- Compile Solidity to bytecodeeth_deploy_contract- Deploy to network
Token Operations
eth_create_token- Create ERC-20 tokeneth_get_token_balance- Check token balanceeth_transfer_token- Transfer tokens
NFT Operations
eth_create_nft_collection- Create NFT collectioneth_mint_nft- Mint NFTeth_get_nft_owner- Check NFT ownership
DeFi Operations
eth_create_staking_contract- Create staking contracteth_stake_tokens- Stake tokenseth_swap_tokens- Swap tokens on DEX
General Operations
eth_get_balance- Get ETH balanceeth_call_contract- Call contract functioneth_send_transaction- Send transaction
Security
⚠️ Important Security Notes:
- Never commit your
.envfile - It contains sensitive API keys and private keys - Use testnets first - Always test on Sepolia before mainnet
- Review transactions - Always review transaction details before signing
- Private key safety - The
DEPLOYER_PRIVATE_KEYgives full control over that wallet
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。