Skip to content

Claude Code Integration

Integrate MCP Wallet with Claude Code to enable AI-powered wallet management directly from your coding assistant.

Overview

Claude Code is Anthropic's AI-powered coding assistant that supports MCP integration. This guide shows you how to connect MCP Wallet to Claude Code 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

Prerequisites

Before you begin, ensure you have:

  1. MCP Wallet installed and running

  2. Wallet created and unlocked

  3. Claude Code installed

  4. API access enabled

    • Settings → Accounts → Enable API toggle

Step-by-Step Setup

Step 1: Start MCP Wallet

  1. Launch MCP Wallet application
  2. Unlock your wallet with your password
  3. The MCP server starts automatically on port 8580

TIP

You can verify the MCP server is running by checking SettingsMCP Server. You should see "Server Status: Running".

Step 2: Enable API Access

  1. Go to SettingsAccounts
  2. Find the account you want AI to use
  3. Toggle "Enable API" to ON

Recommended

Create a dedicated account for AI access and keep limited funds in it for better security.

Step 3: Add MCP Wallet to Claude Code

Use the Claude Code CLI to add MCP Wallet:

bash
claude mcp add --transport http mcp-wallet http://localhost:8580/mcp

This command:

  • Adds MCP Wallet to your Claude Code configuration
  • Sets up HTTP transport to connect to the MCP server
  • Configures the connection to http://localhost:8580/mcp

TIP

If you don't have the claude CLI installed, you can manually add the configuration to ~/.claude/config.json (macOS/Linux) or %APPDATA%\.claude\config.json (Windows).

Step 4: Authorize Claude Code

Now let's connect Claude Code to your wallet:

  1. Open Claude Code terminal

  2. Run the /mcp command

    bash
    /mcp
  3. Claude will open your browser to the authorization page

  4. Click "Auth" button on the authorization page

  5. MCP Wallet will show authorization dialog

    The dialog displays:

    • Client name: "Claude Code"
    • Requested permissions
    • Your account address
  6. Review and click "Approve"

  7. Return to browser and click "Redirect"

  8. Done! You'll see: "Authentication successful. Connected to wallet."

Troubleshooting

If the authorization dialog doesn't appear:

  • Make sure MCP Wallet is running and unlocked
  • Check that API access is enabled for at least one account
  • Verify the MCP server is running in SettingsMCP Server

Step 5: Test the Connection

Try these commands in Claude Code to test your connection:

Check your wallet address:

What's my wallet address?

Check your balance:

How much BNB do I have?

Send a test transaction (testnet recommended):

Send 0.001 BNB to 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb

Available Commands

Here's what you can ask Claude Code to do:

Balance Queries

How much BNB do I have?
What's my USDT balance?
Show me all my token balances

Address Information

What's my wallet address?
Show my wallet address

Transactions

Send 0.01 BNB to 0x742d35...
Transfer 10 USDT to 0x8388af...
Send 0.001 BNB to vitalik.eth

Transaction Status

What's the status of transaction 0x4952c33d...?
Check my last transaction

Security Features

OAuth 2.1 Authentication

MCP Wallet uses industry-standard OAuth 2.1 with PKCE for security:

  • Authorization Code Flow - Secure token exchange
  • PKCE (S256) - Prevents authorization code interception
  • Short-lived tokens - Access tokens expire after 1 hour
  • Refresh tokens - Valid for 30 days

One-Time Approval

After completing OAuth authorization, Claude Code can execute transactions:

  • Initial authorization - You approve once during OAuth flow
  • Automatic execution - Transactions executed without further approval
  • Transaction history - All AI transactions are logged and labeled as "AI-initiated"
  • Revoke access - Disable API access anytime in Settings to stop all AI transactions

Coming Soon: Spending Limits

Per-transaction and daily spending limits will be added in a future update for additional control over AI transactions.

Troubleshooting

Authorization Dialog Not Appearing

Problem: Authorization dialog doesn't show when clicking "Auth"

Solutions:

  1. Make sure MCP Wallet is running and unlocked
  2. Check API is enabled: SettingsAccounts → Enable API
  3. Verify MCP server is running: SettingsMCP Server

"HTTP 500" Error

Problem: Claude Code shows "HTTP 500: Internal Server Error"

Solutions:

  1. Restart MCP Wallet
  2. Re-unlock your wallet
  3. Check MCP server logs in SettingsLogs
  4. Update to latest version of MCP Wallet

Transaction Failed

Problem: Transaction rejected or failed

Solutions:

  1. Insufficient funds - Make sure you have enough balance + gas fees
  2. Network issues - Check your internet connection
  3. Wrong network - Verify you're on the correct network (testnet vs mainnet)
  4. API disabled - Check that API access is still enabled

Unauthorized Error

Problem: "401 Unauthorized" or "Invalid token"

Solutions:

  1. Re-authorize - Run /mcp command again in Claude Code
  2. Check token expiry - Access tokens expire after 1 hour
  3. Restart Claude Code - Sometimes helps refresh the connection

Best Practices

Testing

  1. Start with testnet - Use BSC Testnet before mainnet
  2. Small amounts - Test with tiny amounts first
  3. Verify transactions - Always check transaction hashes on block explorer

Security

  1. Separate account - Use a dedicated account for AI access
  2. Limited funds - Keep only needed amount in AI-accessible account
  3. Regular monitoring - Check transaction history regularly
  4. Revoke when not in use - Disable API access when you don't need it

Network Configuration

BSC Testnet (for testing):

  • Network: BSC Testnet
  • Chain ID: 97
  • Get testnet BNB: BSC Faucet

BSC Mainnet (for production):

  • Network: BSC Mainnet
  • Chain ID: 56
  • Real BNB required

Production Warning

When using mainnet:

  • Double-check addresses - Transactions are irreversible
  • Start with small amounts - Test first!
  • Monitor closely - Check all AI-initiated transactions

Advanced Configuration

Custom Port

If port 8580 conflicts with another service:

  1. Go to SettingsMCP Server
  2. Change port (e.g., to 8581)
  3. Update Claude Code config:
    json
    {
      "url": "http://localhost:8581/mcp",
      "oauth": {
        "authorizationEndpoint": "http://localhost:8581/oauth/authorize",
        // ... rest of config
      }
    }

Multiple Accounts

To use multiple accounts with Claude Code:

  1. Set up first account as described above
  2. To switch accounts:
    • Go to SettingsAI Agent Account
    • Select different account
    • Claude Code will use the new account automatically

Scopes Customization

You can request fewer permissions if desired:

json
{
  "scopes": ["wallet:read"]  // Read-only access
}

Available scopes:

  • wallet:read - Balance and address queries
  • wallet:write - Send transactions
  • wallet:transaction - Transaction status
  • wallet:admin - Advanced operations (future)

Next Steps

Now that you're connected:

Need Help?

MCP Wallet - Secure crypto wallet with AI integration