Base MCP Server
local-only server
The server can only run on the client’s local machine because it depends on local resources.
Integrations
Base MCP Server 🔵
A Model Context Protocol (MCP) server that provides onchain tools for AI applications like Claude Desktop and Cursor, allowing them to interact with the Base Network and Coinbase API.
Overview
This MCP server extends any MCP client's capabilities by providing tools to do anything on Base:
- Retrieve wallet addresses
- List wallet balances
- Transfer funds between wallets
- Deploy smart contracts
- Interact with Morpho vaults for onchain lending
- Call contract functions
- Onramp funds via Coinbase
- Manage ERC20 tokens
- Buy OpenRouter credits with USDC
The server interacts with Base, powered by Base Developer Tools and AgentKit.
Prerequisites
- Node.js (v16 or higher)
- npm or yarn
- Coinbase API credentials (API Key Name and Private Key)
- A wallet seed phrase
- Coinbase Project ID (for onramp functionality)
- Optional: OpenRouter API Key (for buying OpenRouter credits)
Installation
Option 1: Install from npm (Recommended)
Option 2: Install from Source
- Clone this repository:Copy
- Install dependencies:Copy
- Build the project:Copy
- Optionally, link it globally:Copy
Configuration
Create a .env
file with your credentials:
Testing
Test the MCP server to verify it's working correctly:
This script will verify that your MCP server is working correctly by testing the connection and available tools.
Examples
See the examples.md file for detailed examples of how to interact with the Base MCP tools through Claude.
Integration with Claude Desktop
To add this MCP server to Claude Desktop:
- Create or edit the Claude Desktop configuration file at:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
- Add the following configuration:Copy
- Restart Claude Desktop for the changes to take effect.
Available Tools
get-address
Retrieves the address for your wallet.
Example query to Claude:
"What's my wallet address?"
list-balances
Lists all balances for your wallet.
Example query to Claude:
"Show me my wallet balances."
transfer-funds
Transfers funds from your wallet to another address.
Parameters:
destination
: The address to which to transfer fundsassetId
: The asset ID to transferamount
: The amount of funds to transfer
Example query to Claude:
"Transfer 0.01 ETH to 0x1234567890abcdef1234567890abcdef12345678."
deploy-contract
Deploys a smart contract to the blockchain.
Parameters:
constructorArgs
: The arguments for the contract constructorcontractName
: The name of the contract to deploysolidityInputJson
: The JSON input for the Solidity compiler containing contract source and settingssolidityVersion
: The version of the solidity compiler
Example query to Claude:
"Deploy a simple ERC20 token contract for me."
get_morpho_vaults
Gets the vaults for a given asset on Morpho.
Parameters:
assetSymbol
: Asset symbol by which to filter vaults (optional)
Example query to Claude:
"Show me the available Morpho vaults for USDC."
call_contract
Calls a contract function on the blockchain.
Parameters:
contractAddress
: The address of the contract to callfunctionName
: The name of the function to callfunctionArgs
: The arguments to pass to the functionabi
: The ABI of the contractvalue
: The value of ETH to send with the transaction (optional)
Example query to Claude:
"Call the balanceOf function on the contract at 0x1234567890abcdef1234567890abcdef12345678."
get_onramp_assets
Gets the assets available for onramping in a given country/subdivision.
Parameters:
country
: ISO 3166-1 two-digit country code string representing the purchasing user's country of residencesubdivision
: ISO 3166-2 two-digit country subdivision code (required for US)
Example query to Claude:
"What assets can I onramp in the US, specifically in New York?"
onramp
Gets a URL for onramping funds via Coinbase.
Parameters:
amountUsd
: The amount of funds to onrampassetId
: The asset ID to onramp
Example query to Claude:
"I want to onramp $100 worth of ETH."
erc20_balance
Gets the balance of an ERC20 token.
Parameters:
contractAddress
: The address of the ERC20 contract
Example query to Claude:
"What's my balance of the token at 0x1234567890abcdef1234567890abcdef12345678?"
erc20_transfer
Transfers an ERC20 token to another address.
Parameters:
contractAddress
: The address of the ERC20 contracttoAddress
: The address of the recipientamount
: The amount of tokens to transfer
Example query to Claude:
"Transfer 10 USDC to 0x1234567890abcdef1234567890abcdef12345678."
buy_openrouter_credits
Buys OpenRouter credits with USDC.
Parameters:
amountUsd
: The amount of credits to buy, in USD
Example query to Claude:
"Buy $20 worth of OpenRouter credits."
Security Considerations
- The configuration file contains sensitive information (API keys and seed phrases). Ensure it's properly secured and not shared.
- Consider using environment variables or a secure credential manager instead of hardcoding sensitive information.
- Be cautious when transferring funds or deploying contracts, as these operations are irreversible on the blockchain.
- When using the onramp functionality, ensure you're on a secure connection.
- Verify all transaction details before confirming, especially when transferring funds or buying credits.
Troubleshooting
If you encounter issues:
- Check that your Coinbase API credentials are correct
- Verify that your seed phrase is valid
- Ensure you're on the correct network (Base Mainnet)
- Check the Claude Desktop logs for any error messages
License
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Please make sure your code follows the existing style and includes appropriate tests.
This server cannot be installed
Provides onchain tools for Claude AI to interact with the Base blockchain and Coinbase API, enabling wallet management, fund transfers, and smart contract deployment.
- Overview
- Prerequisites
- Installation
- Configuration
- Testing
- Examples
- Integration with Claude Desktop
- Available Tools
- Security Considerations
- Troubleshooting
- License
- Contributing