Codebuddy Integration
Integrate MCP Wallet with Codebuddy to enable AI-powered wallet management directly from Tencent's AI coding assistant.
Overview
Codebuddy is Tencent AI's coding assistant that supports MCP integration. This guide shows you how to connect MCP Wallet to Codebuddy CLI using HTTP transport and OAuth 2.1 authentication.
Features:
- ✅ HTTP Transport (Direct integration, no adapter needed)
- ✅ OAuth 2.1 authentication with PKCE
- ✅ Balance checking
- ✅ Transaction sending
- ✅ Transaction monitoring
- ✅ Multi-token support
- ✅ Code-integrated wallet access
Prerequisites
Before you begin, ensure you have:
MCP Wallet installed and running
- Download: MCP Wallet Releases
- Installation Guide
Wallet created and unlocked
Node.js v18 or higher (optional, for npm installation)
- Required if installing via npm
- Download: Node.js
API access enabled
- Settings → Accounts → Enable API toggle
Installation
Step 1: Install Codebuddy CLI
If you haven't installed Codebuddy CLI yet:
npm install -g @tencent-ai/codebuddy-codeOr with yarn:
yarn global add @tencent-ai/codebuddy-codeVerify installation:
codebuddy --versionStep 2: Start MCP Wallet
- Launch MCP Wallet application
- Unlock your wallet with your password
- The MCP server starts automatically on port
8580 - Verify in Settings → MCP Server:
- Should show: "API Endpoint: http://localhost:8580/mcp"
- Status: "Running"
Configuration
Step 3: Add MCP Wallet to Codebuddy
Run this single command to add MCP Wallet:
codebuddy mcp add --transport http mcp-wallet http://localhost:8580/mcpThis will add MCP Wallet to your Codebuddy CLI configuration.
Alternative: Manual Configuration
If the command doesn't work, you can manually edit the config file:
File: ~/.codebuddy/config.json
{
"mcpServers": {
"mcp-wallet": {
"serverUrl": "http://localhost:8580/mcp",
"oauth": {
"clientId": "codebuddy"
}
}
}
}Or with the url property (some versions use this):
{
"mcpServers": {
"mcp-wallet": {
"url": "http://localhost:8580/mcp",
"oauth": {
"clientId": "codebuddy"
}
}
}
}Key points:
- URL points to MCP Wallet on port
:8580 - No transport specified (HTTP is default for modern MCP clients)
- OAuth client ID is
"codebuddy" - OAuth endpoints are auto-discovered via metadata
Authorization
Step 4: Authorize Codebuddy
When Codebuddy CLI first uses MCP Wallet, it will trigger OAuth authorization:
- Codebuddy opens your browser with authorization page
- MCP Wallet shows authorization dialog
- Review the permissions:
- Client:
codebuddy - Permissions:
wallet:read wallet:write - Account: Your wallet address
- Client:
- Click "Approve" to grant access
- Browser redirects to success page (you can close it)
- Done! Codebuddy can now access your wallet
What happens during authorization:
- OAuth 2.1 Authorization Code Flow with PKCE
- Access token issued (valid for 1 hour)
- Refresh token issued (valid for 30 days)
- Tokens automatically refreshed when needed
Usage
Step 5: Try It Out
Start using Codebuddy with your wallet:
Start Codebuddy chat:
codebuddy chatCheck wallet address:
> What's my wallet address?
Your wallet address is 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbCheck BNB balance:
> How much BNB do I have in my wallet?
You have 0.892 BNB in your wallet.Check token balances:
> Check my USDT balance
You have 50.00 USDT in your wallet.Send transaction:
> Send 0.01 BNB to 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb
Sending 0.01 BNB to 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb...
Transaction sent successfully!
Transaction hash: 0x4952c33d1689cd57090d537052a1bc2efbc206cd65e36be048f04e4840cc75b7Check transaction status:
> What's the status of transaction 0x4952c3...?
Transaction 0x4952c3... is confirmed.
Block: 42345678
Status: SuccessFeatures
Supported Operations
| Operation | Description | Example |
|---|---|---|
| Get Address | View wallet address | "What's my wallet address?" |
| Get Balance | Check token balances | "How much BNB do I have?" |
| Send Transaction | Transfer tokens | "Send 0.1 BNB to 0x..." |
| Transaction Status | Check tx status | "Is tx 0x... confirmed?" |
Code Integration
Codebuddy can integrate wallet operations into your code:
Example 1: Check balance before deployment
> I'm deploying a contract. Do I have enough BNB?
Let me check your balance...
You have 0.892 BNB. That should be enough for deployment.Example 2: Automated payments
> Send 0.05 BNB to the contract deployer address
Sending 0.05 BNB to 0x...
Transaction sent: 0x4952c3...Security
Best Practices
- ✅ Start with testnet - Test integration on BSC Testnet first
- ✅ Use dedicated account - Create separate account for AI access
- ✅ Monitor transactions - Review AI-initiated transactions regularly
- ✅ Limited funds - Keep only needed amount in AI account
- ✅ Revoke when done - Disable API access when not using Codebuddy
What Codebuddy Can Access
Allowed ✅:
- Read wallet address
- Read token balances
- Send transactions (after OAuth approval)
- Check transaction status
Not Allowed ❌:
- Access password or seed phrase
- Export private keys
- Modify security settings
- Delete accounts
- Change password
Revoking Access
You can revoke Codebuddy's access anytime:
- Open MCP Wallet
- Go to Settings → Authorized AI Clients
- Find "codebuddy" in the list
- Click "Revoke All"
- All active tokens are immediately invalidated
Or simply:
- Go to Settings → Accounts
- Disable the "Enable API" toggle
- All AI access is disabled immediately
Troubleshooting
Codebuddy Can't Connect
Problem: Connection failed or Cannot connect to MCP server
Solutions:
- Verify MCP Wallet is running and unlocked
- Check API access is enabled: Settings → Accounts → Enable API
- Verify MCP server status: Settings → MCP Server → Should show "Running"
- Test connection manually:bash
curl http://localhost:8580/mcp - Check firewall allows port 8580
Authorization Fails
Problem: OAuth authorization doesn't work
Solutions:
- Make sure MCP Wallet is unlocked
- Check that browser opens authorization page
- Click "Auth" button on authorization page first
- Then approve in MCP Wallet dialog
- Click "Redirect" button on success page
- Restart Codebuddy and try again
Transactions Rejected
Problem: Transactions fail or are rejected
Possible Causes & Solutions:
Insufficient balance:
- Check you have enough tokens + gas fees
- Use
> How much BNB do I have?to verify
Wrong network:
- Verify you're on correct network (testnet vs mainnet)
- Check Settings → Network in MCP Wallet
API disabled:
- Make sure API access is still enabled
- Settings → Accounts → Enable API toggle
Wallet locked:
- Unlock wallet in MCP Wallet app
- MCP server stops when wallet is locked
Token Expired
Problem: Authorization failed or Invalid token errors
Solutions:
- Tokens expire after 1 hour (access token) or 30 days (refresh token)
- Codebuddy should auto-refresh - if not, re-authorize:
- Use Codebuddy's wallet tools again
- MCP Wallet will show re-authorization dialog
- Approve to get new tokens
- Or revoke and re-authorize manually:
- MCP Wallet → Settings → Authorized AI Clients → Revoke
- Restart Codebuddy chat session
Advanced Usage
Multiple Accounts
If you have multiple accounts in MCP Wallet:
- Switch account in Settings → Accounts
- Set the active AI account
- Codebuddy will use the newly selected account
- No re-authorization needed
Custom OAuth Client ID
If you want to use a different client ID:
Edit: ~/.codebuddy/config.json
{
"mcpServers": {
"mcp-wallet": {
"serverUrl": "http://localhost:8580/mcp",
"oauth": {
"clientId": "my-custom-codebuddy"
}
}
}
}This will appear as "my-custom-codebuddy" in MCP Wallet's authorized clients list.
Monitoring API Usage
Track Codebuddy's wallet access:
Transaction History
- Open Transactions tab
- Filter by "AI-initiated"
- View all transactions made by Codebuddy
Authorized Clients
- Settings → Authorized AI Clients
- See active sessions
- View last access time
- Revoke specific tokens
FAQ
Do I need the SSE Adapter?
No! Codebuddy now supports HTTP transport directly, so you don't need the SSE Adapter. Just connect Codebuddy directly to MCP Wallet on port 8580.
Can I use Codebuddy with multiple wallets?
Yes! If you run multiple MCP Wallet instances on different ports, you can configure Codebuddy to use either:
{
"mcpServers": {
"mcp-wallet-main": {
"serverUrl": "http://localhost:8580/mcp"
},
"mcp-wallet-test": {
"serverUrl": "http://localhost:9580/mcp"
}
}
}Is it safe to give Codebuddy access?
Yes, if you follow best practices:
- Start with testnet to understand behavior
- Use dedicated account with limited funds
- Monitor transaction history regularly
- Revoke access when not using Codebuddy
OAuth 2.1 ensures Codebuddy only has temporary, revocable access and cannot access your seed phrase or private keys.
How long do I stay authorized?
- Access tokens: Valid for 1 hour
- Refresh tokens: Valid for 30 days
- Codebuddy auto-refreshes tokens when needed
- You only need to re-authorize after 30 days or if you revoke access
Next Steps
Now that Codebuddy is integrated:
- 📖 Learn about Security Best Practices
- 💰 Learn about Managing Transactions
- 🔍 Explore API Reference
- 🆘 Get help in Troubleshooting Guide
Related Guides
- AI Integration Overview - Learn about AI integration
- Claude Code Integration - Another HTTP integration example
- Gemini CLI Integration - Another HTTP integration example
- Other AI Clients - Generic HTTP integration guide
Need Help?
- 📢 Telegram Community - Get help from the community
- 🐛 GitHub Issues - Report bugs
- 📖 Documentation - Full documentation
Questions? See FAQ or join Telegram Community