Defi Copilot
About
Pay-per-decision DeFi intelligence for AI agents on Stellar. Built with x402 protocol.
Details
- License
- MIT
Explore
- Pay-per-request using the x402 protocol
- Live on-chain yield data from Blend Finance (Soroban)
- Optimal swap route comparison across SDEX, Stellar DEX, and AMM
- Automatic Stellar wallet creation and funding on testnet
- Free tools for swap execution, deposits, withdrawals, and transfers
- Wallet stored locally; private keys never leave your device
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Defi CopilotCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
- Node.js v18+
- npm v9+
- Git
---
npm install
cd mcp-server
npm install
cd ..
---
claude mcp add defi-copilot -- npx -y defi-copilot-mcp
Add to your claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"defi-copilot": {
"command": "npx",
"args": ["-y", "defi-copilot-mcp"],
"env": {
"STELLAR_NETWORK": "testnet"
}
}
}
}
Note: DEFI_COPILOT_API defaults to https://api.fxjrin.com — no need to set it unless you run your own backend.
| Variable | Required | Description |
|----------|----------|-------------|
| STELLAR_NETWORK | No | testnet or mainnet (default: testnet) |
| DEFI_COPILOT_API | No | Backend API URL (default: https://api.fxjrin.com) |
---
npm install -g pm2
certbot --nginx -d your-domain.com
```
---
get_best_yield
0.001 USDC
get_best_swap
0.001 USDC
execute_swap
FREE
deposit_blend
FREE
withdraw_blend
FREE
get_blend_position
FREE
transfer
FREE
get_market_data
FREE
get_agent_wallet
FREE
fund_wallet
FREE
set_network
FREE
get_transaction_history
FREE
get_api_info
FREE
| Tool | Cost | Description |
|------|------|-------------|
| get_best_yield | 0.001 USDC | Best yield strategy — live from Blend Finance on-chain (Soroban) |
| get_best_swap | 0.001 USDC | Optimal swap route — compares SDEX Orderbook, Stellar DEX, AMM |
| execute_swap | FREE | Execute real swap on Stellar DEX |
| deposit_blend | FREE | Deposit USDC to Blend Finance to earn yield (mainnet) |
| withdraw_blend | FREE | Withdraw USDC + interest from Blend Finance (mainnet) |
| get_blend_position | FREE | Check your Blend Finance deposit + interest earned (mainnet) |
| transfer | FREE | Send XLM or USDC to any Stellar address |
| get_market_data | FREE | Live XLM price, volume, spread from Stellar mainnet DEX |
| get_agent_wallet | FREE | Check or create agent wallet |
| fund_wallet | FREE | Show wallet address + QR code URL for funding |
| set_network | FREE | Switch between testnet and mainnet |
| get_transaction_history | FREE | View recent wallet transaction history |
| get_api_info | FREE | API info and pricing |
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"defi copilot": {
"defi-copilot": {
"command": "npx",
"args": [
"-y",
"defi-copilot-mcp"
],
"env": {
"STELLAR_NETWORK": "testnet"
}
}
}
}
}
McpServers
{
"defi-copilot": {
"command": "npx",
"args": [
"-y",
"defi-copilot-mcp"
],
"env": {
"STELLAR_NETWORK": "testnet"
}
}
}
Pay-per-decision DeFi intelligence for AI agents on Stellar. Built with x402 protocol — agents buy decisions, not subscriptions.
Overview
DeFi Copilot is a Stellar-native DeFi intelligence layer that allows AI agents to autonomously query DeFi data, execute swaps, and interact with DeFi protocols — paying per request using the x402 protocol. No API keys. No subscriptions. No human approval required.
Two ways to use:
- MCP Server — install in Claude Desktop or any MCP-compatible AI, agents query and pay automatically
- REST API — standard HTTP with x402 payment protocol, works with any HTTP client
Live backend: https://api.fxjrin.com
---
How It Works
User / AI Agent
|
| (natural language or direct API call)
v
MCP Server (defi-copilot-mcp)
|
| GET /defi/yield/best
v
Backend API (port 3000)
|
| 402 Payment Required
v
Agent builds + signs Stellar USDC tx
|
| x-payment header
v
Facilitator verifies + settles (port 4022)
|
| on-chain settlement on Stellar
v
Return DeFi intelligence
---
Project Structure
defi-copilot/
src/
server.ts # Express server
routes/
yield.ts # GET /defi/yield/best
swap.ts # GET /defi/swap/best
services/
scorer.ts # Market data + Blend on-chain APY + DEX quotes
utils/
x402-middleware.ts # x402 payment verification
network.ts # Network config (testnet/mainnet)
http.ts # IPv4-forced HTTP client (undici)
init.ts # Server wallet setup script
facilitator/
index.ts # Local x402 facilitator (port 4022)
agent/
client.ts # Agent payment client with auto-create wallet
demo.ts # Demo script
mcp-server/
src/
index.ts # MCP tools + auto-create wallet
network.ts # Network config for MCP
http.ts # IPv4-forced HTTP client (undici)
---
Prerequisites
- Node.js v18+
- npm v9+
- Git
---
Installation
1. Clone the repository
git clone https://github.com/fxjrin/defi-copilot.git
cd defi-copilot
2. Install backend dependencies
npm install
3. Install MCP server dependencies
cd mcp-server
npm install
cd ..
---
Configuration
Backend .env
The .env file is generated automatically by npm run init. If you prefer to set it up manually, create .env in the defi-copilot/ root:
```env
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



