loading…
Search for a command to run...
loading…
Enables AI assistants to interact with the MIDL blockchain, supporting smart contract deployment, balance queries, asset bridging, Bitcoin Rune management, and
Enables AI assistants to interact with the MIDL blockchain, supporting smart contract deployment, balance queries, asset bridging, Bitcoin Rune management, and more through natural language.
Model Context Protocol server for MIDL Protocol — Bitcoin L1 + EVM L2 hybrid blockchain.
Bring AI-powered blockchain interaction to Claude Desktop, Cursor, and any MCP client.
The MIDL MCP Server brings full MIDL Protocol capabilities to your AI assistant. Install once, and Claude (or any MCP client) can:
All through natural conversation in Claude Desktop or Cursor.
| Category | Tools | Description |
|---|---|---|
| Network | 3 tools | Get network info, system contracts, block data |
| Balance | 3 tools | Query EVM balance, BTC balance, token balance |
| Transfer | 3 tools | Transfer EVM, transfer tokens, send raw transactions |
| Deploy | 1 tool | Compile and deploy Solidity contracts with templates |
| Contract | 3 tools | Read contracts, verify contracts, get event logs |
| Bridge | 2 tools | Bridge BTC↔EVM (deposit and withdrawal) |
| Runes | 4 tools | Rune balance, transfer, bridge to/from ERC20 |
| Bitcoin | 4 tools | UTXO queries, transaction tracking, fee rates |
| Utility | 3 tools | Convert units, lookup addresses, estimate gas |
https://mcp.midl-ai.xyz/mcpEach category is a self-contained plugin with its own tools. Easy to extend, easy to maintain.
Rich visual feedback with formatted HTML cards showing:
Secure transaction signing using MIDL_PRIVATE_KEY environment variable. No private keys exposed to the client.
# Clone repository
git clone https://github.com/midl-ai/mcp-server
cd midl-mcp-server
# Install dependencies
pnpm install
# Set up environment variables
cp .env.example .env
# Edit .env and add your MIDL_PRIVATE_KEY
# Build
pnpm build
# Test (optional)
pnpm test
Create a .env file:
# Required: Private key for signing transactions
MIDL_PRIVATE_KEY=0x...
# Optional: Custom RPC endpoint (defaults to staging)
MIDL_RPC_URL=https://rpc.staging.midl.xyz
# Optional: Network selection (mainnet or testnet)
MIDL_NETWORK=testnet
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"midl": {
"command": "node",
"args": [
"/absolute/path/to/midl-mcp-server/dist/index.js"
],
"env": {
"MIDL_PRIVATE_KEY": "your-private-key-here",
"MIDL_NETWORK": "testnet"
}
}
}
}
Important: Use absolute paths, not relative paths like ~/.
Add to .cursor/config.json in your project:
{
"mcpServers": {
"midl": {
"command": "node",
"args": [
"/absolute/path/to/midl-mcp-server/dist/index.js"
],
"env": {
"MIDL_PRIVATE_KEY": "your-private-key-here"
}
}
}
}
Restart Claude Desktop or Cursor after configuration.
Once installed, you can use natural language in Claude:
User: Deploy an ERC20 token called MyToken with symbol MTK and 1 million initial supply
Claude: I'll deploy that contract for you...
[Uses midl_deploy_contract tool]
Contract deployed at 0xabc...
User: What's my balance on MIDL?
Claude: Let me check both layers...
[Uses midl_get_btc_balance and midl_get_evm_balance]
Bitcoin L1: 1.5 BTC
EVM L2: 0.3 BTC
User: Bridge 0.1 BTC from L1 to L2
Claude: I'll initiate the bridge transaction...
[Uses midl_bridge_btc_to_evm]
Bridge initiated. Transaction ID: 0x...
Waiting for confirmations...
Complete! Your L2 balance has been updated.
User: Transfer 50 UNCOMMON•GOODS rune to kaspa:qr...
Claude: Transferring rune...
[Uses midl_transfer_rune]
Rune transferred. TX: abc123...
User: Read the totalSupply from the ERC20 at 0x123...
Claude: Reading contract...
[Uses midl_read_contract]
Total Supply: 1,000,000 tokens
midl-mcp-server/
├── src/
│ ├── plugins/ # All 9 plugin categories
│ │ ├── base/ # Base classes (PluginBase, ToolBase)
│ │ ├── network/ # 3 network tools
│ │ ├── balance/ # 3 balance tools
│ │ ├── transfer/ # 3 transfer tools
│ │ ├── deploy/ # 1 deploy tool + templates
│ │ ├── contract/ # 3 contract tools
│ │ ├── bridge/ # 2 bridge tools
│ │ ├── runes/ # 4 runes tools
│ │ ├── bitcoin/ # 4 bitcoin tools
│ │ └── utility/ # 3 utility tools
│ ├── ui/ # MCP UI card generators
│ │ ├── index.ts # Base card creators
│ │ ├── tx-cards.ts # Transaction cards
│ │ └── card-generators.ts # Maps tools to UI
│ ├── wallet.ts # EVM wallet client (viem)
│ ├── btc-wallet.ts # Bitcoin wallet client (@midl/node)
│ ├── config.ts # Constants and configuration
│ ├── types.ts # Shared TypeScript types
│ └── server.ts # MCP server entry point
├── dist/ # Built artifacts (generated)
├── tests/ # Unit tests
├── .env.example # Environment template
├── package.json # Dependencies
├── tsconfig.json # TypeScript config
└── vitest.config.ts # Test configuration
# Type check
pnpm typecheck
# Build for production
pnpm build
# Watch mode (rebuilds on changes)
pnpm build:watch
# Run all tests
pnpm test
# Watch mode
pnpm test:watch
# Coverage report
pnpm test:coverage
# Check for issues
pnpm lint
# Auto-fix
pnpm lint:fix
midl_get_network_info - Get chain ID, block height, RPC endpointsmidl_get_system_contracts - Query system contract addressesmidl_get_block - Fetch block data by number or hashmidl_get_evm_balance - Query EVM native balancemidl_get_btc_balance - Query Bitcoin UTXO balancemidl_get_token_balance - Query ERC20 token balancemidl_transfer_evm - Send native BTC on EVM L2midl_transfer_token - Send ERC20 tokensmidl_send_raw_transaction - Submit pre-signed transactionmidl_deploy_contract - Compile and deploy Solidity contractsTemplates:
erc20 - Standard fungible tokencounter - Simple counter contractstorage - Key-value storagemidl_read_contract - Call read-only contract methodsmidl_get_logs - Query contract event logsmidl_verify_contract - Verify contract on explorermidl_bridge_btc_to_evm - Deposit BTC from L1 to L2midl_bridge_evm_to_btc - Withdraw BTC from L2 to L1midl_get_runes - List all runesmidl_get_rune_balance - Check rune balancemidl_transfer_rune - Transfer runesmidl_bridge_rune_to_erc20 - Bridge rune to ERC20 tokenmidl_get_utxos - Query UTXOs for addressmidl_get_transaction - Get transaction detailsmidl_get_transaction_receipt - Get transaction receiptmidl_get_fee_rate - Get current fee ratemidl_convert_btc_to_evm - Convert BTC units to weimidl_get_rune_erc20_address - Lookup rune's ERC20 addressmidl_estimate_gas - Estimate gas for transactionEach plugin extends PluginBase and uses the @Tool decorator:
export class NetworkPlugin extends PluginBase {
@Tool({
name: 'midl_get_network_info',
description: 'Get MIDL network information',
inputSchema: networkInfoSchema,
readOnlyHint: true,
destructiveHint: false
})
async getNetworkInfo(): Promise<ToolResponse<NetworkInfo>> {
// Implementation
}
}
EVM Wallet (src/wallet.ts):
Bitcoin Wallet (src/btc-wallet.ts):
All tools return standardized responses:
type ToolResponse<T> = {
success: true;
data: T;
} | {
success: false;
error: string;
code?: ErrorCode;
};
Full TypeScript strict mode. No any types. All inputs validated with Zod schemas.
.env to version controlAll tool inputs are validated using Zod schemas before execution.
Issue: Claude Desktop can't connect to the MCP server
Solutions:
~/)dist/index.js exists (run pnpm build)Issue: "Invalid private key" error
Solutions:
0x0x)Issue: "Failed to connect to RPC" error
Solutions:
MIDL_RPC_URL is correctcurl https://rpc.staging.midl.xyzIssue: Tools return errors
Solutions:
We welcome contributions! Here's how:
git checkout -b feature/amazing-tool)ToolBase and use @Tool decoratorexecute() methodindex.tsMIT License - 100% open source.
Built for MIDL VibeHack 2026 hackathon (Feb 9-28, 2026).
Special thanks to:
Выполни в терминале:
claude mcp add midl-mcp-server -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.