Quick Start Guide
Get Universal Crypto MCP up and running in under 5 minutes.
Installation
Install Universal Crypto MCP via pnpm:
Or using npm:
Configuration
Create a .env file in your project root:
# RPC Endpoints
ETHEREUM_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY
POLYGON_RPC_URL=https://polygon-mainnet.g.alchemy.com/v2/YOUR_KEY
# API Keys (optional)
COINGECKO_API_KEY=your_api_key
ETHERSCAN_API_KEY=your_api_key
.env file to version control. Add it to .gitignore.
Your First Script
Create a file index.ts:
import { UniversalCryptoMCP } from 'universal-crypto-mcp'
async function main() {
// Initialize the MCP server
const mcp = new UniversalCryptoMCP({
chain: 'ethereum',
provider: process.env.ETHEREUM_RPC_URL!,
})
// Get ETH price
const price = await mcp.market.getPrice('ethereum')
console.log(`Current ETH price: $${price}`)
// Get token balance
const balance = await mcp.wallet.getBalance(
'0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
'USDC'
)
console.log(`USDC Balance: ${balance}`)
// Get gas price
const gas = await mcp.chain.getGasPrice()
console.log(`Current gas price: ${gas} gwei`)
}
main()
Run it:
Expected output:
Using with Claude Desktop
Add Universal Crypto MCP to your Claude Desktop config:
{
"mcpServers": {
"universal-crypto": {
"command": "node",
"args": ["/path/to/universal-crypto-mcp/dist/index.js"],
"env": {
"ETHEREUM_RPC_URL": "your_rpc_url"
}
}
}
}
Restart Claude Desktop and try:
"What's the current price of Bitcoin?" "Check my ETH balance at 0x742d35..." "Show me gas prices across all chains"
Common Operations
Check Token Balance
Get Token Price
const price = await mcp.market.getPrice('ethereum')
const usdtPrice = await mcp.market.getPrice('tether')
Swap Tokens
const quote = await mcp.defi.getSwapQuote({
from: 'ETH',
to: 'USDC',
amount: '1',
chain: 'ethereum'
})
console.log(`1 ETH = ${quote.outputAmount} USDC`)
Check DeFi Position
const position = await mcp.defi.getPosition({
protocol: 'aave',
address: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'
})
console.log(`Supplied: ${position.supplied}`)
console.log(`Borrowed: ${position.borrowed}`)
Multi-Chain Support
Switch between chains easily:
// Ethereum
const ethMcp = new UniversalCryptoMCP({ chain: 'ethereum' })
// Polygon
const polyMcp = new UniversalCryptoMCP({ chain: 'polygon' })
// BSC
const bscMcp = new UniversalCryptoMCP({ chain: 'bsc' })
// Arbitrum
const arbMcp = new UniversalCryptoMCP({ chain: 'arbitrum' })
Error Handling
Always wrap calls in try-catch blocks:
try {
const balance = await mcp.wallet.getBalance(address, 'USDC')
console.log(`Balance: ${balance}`)
} catch (error) {
if (error.code === 'INVALID_ADDRESS') {
console.error('Invalid Ethereum address')
} else if (error.code === 'NETWORK_ERROR') {
console.error('Network connection failed')
} else {
console.error('Unknown error:', error.message)
}
}
Next Steps
Troubleshooting
Module Not Found
If you see Cannot find module 'universal-crypto-mcp':
RPC Connection Failed
Ensure your RPC URL is valid and accessible:
// Test connection
const mcp = new UniversalCryptoMCP({
chain: 'ethereum',
provider: process.env.ETHEREUM_RPC_URL!,
timeout: 5000, // 5 second timeout
})
await mcp.chain.getBlockNumber() // Should succeed
Rate Limiting
If you're hitting rate limits:
const mcp = new UniversalCryptoMCP({
chain: 'ethereum',
provider: process.env.ETHEREUM_RPC_URL!,
cache: true, // Enable caching
rateLimit: {
requests: 100,
window: 60000, // per minute
}
})
Getting Help
- Documentation: Full docs
- GitHub Issues: Report bugs
- Discord: Join our community
- Email: [email protected]