Skip to content

feat: Add Model Context Protocol (MCP) support for AgentKit #731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

serayd61
Copy link

Description

This PR adds Model Context Protocol (MCP) support to AgentKit, enabling Claude Desktop and other MCP-compatible clients to interact with blockchain networks through AgentKit.

Motivation

  • Enables Claude users to perform blockchain operations natively
  • Creates a standard interface for AI-blockchain interactions
  • Expands AgentKit's reach to the Anthropic ecosystem
  • Addresses the Claude MCP framework support mentioned in WISHLIST.md

Changes

TypeScript Implementation (typescript/framework-extensions/mcp/)

  • Added @coinbase/agentkit-mcp package
  • Implemented MCP server with core AgentKit functionality
  • Added TypeScript types and error handling
  • Created comprehensive README with usage examples

Python Implementation (python/framework-extensions/mcp/)

  • Added coinbase-agentkit-mcp package
  • Implemented async MCP server compatible with Claude Desktop
  • Used modern Python packaging with pyproject.toml
  • Followed existing AgentKit patterns

Supported Tools

  • get_wallet_address - Get the current wallet address
  • get_balance - Get wallet balance for specific assets
  • transfer - Send tokens to another address

Testing

Tested locally with:

  • TypeScript build successful: npm run build
  • Python package installation: pip install -e .
  • Basic functionality verified

Documentation

  • Added comprehensive README files for both implementations
  • Included Claude Desktop configuration examples
  • Added development setup instructions

Next Steps

Future enhancements can include:

  • Additional AgentKit actions (swap, stake, deploy contracts)
  • Integration tests with Claude Desktop
  • More comprehensive error handling
  • Example conversations and use cases

Checklist

  • Code follows the project's style guidelines
  • Self-review of code completed
  • Documentation added
  • No breaking changes introduced
  • Follows existing patterns in the codebase

@serayd61 serayd61 requested a review from murrlincoln as a code owner May 27, 2025 16:43
@cb-heimdall
Copy link

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@github-actions github-actions bot added documentation Improvements or additions to documentation framework extension New framework extension python typescript labels May 27, 2025
@serayd61
Copy link
Author

Hello! First-time contributor here 😊

Added MCP support for AgentKit following the wishlist. Both TypeScript and Python implementations are ready.

Waiting for workflow approval. Let me know if you need any changes!

Copy link
Contributor

@CarsonRoscoe CarsonRoscoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @serayd61, thank you for the contribution! Approved workflows, please start by ensuring they pass

@serayd61
Copy link
Author

Thanks @CarsonRoscoe! I see there are some failing checks. I'll fix them right away:

  • Format issues in TypeScript
  • Package lock files need updating
  • Linting errors

Working on it now! 🛠️

serayd61 added 16 commits May 29, 2025 00:27
… files, Update pnpm-lock.yaml, Remove unnecessary setup.py.old file, Fix code style to pass CI checks
- Remove unnecessary 'any' type casting
- Add try-catch for better error handling
- Improve JSDoc documentation
- Add comprehensive test coverage for error cases
- Remove unnecessary 'any' type casting
- Add try-catch for better error handling in toolHandler
- Improve JSDoc documentation for interface
- Handle both Zod validation and invoke errors properly
- Update JSDoc to match interface types (unknown instead of any)
- Apply CI-required formatting to test file
- Ensure all lint rules are satisfied
- Add type definitions for @modelcontextprotocol/sdk
- Update tsconfig for proper type resolution
- Add ESLint configuration
- Update dependencies
- Rename MCP package to @coinbase/agentkit-mcp-server
- Exclude problematic example from workspace
- Update pnpm-lock.yaml
- MCP builds successfully
- Remove dependency on @modelcontextprotocol/sdk
- Use dynamic imports for AgentKit
- Simplify server implementation
@serayd61
Copy link
Author

serayd61 commented Jun 7, 2025

Hi @CarsonRoscoe! 👋

I've addressed all the CI issues:

  • ✅ Fixed TypeScript build errors
  • ✅ Updated all dependencies and lock files
  • ✅ All tests pass locally (559 tests!)
  • ✅ Fixed the MCP package configuration

The PR is ready for review but needs workflow approval to run the tests. Also, I noticed the branch is out-of-date with main - should I rebase/merge the latest changes?

Looking forward to your feedback! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation framework extension New framework extension python typescript
Development

Successfully merging this pull request may close these issues.

3 participants