Core Concepts
Model Context Protocol (MCP) AgentKit Extension
The Anthropic Model Context Protocol (MCP) is a standardized protocol designed to facilitate structured interactions between AI models and external tools or APIs. This extension integrates MCP with AgentKit, enabling AI agents to seamlessly perform onchain actions.
Why Use MCP with AgentKit?
Integrating MCP with AgentKit provides several key benefits:
- Standardized Protocol: MCP provides a structured, standardized way for AI models to interact with external tools, ensuring consistency and reliability.
- Onchain Capabilities: Enables AI agents to perform blockchain operations such as token transfers, smart contract interactions, and more.
- Flexible Integration: Easily integrates with existing agent workflows and infrastructure.
Installation
Install the required packages using npm:
Prerequisites
Before you begin, ensure you have the following:
- CDP API Key
- Node.js 18 or higher (install using nvm)
Check your Node.js version:
If needed, install the latest Node.js version:
Basic Usage
Here’s a basic example demonstrating how to set up an MCP server integrated with AgentKit:
Troubleshooting
Common Issues
Tool Execution Errors
If you encounter errors during tool execution, verify the following:
- Ensure your CDP API keys are correctly set in environment variables.
- Confirm that the requested tool is supported by your AgentKit instance.
- Check for sufficient funds or permissions for blockchain transactions.
MCP Server Connection Issues
If the MCP server fails to connect:
- Verify that the transport layer (stdio, HTTP, etc.) is correctly configured.
- Check for port conflicts or permissions issues if using network-based transports.
Debugging Tips
- Enable verbose logging in your MCP server setup to gain insights into request handling and errors.
- Use environment variables to toggle debug modes for detailed logs.