DEFI_COPILOT
Getting Started

MCP Server

The MCP server lets AI agents use DeFi Copilot tools directly in conversation. Wallet creation, x402 payments, and on-chain settlement all happen automatically — no human intervention needed.

Installation

Claude Code

terminal
claude mcp add defi-copilot -- npx -y defi-copilot-mcp

Claude Desktop

Add to your claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "defi-copilot": {
      "command": "npx",
      "args": ["-y", "defi-copilot-mcp"],
      "env": {
        "STELLAR_NETWORK": "testnet"
      }
    }
  }
}
windows: %APPDATA%\\Claude\\claude_desktop_config.json
{
  "mcpServers": {
    "defi-copilot": {
      "command": "npx",
      "args": ["-y", "defi-copilot-mcp"],
      "env": {
        "STELLAR_NETWORK": "testnet"
      }
    }
  }
}

npm package

PACKAGE
defi-copilot-mcp
Version: 1.3.0
Registry: npmjs.com
Runtime: Node.js ≥18

Agent wallet

On first use, the MCP server automatically provisions an agent wallet:

01Generates a new Stellar keypair
02Funds with XLM via Friendbot (testnet only)
03Sets up USDC trustline
04Swaps 50 XLM → USDC for payment capability
05Saves to ~/.defi-copilot/wallet-testnet.json

Private keys are stored locally on the user's machine and never leave the device. On mainnet, the wallet is generated but not auto-funded — the user must deposit XLM manually.

Environment variables

VariableRequiredDefaultDescription
STELLAR_NETWORKNotestnettestnet or mainnet
DEFI_COPILOT_APINohttps://api.fxjrin.comBackend API URL. Override for self-host

Network switching

Switch networks within a conversation using natural language:

example conversation
User:   "Switch to mainnet"
Claude: calls set_network(network="mainnet")

User:   "What is the best yield right now?"
Claude: calls get_best_yield()
        → pays 0.001 USDC on Stellar mainnet
        → returns live Blend Finance APY