SSE Transport Support
Some AI assistants (like Trae) only support Server-Sent Events (SSE) transport for the Model Context Protocol (MCP), using the old MCP specification (2024-11-05). Since MCP Wallet natively uses HTTP transport with the latest MCP specification, we provide an SSE Adapter v2.0 - a lightweight proxy with OAuth coordination that enables full compatibility with old-spec MCP clients.
What is SSE Transport?
Server-Sent Events (SSE) is a server-to-client streaming protocol where the server can push data to the client over a single HTTP connection. Some MCP clients require this transport type instead of standard HTTP request/response.
Do You Need the SSE Adapter?
You DON'T need it if you're using:
- ✅ Claude Code (supports HTTP transport)
- ✅ Gemini CLI (supports HTTP transport)
- ✅ Codebuddy (supports HTTP transport)
You NEED it if you're using:
- ⚠️ Trae (SSE only - old MCP spec 2024-11-05)
- ⚠️ Other SSE-only MCP clients (old MCP spec 2024-11-05)
How It Works
The SSE Adapter v2.0 acts as an OAuth coordinator and protocol translator:
┌──────────────┐ SSE ┌──────────────┐ HTTP ┌──────────────┐
│ AI Assistant │ ◄─────────────────► │ SSE Adapter │ ◄─────────────────► │ MCP Wallet │
│ (Trae/ │ Server-Sent Events │ v2.0 │ HTTP JSON-RPC │ (HTTP) │
│ Codebuddy) │ │ │ │ │
└──────────────┘ └──────────────┘ └──────────────┘
│
│ Token Exchange
▼
┌──────────────┐
│OAuth Server │
│(Cloudflare) │
└──────────────┘What the adapter does:
- Receives SSE requests from AI clients
- Manages OAuth flow - coordinates authorization and stores tokens
- Client fingerprinting - shares sessions across multiple SSE connections
- Converts SSE to HTTP and forwards to MCP Wallet
- Auto-injects tokens - transparently adds authorization
- Converts HTTP responses back to SSE format
v2.0 Key Features:
- ✅ One-time authorization - No repeated OAuth popups
- ✅ Auto-browser opening - Automatically opens authorization dialog
- ✅ Session management - Handles tokens for old-spec clients
- ✅ Client fingerprinting - Reuses sessions across connections
Installation
Prerequisites
- Node.js v18.0.0 or higher
- MCP Wallet installed and running
Download SSE Adapter
Option 1: From GitHub
# Clone the repository
git clone https://github.com/teamtaoist/mcp-wallet-sse-adapter.git
cd mcp-wallet-sse-adapter
# Install dependencies
npm installOption 2: NPM Package (Coming Soon)
npm install -g mcp-wallet-sse-adapterQuick Start
Step 1: Start MCP Wallet
- Launch MCP Wallet application
- Unlock your wallet with your password
- Verify MCP server is running on port
8580- Check Settings → MCP Server
- Should show: "API Endpoint: http://localhost:8580/mcp"
Step 2: Start SSE Adapter
# If installed from source
npm start
# If installed globally (when available)
mcp-wallet-sse-adapterYou should see:
==============================================
MCP Wallet SSE Adapter v2.0
==============================================
Adapter URL: http://localhost:8581
MCP Endpoint: http://localhost:8581/mcp
MCP Wallet URL: http://localhost:8580
OAuth Server: https://mcp-wallet-oauth.dev-taoist.workers.dev
Transport: Server-Sent Events (SSE)
Mode: Dual (Passthrough + OAuth Coordinator)
==============================================
✓ SSE Adapter is running
✓ Passthrough mode: For clients with Authorization header
✓ OAuth Coordinator mode: For old-spec clients (Trae, Codebuddy)Step 3: Configure Your AI Assistant
Point your AI assistant to the SSE Adapter (port 8581) instead of MCP Wallet directly.
Trae Configuration
File: ~/.trae/config.json
{
"mcpServers": {
"mcp-wallet": {
"url": "http://localhost:8581/mcp",
"transport": "sse",
"oauth": {
"authorizationEndpoint": "http://localhost:8581/oauth/authorize",
"tokenEndpoint": "https://mcp-wallet-oauth.dev-taoist.workers.dev/oauth/token",
"clientId": "trae",
"scopes": ["wallet:read", "wallet:write"]
}
}
}
}Key points:
- URL points to adapter (
:8581), not MCP Wallet (:8580) transport: "sse"is required- OAuth authorization endpoint uses adapter URL
- Token endpoint stays the same (Cloudflare Workers)
Other SSE-Only Clients
File: Configuration file location varies by client
{
"mcpServers": {
"mcp-wallet": {
"url": "http://localhost:8581/mcp",
"transport": "sse",
"oauth": {
"authorizationEndpoint": "http://localhost:8581/oauth/authorize",
"tokenEndpoint": "https://mcp-wallet-oauth.dev-taoist.workers.dev/oauth/token",
"clientId": "your-client-name",
"scopes": ["wallet:read", "wallet:write"]
}
}
}
}Step 4: Authorize AI Assistant
When your AI assistant first tries to use MCP Wallet:
- Adapter automatically opens your browser with authorization dialog
- MCP Wallet shows authorization dialog
- Review the permissions:
- Client name (e.g., "trae" or "codebuddy")
- Permissions requested
- Your account address
- Click "Approve"
- Browser shows success page (you can close it)
- Done! AI assistant can now access your wallet via SSE
Note: With v2.0, you only need to authorize once per client. The adapter remembers your authorization for 30 minutes, so all subsequent requests work automatically without repeated popups.
Step 5: Test the Connection
Try these commands in your AI assistant:
Check wallet address:
What's my wallet address?Check balance:
How much BNB do I have?Send test transaction (testnet recommended):
Send 0.001 BNB to 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbConfiguration
Environment Variables
You can customize the adapter with environment variables:
# Port for SSE adapter (default: 8581)
PORT=8581
# MCP Wallet URL (default: http://localhost:8580)
MCP_WALLET_URL=http://localhost:8580Custom Port
If port 8581 is already in use:
PORT=8582 npm startThen update your AI client config to use port 8582.
Custom MCP Wallet URL
If MCP Wallet is running on a different port:
MCP_WALLET_URL=http://localhost:9580 npm startHow SSE Adapter Works
Message Flow
- AI Client → Sends JSON-RPC request via SSE
- Adapter → Converts SSE to HTTP POST
- MCP Wallet → Processes request
- Adapter → Converts HTTP response to SSE events
- AI Client → Receives response via SSE stream
SSE Events
The adapter sends these SSE events:
endpoint event - Connection established
event: endpoint
data: {"type":"endpoint","message":"Connected to MCP Wallet SSE Adapter"}message event - MCP response data
event: message
data: {"jsonrpc":"2.0","result":{"balance":"0.892"},"id":1}done event - Request completed
event: done
data: {"status":"completed","timestamp":"2025-01-10T..."}error event - Error occurred
event: error
data: {"error":"wallet_locked","error_description":"Wallet is locked"}OAuth Flow
v2.0 OAuth Coordinator Mode (for old-spec clients like Trae):
- Client connects via SSE without authorization
- Adapter detects unauthorized request
- Adapter auto-opens browser with authorization URL
- User approves in MCP Wallet UI
- MCP Wallet redirects to adapter's
/oauth/callback - Adapter exchanges code for token (with OAuth server)
- Adapter stores token in session (linked to client via fingerprinting)
- Browser shows success page
- All subsequent requests automatically use stored token
Benefits of v2.0:
- ✅ One authorization per client - No repeated OAuth flows
- ✅ Automatic token management - Adapter handles everything
- ✅ Session reuse - Multiple SSE connections share one session
- ✅ Auto-refresh - Tokens refreshed automatically before expiry
For detailed OAuth flow documentation, see the SSE Adapter Repository.
Troubleshooting
Adapter Won't Start
Error: EADDRINUSE: address already in use :::8581
Solution: Port 8581 is already in use. Change port:
PORT=8582 npm startCannot Connect to MCP Wallet
Error: Connection errors or fetch failed
Solutions:
- Verify MCP Wallet is running
- Check MCP Wallet is on port 8580 (default)
- Try specifying URL explicitly:bash
MCP_WALLET_URL=http://localhost:8580 npm start
AI Client Can't Connect to Adapter
Problem: AI client shows connection error
Solutions:
- Verify adapter is running (
npm start) - Test health endpoint:
curl http://localhost:8581/health - Check AI client config:
- URL:
http://localhost:8581/mcp - Transport:
"sse"
- URL:
- Restart both adapter and AI client
OAuth Authorization Fails
Problem: Authorization dialog doesn't appear
Solutions:
- Make sure MCP Wallet is unlocked
- Check API access is enabled: Settings → Accounts → Enable API
- Verify MCP server is running in MCP Wallet
Transactions Fail
Problem: Transactions rejected or failed
Solutions:
- Insufficient funds - Check you have enough balance + gas
- Wrong network - Verify you're on correct network (testnet vs mainnet)
- API disabled - Check API access still enabled
- Wallet locked - Unlock wallet in MCP Wallet app
Security
The SSE Adapter is designed with security in mind:
Security Features
- ✅ Local Only - Binds to
127.0.0.1(localhost) only - ✅ No Storage - Completely stateless, no data stored
- ✅ Token Passthrough - OAuth tokens passed transparently, never stored
- ✅ No Logging of Secrets - Tokens and sensitive data not logged
- ✅ Open Source - Code is auditable and transparent
What Adapter CANNOT Do
- ❌ Store your passwords or seed phrases
- ❌ Access your private keys
- ❌ Modify security settings
- ❌ See your OAuth tokens (just passes through)
- ❌ Work without MCP Wallet running
Best Practices
- Only run locally - Never expose adapter to internet
- Keep it updated - Update to latest version regularly
- Monitor logs - Check adapter logs for unusual activity
- Close when not needed - Stop adapter when not using AI assistant
Performance
The adapter adds minimal overhead:
- Latency: < 10ms per request
- Memory: ~30MB RAM usage
- CPU: Negligible (stateless proxy)
- Concurrent Requests: Supports multiple simultaneous AI clients
Limitations
- Local Only: Designed for localhost usage only
- No SSL: HTTP only (MCP Wallet also uses HTTP locally)
- Single MCP Wallet: Proxies to one MCP Wallet instance at a time
Advanced Usage
Running Multiple Instances
You can run multiple adapter instances for different MCP Wallet instances:
Adapter 1 (Port 8581 → MCP Wallet Port 8580):
PORT=8581 MCP_WALLET_URL=http://localhost:8580 npm startAdapter 2 (Port 8582 → MCP Wallet Port 9580):
PORT=8582 MCP_WALLET_URL=http://localhost:9580 npm startHealth Monitoring
Check if adapter is healthy:
curl http://localhost:8581/healthResponse:
{
"status": "healthy",
"adapter": "mcp-wallet-sse-adapter",
"version": "2.0.0",
"mcpWalletUrl": "http://localhost:8580",
"oauthServerUrl": "https://mcp-wallet-oauth.dev-taoist.workers.dev",
"transport": "SSE",
"mode": "dual (passthrough + oauth-coordinator)",
"sessions": {
"total": 3,
"active": 2,
"authorized": 1,
"expired": 1
},
"oauth": {
"pendingFlows": 0
}
}Logs
The adapter logs important events to help with debugging:
[SSE] Received request: {"method":"tools/list","hasAuth":true}
[SSE] MCP Wallet response: {"hasResult":true,"hasError":false}
[OAuth] Authorization request received: {"clientId":"trae"}Next Steps
Now that you have SSE transport working:
- 📖 Learn about Security Best Practices
- 💰 Learn about Managing Transactions
- 🆘 Get help in Troubleshooting Guide
Need Help?
- 📢 Telegram Community - Get help from the community
- 🐛 GitHub Issues - Report bugs for MCP Wallet
- 📖 SSE Adapter Repository - Source code and adapter issues
Related
- AI Integration Overview - Learn about AI integration
- Claude Code Integration - Direct HTTP integration
- Gemini CLI Integration - Direct HTTP integration