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. 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
Add this skill
npx mdskills install base/base-mcpComprehensive blockchain MCP server with extensive onchain capabilities and clear setup
1# Base MCP Server ๐ต2345[](https://www.npmjs.com/package/base-mcp)6[](https://opensource.org/licenses/MIT)78A 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.910## Overview1112This MCP server extends any MCP client's capabilities by providing tools to do anything on Base:1314- Retrieve wallet addresses15- List wallet balances16- Transfer funds between wallets17- Deploy smart contracts18- Interact with Morpho vaults for onchain lending19- Call contract functions20- Onramp funds via [Coinbase](https://www.coinbase.com/developer-platform/products/onramp)21- Manage ERC20 tokens22- List and transfer NFTs (ERC721 and ERC1155)23- Buy [OpenRouter](http://openrouter.ai/) credits with USDC24- Resolve Farcaster usernames to Ethereum addresses2526The server interacts with Base, powered by Base Developer Tools and [AgentKit](https://github.com/coinbase/agentkit).2728## Extending Base MCP with 3P Protocols, Tools, and Data Sources2930Base MCP is designed to be extensible, allowing you to add your own third-party protocols, tools, and data sources. This section provides an overview of how to extend the Base MCP server with new capabilities.3132### Adding New Tools3334If you want to add a new tool to the Base MCP server, follow these steps:35361. Create a new directory in the `src/tools` directory for your tool372. Implement the tool following the existing patterns:38 - `index.ts`: Define and export your tools. Tools are defined as AgentKit ActionProviders.39 - `schemas.ts`: Define input schemas for your tools40 - `types.ts`: Define types required for your tools41 - `utils.ts`: Utilities for your tools423. Add your tool to the list of available tools in `src/main.ts`434. Add documentation for your tool in the README.md445. Add examples of how to use your tool in examples.md456. Write tests for your tool4647### Project Structure4849The Base MCP server follows this structure for tools:5051```52src/53โโโ tools/54โ โโโ [TOOL_NAME]/ <-------------------------- ADD DIR HERE55โ โ โโโ index.ts (defines and exports tools)56โ โ โโโ schemas.ts (defines input schema)57โ โโโ utils/ (shared tool utilities)58```5960### Best Practices for Tool Development6162When developing new tools for Base MCP:6364- Follow the existing code style and patterns65- Ensure your tool has a clear, focused purpose66- Provide comprehensive input validation67- Include detailed error handling68- Write thorough documentation69- Add examples demonstrating how to use your tool70- Include tests for your tool7172For more detailed information on contributing to Base MCP, including adding new tools and protocols, see the [CONTRIBUTING.md](CONTRIBUTING.md) file.7374## Prerequisites7576- Node.js (v16 or higher)77- npm or yarn78- Coinbase API credentials (API Key Name and Private Key)79- A wallet seed phrase80- Coinbase Project ID (for onramp functionality)81- Alchemy API Key (required for NFT functionality)82- Optional: OpenRouter API Key (for buying OpenRouter credits)8384## Installation8586### Option 1: Install from npm (Recommended)8788```bash89# Install globally90npm install -g base-mcp9192# Or install locally in your project93npm install base-mcp94```9596Once the package is installed, you can configure clients with the following command:9798```bash99base-mcp --init100```101102### Option 2: Install from Source1031041. Clone this repository:105106 ```bash107 git clone https://github.com/base/base-mcp.git108 cd base-mcp109 ```1101112. Install dependencies:112113 ```bash114 npm install115 ```1161173. Build the project:118119 ```bash120 npm run build121 ```1221234. Optionally, link it globally:124 ```bash125 npm link126 ```127128## Configuration129130Create a `.env` file with your credentials:131132```133# Coinbase API credentials134# You can obtain these from the Coinbase Developer Portal: https://cdp.coinbase.com/135COINBASE_API_KEY_NAME=your_api_key_name136COINBASE_API_PRIVATE_KEY=your_private_key137138# Wallet seed phrase (12 or 24 words)139# This is the mnemonic phrase for your wallet140SEED_PHRASE=your seed phrase here141142# Coinbase Project ID (for onramp functionality)143# You can obtain this from the Coinbase Developer Portal144COINBASE_PROJECT_ID=your_project_id145146# Alchemy API Key (required for NFT functionality)147# You can obtain this from https://alchemy.com148ALCHEMY_API_KEY=your_alchemy_api_key149150# OpenRouter API Key (optional for buying OpenRouter credits)151# You can obtain this from https://openrouter.ai/keys152OPENROUTER_API_KEY=your_openrouter_api_key153154# Chain ID (optional for Base Sepolia testnet)155# Use 84532 for Base Sepolia testnet156# You do not have to include this if you want to use Base Mainnet157CHAIN_ID=your_chain_id158159# Neynar API Key (required for Farcaster functionality)160# You can obtain this from https://neynar.com161NEYNAR_API_KEY=your_neynar_api_key162```163164## Testing165166Test the MCP server to verify it's working correctly:167168```bash169npm test170```171172This script will verify that your MCP server is working correctly by testing the connection and available tools.173174## Examples175176See the [examples.md](examples.md) file for detailed examples of how to interact with the Base MCP tools through Claude.177178## Integration with Claude Desktop179180To add this MCP server to Claude Desktop:1811821. Create or edit the Claude Desktop configuration file at:183184 - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`185 - Windows: `%APPDATA%\Claude\claude_desktop_config.json`186 - Linux: `~/.config/Claude/claude_desktop_config.json`187188You can easily access this file via the Claude Desktop app by navigating to Claude > Settings > Developer > Edit Config.1891902. Add the following configuration:191192 ```json193 {194 "mcpServers": {195 "base-mcp": {196 "command": "npx",197 "args": ["-y", "base-mcp@latest"],198 "env": {199 "COINBASE_API_KEY_NAME": "your_api_key_name",200 "COINBASE_API_PRIVATE_KEY": "your_private_key",201 "SEED_PHRASE": "your seed phrase here",202 "COINBASE_PROJECT_ID": "your_project_id",203 "ALCHEMY_API_KEY": "your_alchemy_api_key",204 "PINATA_JWT": "your_pinata_jwt",205 "OPENROUTER_API_KEY": "your_openrouter_api_key",206 "CHAIN_ID": "optional_for_base_sepolia_testnet"207 },208 "disabled": false,209 "autoApprove": []210 }211 }212 }213 ```2142153. Restart Claude Desktop for the changes to take effect.216217## Available Tools218219### get-address220221Retrieves the address for your wallet.222223Example query to Claude:224225> "What's my wallet address?"226227### list-balances228229Lists all balances for your wallet.230231Example query to Claude:232233> "Show me my wallet balances."234235### transfer-funds236237Transfers funds from your wallet to another address.238239Parameters:240241- `destination`: The address to which to transfer funds242- `assetId`: The asset ID to transfer243- `amount`: The amount of funds to transfer244245Example query to Claude:246247> "Transfer 0.01 ETH to 0x1234567890abcdef1234567890abcdef12345678."248249### deploy-contract250251Deploys a smart contract to the blockchain.252253Parameters:254255- `constructorArgs`: The arguments for the contract constructor256- `contractName`: The name of the contract to deploy257- `solidityInputJson`: The JSON input for the Solidity compiler containing contract source and settings258- `solidityVersion`: The version of the solidity compiler259260Example query to Claude:261262> "Deploy a simple ERC20 token contract for me."263264### check-address-reputation265266Checks the reputation of an address.267268Parameters:269270- `address`: The Ethereum address to check271272Example query to Claude:273274> "What's the reputation of 0x1234567890abcdef1234567890abcdef12345678?"275276### get_morpho_vaults277278Gets the vaults for a given asset on Morpho.279280Parameters:281282- `assetSymbol`: Asset symbol by which to filter vaults (optional)283284Example query to Claude:285286> "Show me the available Morpho vaults for USDC."287288### call_contract289290Calls a contract function on the blockchain.291292Parameters:293294- `contractAddress`: The address of the contract to call295- `functionName`: The name of the function to call296- `functionArgs`: The arguments to pass to the function297- `abi`: The ABI of the contract298- `value`: The value of ETH to send with the transaction (optional)299300Example query to Claude:301302> "Call the balanceOf function on the contract at 0x1234567890abcdef1234567890abcdef12345678."303304### get_onramp_assets305306Gets the assets available for onramping in a given country/subdivision.307308Parameters:309310- `country`: ISO 3166-1 two-digit country code string representing the purchasing user's country of residence311- `subdivision`: ISO 3166-2 two-digit country subdivision code (required for US)312313Example query to Claude:314315> "What assets can I onramp in the US, specifically in New York?"316317### onramp318319Gets a URL for onramping funds via Coinbase.320321Parameters:322323- `amountUsd`: The amount of funds to onramp324- `assetId`: The asset ID to onramp325326Example query to Claude:327328> "I want to onramp $100 worth of ETH."329330### erc20_balance331332Gets the balance of an ERC20 token.333334Parameters:335336- `contractAddress`: The address of the ERC20 contract337338Example query to Claude:339340> "What's my balance of the token at 0x1234567890abcdef1234567890abcdef12345678?"341342### erc20_transfer343344Transfers an ERC20 token to another address.345346Parameters:347348- `contractAddress`: The address of the ERC20 contract349- `toAddress`: The address of the recipient350- `amount`: The amount of tokens to transfer351352Example query to Claude:353354> "Transfer 10 USDC to 0x1234567890abcdef1234567890abcdef12345678."355356### list_nfts357358Lists NFTs owned by a specific address.359360Parameters:361362- `ownerAddress`: The address of the owner whose NFTs to list363- `limit`: Maximum number of NFTs to return (default: 50)364365Example query to Claude:366367> "Show me the NFTs owned by 0x89A93a48C6Ef8085B9d07e46AaA96DFDeC717040."368369### transfer_nft370371Transfers an NFT to another address. Supports both ERC721 and ERC1155 standards.372373Parameters:374375- `contractAddress`: The address of the NFT contract376- `tokenId`: The token ID of the NFT to transfer377- `toAddress`: The address of the recipient378- `amount`: The amount to transfer (only used for ERC1155, default: 1)379380Example query to Claude:381382> "Transfer my NFT with contract 0x3F06FcF75f45F1bb61D56D68fA7b3F32763AA15c and token ID 56090175025510453004781233574040052668718235229192064098345825090519343038548 to 0x1234567890abcdef1234567890abcdef12345678."383384### buy_openrouter_credits385386Buys OpenRouter credits with USDC.387388Parameters:389390- `amountUsd`: The amount of credits to buy, in USD391392Example query to Claude:393394> "Buy $20 worth of OpenRouter credits."395396## Security Considerations397398- The configuration file contains sensitive information (API keys and seed phrases). Ensure it's properly secured and not shared.399- Consider using environment variables or a secure credential manager instead of hardcoding sensitive information.400- Be cautious when transferring funds or deploying contracts, as these operations are irreversible on the blockchain.401- When using the onramp functionality, ensure you're on a secure connection.402- Verify all transaction details before confirming, especially when transferring funds or buying credits.403404## Troubleshooting405406If you encounter issues:4074081. Check that your Coinbase API credentials are correct4092. Verify that your seed phrase is valid4103. Ensure you're on the correct network (Base Mainnet)4114. Check the Claude Desktop logs for any error messages412413## License414415[MIT License](LICENSE)416417## Contributing418419Contributions are welcome! Please feel free to submit a Pull Request.420421For detailed guidelines on contributing to Base MCP, including:422423- Reporting bugs424- Suggesting enhancements425- Development setup426- Coding standards427- **Adding new tools, protocols, and data sources** (see also the [Extending Base MCP](#extending-base-mcp-with-3p-protocols-tools-and-data-sources) section above)428- Testing requirements429- Documentation standards430431Please refer to our comprehensive [CONTRIBUTING.md](CONTRIBUTING.md) guide.432433Basic contribution steps:4344351. Fork the repository4362. Create your feature branch (`git checkout -b feature/amazing-feature`)4373. Commit your changes (`git commit -m 'Add some amazing feature'`)4384. Push to the branch (`git push origin feature/amazing-feature`)4395. Open a Pull Request440441Please make sure your code follows the existing style and includes appropriate tests.442
Full transparency โ inspect the skill content before installing.