Назад к каталогу
base-mcp

base-mcp

Сообщество

от base

0.0
0 отзывов

A Model Context Protocol (MCP) server that provides onchain tools for LLMs, allowing them to interact with the Base network and Coinbase API.

Установка

# Install globally

Описание

# Base MCP Server 🔵 ![OpenRouter Integration](public/OpenRouter.gif) [![npm version](https://img.shields.io/npm/v/base-mcp.svg)](https://www.npmjs.com/package/base-mcp) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 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](https://www.coinbase.com/developer-platform/products/onramp) - Manage ERC20 tokens - List and transfer NFTs (ERC721 and ERC1155) - Buy [OpenRouter](http://openrouter.ai/) credits with USDC - Resolve Farcaster usernames to Ethereum addresses The server interacts with Base, powered by Base Developer Tools and [AgentKit](https://github.com/coinbase/agentkit). ## Extending Base MCP with 3P Protocols, Tools, and Data Sources Base 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. ### Adding New Tools If you want to add a new tool to the Base MCP server, follow these steps: 1. Create a new directory in the `src/tools` directory for your tool 2. Implement the tool following the existing patterns: - `index.ts`: Define and export your tools. Tools are defined as AgentKit ActionProviders. - `schemas.ts`: Define input schemas for your tools - `types.ts`: Define types required for your tools - `utils.ts`: Utilities for your tools 3. Add your tool to the list of available tools in `src/main.ts` 4. Add documentation for your tool in the README.md 5. Add examples of how to use your tool in examples.md 6. Write tests for your tool ### Project Structure The Base MCP server follows this structure for tools: ``` src/ ├── tools/ │ ├── [TOOL_NAME]/ <-------------------------- ADD DIR HERE │ │ ├── index.ts (defines and exports tools) │ │ ├── schemas.ts (defines input schema) │ └── utils/ (shared tool utilities) ``` ### Best Practices for Tool Development When developing new tools for Base MCP: - Follow the existing code style and patterns - Ensure your tool has a clear, focused purpose - Provide comprehensive input validation - Include detailed error handling - Write thorough documentation - Add examples demonstrating how to use your tool - Include tests for your tool For more detailed information on contributing to Base MCP, including adding new tools and protocols, see the [CONTRIBUTING.md](CONTRIBUTING.md) file. ## 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) - Alchemy API Key (required for NFT functionality) - Optional: OpenRouter API Key (for buying OpenRouter credits) ## Installation ### Option 1: Install from npm (Recommended) ```bash # Install globally npm install -g base-mcp # Or install locally in your project npm install base-mcp ``` Once the package is installed, you can configure clients with the following command: ```bash base-mcp --init ``` ### Option 2: Install from Source 1. Clone this repository: ```bash git clone https://github.com/base/base-mcp.git cd base-mcp ``` 2. Install dependencies: ```bash npm install ``` 3. Build the project: ```bash npm run build ``` 4. Optionally, link it globally: ```bash npm link ``` ## Configuration 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 # Alchemy API Key (required for NFT functionality) # You can obtain this from https://alchemy.com ALCHEMY_API_KEY=your_alchemy_api_key # OpenRouter API Key (optional for buying OpenRouter credits) # You can obtain this from https://openrouter.ai/keys OPENROUTER_API_KEY=your_openrouter_api_key # Chain ID (optional for Base Sepolia testnet) # Use 84532 for Base Sepolia testnet # You do not have to include this if you want to use Base Mainnet CHAIN_ID=your_chain_id # Neynar API Key (required for Farcaster functionality) # You can obtain this from https://neynar.com NEYNAR_API_KEY=your_neynar_api_key ``` ## Testing Test the MCP ser

Отзывы (0)

Пока нет отзывов. Будьте первым!