The XMTP MCP Server enables AI agents to interact with the XMTP decentralized messaging network for secure, real-time communication.
Connect to XMTP Network: Initialize secure connection using wallet private key across production, development, or local environments
Send Encrypted Messages: Dispatch secure messages to any XMTP-enabled wallet address or ENS name
Retrieve Message History: Fetch past conversation messages with customizable limits
Manage Conversations: List and manage all active conversations
Real-time Message Streaming: Stream incoming messages across all conversations as they arrive
Address Validation: Verify if wallet addresses can receive XMTP messages
XMTP MCP Server
A Model Context Protocol server that enables AI agents to interact with the XMTP decentralized messaging network.
Features
- 🔐 Secure Connection: Initialize XMTP client with wallet authentication
- 📨 Send Messages: Send encrypted messages to any XMTP-enabled wallet address
- 📬 Receive Messages: Retrieve message history from conversations
- 💬 Conversation Management: List and manage conversations
- 🔄 Real-time Streaming: Stream new messages as they arrive
- ✅ Address Validation: Check if addresses can receive XMTP messages
Installation
Option 1: NPM Package (Recommended)
The easiest way to use the XMTP MCP Server is via npm:
Alternative: Local Project Installation
Option 2: From Source (Development)
For development or customization:
Configuration
Environment Setup
- For npm installation: Create a
.env
file in your working directory:
- For source installation: Copy the included template:
- Configure your wallet:
Wallet Activation
⚠️ Important: Before using the MCP server, wallets must be activated on XMTP:
- Visit xmtp.chat or use Coinbase Wallet
- Import your wallet using the private key from your
.env
file - Send a test message to activate your XMTP identity
- The wallet is now ready for use with the MCP server
Development Wallets: Use the pre-activated test wallets in .env.development
for immediate testing.
Claude Code Integration
Quick Setup (Recommended)
After installing the npm package globally:
Note: Make sure you have a .env
file in your current directory with your wallet configuration.
Alternative Setup Methods
With Environment Variables
Using Local npm Installation
From Source Build
Manual Configuration (claude.json)
Alternative with Node.js:
API Reference
Tools
Tool | Description | Parameters |
---|---|---|
connect_xmtp | Connect to XMTP network | privateKey? , environment? |
send_message | Send message to address | recipient , message |
get_messages | Get conversation messages | address , limit? |
list_conversations | List all conversations | none |
check_can_message | Check if address can receive messages | address |
stream_messages | Stream new messages in real-time | callback? |
Resources
Resource | Description |
---|---|
xmtp://conversations | JSON list of all conversations |
xmtp://inbox | JSON list of recent inbox messages |
Examples
Basic Usage
Error Handling
The server includes comprehensive error handling:
- Connection failures
- Invalid addresses
- Network timeouts
- Malformed requests
Development
Development Setup
Build Process
Development Workflow
- Make changes in
src/index.ts
- Test locally with
npm run dev
- Build with
npm run build
- Test build with
npm start
- Update Claude MCP if needed:
Project Structure
Build Scripts
Script | Purpose | Command |
---|---|---|
build | Compile TypeScript | tsc |
dev | Development server | tsx --env-file .env src/index.ts |
start | Production server | node dist/index.js |
clean | Remove build artifacts | rm -rf dist |
lint | Code quality check | eslint src --ext .ts |
format | Code formatting | prettier --write src/**/*.ts |
Testing Locally
Publishing Updates
Security
- ✅ Private keys stored in environment variables only
- ✅ End-to-end encrypted messages via XMTP protocol
- ✅ No sensitive data logged or persisted locally
- ✅ Proper input validation and sanitization
Requirements
- Node.js: 20+
- XMTP Network: Active internet connection
- Wallet: Private key for XMTP-compatible wallet
Network Support
Environment | Description | URL |
---|---|---|
production | XMTP Mainnet | grpc.production.xmtp.network:443 |
dev | XMTP Testnet | grpc.dev.xmtp.network:443 |
local | Local Development | localhost:5556 |
Network Configuration
Default Environment
- Important: XMTP client defaults to
dev
network environment - Use
environment
parameter inconnect_xmtp
to specify network:- Production network:
environment: "production"
- Development network:
environment: "dev"
(default)
- Production network:
Wallet Activation
Critical: Fresh wallets must be activated on the XMTP network before they can send messages:
- Network-Specific Activation: Wallets can connect to any network but need separate activation per network
- Activation Process:
- Connect to xmtp.chat with your wallet
- Send a message on the desired network (dev or production)
- This establishes your XMTP identity on that specific network
Testing: Use pre-activated wallets from .env.development
for immediate development.
Known Issues
canMessage API & Wallet Activation
Status: 🐛 Active Issue - Resolved ✅
Root Cause: Wallets need proper activation on each XMTP network.
Investigation Results:
- ✅ Default Network: Confirmed XMTP defaults to
dev
network - ✅ Signer Interface: Fixed
getChainId()
to returnbigint
instead ofnumber
- ✅ Case Sensitivity: Implemented fallback for address case variations
- ⚠️ Wallet Activation: Test wallets require activation via xmtp.chat
Fixed Issues:
- Connection interface properly implemented
- Case sensitivity handling in canMessage checks
- Network environment configuration corrected
Remaining Action: Activate test wallets on desired network via xmtp.chat
Troubleshooting
Installation Issues
Package not found on npm
Permission errors during global install
Command not found after global install
CLI shows server output instead of version
This is expected behavior. The xmtp-mcp-server
command starts the MCP server immediately and communicates via stdio. Use which xmtp-mcp-server
or npm list -g @kwaude/xmtp-mcp-server
to verify installation.
Configuration Issues
Environment file not found
Invalid private key format
Connection Issues
XMTP connection failed
Address not on XMTP network
- Activate wallet via xmtp.chat
- Send test message to establish XMTP identity
- Use development wallets from
.env.development
for testing
MCP server not connecting to Claude
Development Issues
TypeScript compilation errors
Module not found errors
Getting Help
- Check existing issues: GitHub Issues
- Create new issue: Provide error logs and environment details
- Discord support: Join XMTP Discord for community help
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Links
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Enables AI agents to interact with the XMTP decentralized messaging network. Supports sending encrypted messages, managing conversations, and streaming real-time messages to any XMTP-enabled wallet address.
Related MCP Servers
- -securityFlicense-qualityAn MCP server that exposes the XTB trading API, allowing users to interact with their XTB trading accounts through the Model Context Protocol to perform operations like account management, market data retrieval, and trade execution.Last updated -11
- AsecurityAlicenseAqualityAn MCP server that integrates the XTQuant quantitative trading platform with AI assistants, allowing AI to directly access and operate on trading data and functionality.Last updated -891MIT License
YaVendió Toolsofficial
-security-license-qualityAn MCP-based messaging system that allows AI systems to interact with various messaging platforms through standardized tools for sending text, images, documents, buttons, and alerts.Last updated -Armor Crypto MCPofficial
AsecurityAlicenseAqualityAn MCP server providing unified access to blockchain operations, bridging, swapping, and crypto trading strategies for AI agents.Last updated -37190GPL 3.0