The Base MCP Server provides onchain tools for AI applications like Claude Desktop and Cursor, enabling them to interact with the Base Network and Coinbase API. It unlocks capabilities like retrieving wallet addresses, managing funds, deploying smart contracts, and interacting with various protocols on the Base blockchain.
# Install globally
npm install -g base-mcp
# Or install locally in your project
npm install base-mcp
# Clone this repository
git clone https://github.com/base/base-mcp.git
cd base-mcp
# Install dependencies
npm install
# Build the project
npm run build
# Optionally, link it globally
npm link
Create a .env
file with your credentials:
# Coinbase API credentials
# You can obtain these from the Coinbase Developer Portal: https://cdp.coinbase.com/
COINBASE_API_KEY_NAME=your_api_key_name
COINBASE_API_PRIVATE_KEY=your_private_key
# Wallet seed phrase (12 or 24 words)
# This is the mnemonic phrase for your wallet
SEED_PHRASE=your seed phrase here
# Coinbase Project ID (for onramp functionality)
# You can obtain this from the Coinbase Developer Portal
COINBASE_PROJECT_ID=your_project_id
# OpenRouter API Key (optional for buying OpenRouter credits)
# You can obtain this from https://openrouter.ai/keys
OPENROUTER_API_KEY=your_openrouter_api_key
Test the MCP server to verify it's working correctly:
npm test
To add this MCP server to Claude Desktop:
Create or edit the Claude Desktop configuration file at:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
You can easily access this file via the Claude Desktop app by navigating to Claude > Settings > Developer > Edit Config.
Add the following configuration:
{
"mcpServers": {
"base-mcp": {
"command": "npx",
"args": ["base-mcp@latest"],
"env": {
"COINBASE_API_KEY_NAME": "your_api_key_name",
"COINBASE_API_PRIVATE_KEY": "your_private_key",
"SEED_PHRASE": "your seed phrase here",
"COINBASE_PROJECT_ID": "your_project_id",
"OPENROUTER_API_KEY": "your_openrouter_api_key"
},
"disabled": false,
"autoApprove": []
}
}
}
Retrieves the address for your wallet.
Example query to Claude: "What's my wallet address?"
Lists all balances for your wallet.
Example query to Claude: "Show me my wallet balances."
Transfers funds from your wallet to another address.
Parameters:
Example query to Claude: "Transfer 0.01 ETH to 0x1234567890abcdef1234567890abcdef12345678."
Deploys a smart contract to the blockchain.
Parameters:
Example query to Claude: "Deploy a simple ERC20 token contract for me."
Gets the vaults for a given asset on Morpho.
Parameters:
Example query to Claude: "Show me the available Morpho vaults for USDC."
Calls a contract function on the blockchain.
Parameters:
Example query to Claude: "Call the balanceOf function on the contract at 0x1234567890abcdef1234567890abcdef12345678."
Gets the assets available for onramping in a given country/subdivision.
Parameters:
Example query to Claude: "What assets can I onramp in the US, specifically in New York?"
Gets a URL for onramping funds via Coinbase.
Parameters:
Example query to Claude: "I want to onramp $100 worth of ETH."
Gets the balance of an ERC20 token.
Parameters:
Example query to Claude: "What's my balance of the token at 0x1234567890abcdef1234567890abcdef12345678?"
Transfers an ERC20 token to another address.
Parameters:
Example query to Claude: "Transfer 10 USDC to 0x1234567890abcdef1234567890abcdef12345678."
Buys OpenRouter credits with USDC.
Parameters:
Example query to Claude: "Buy $20 worth of OpenRouter credits."
If you encounter issues:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.