The DeFi Trading Agent MCP Server transforms your AI assistant into an autonomous crypto trading agent with real-time market analysis, portfolio management, and trade execution capabilities across multiple blockchains.
Install the package globally:
npm install -g defi-trading-mcp
Create a new wallet (recommended):
npx defi-trading-mcp --create-wallet
This generates a new wallet with private key and address for secure trading.
Before using the trading agent, you'll need to configure these essential keys:
USER_PRIVATE_KEY
: Your private key (stays local, never transmitted)USER_ADDRESS
: Your Ethereum wallet addressCOINGECKO_API_KEY
: For market data accessALCHEMY_API_KEY
: (Optional) For premium RPC connectionsnpm install -g defi-trading-mcp
~/.kiro/settings/mcp.json
:{
"mcpServers": {
"defi-trading": {
"command": "npx",
"args": ["defi-trading-mcp"],
"env": {
"USER_PRIVATE_KEY": "your_private_key_here",
"USER_ADDRESS": "0xYourWalletAddress",
"COINGECKO_API_KEY": "CG-your_coingecko_api_key",
"ALCHEMY_API_KEY": "your_alchemy_api_key"
}
}
}
}
npm install -g defi-trading-mcp
claude mcp add defi-trading \
-e USER_PRIVATE_KEY=your_private_key_here \
-e USER_ADDRESS=0xYourWalletAddress \
-e COINGECKO_API_KEY=CG-your_coingecko_api_key \
-e ALCHEMY_API_KEY=your_alchemy_api_key \
-- npx defi-trading-mcp
For Windows (native):
claude mcp add defi-trading \
-e USER_PRIVATE_KEY=your_private_key_here \
-e USER_ADDRESS=0xYourWalletAddress \
-e COINGECKO_API_KEY=CG-your_coingecko_api_key \
-e ALCHEMY_API_KEY=your_alchemy_api_key \
-- cmd /c npx defi-trading-mcp
claude mcp list
npm install -g defi-trading-mcp
Open Claude Desktop, click the top left menu, select Developer, then Open App Config File.
Add the following to the config file:
{
"mcpServers": {
"defi-trading": {
"command": "npx",
"args": ["defi-trading-mcp"],
"env": {
"USER_PRIVATE_KEY": "your_private_key_here",
"USER_ADDRESS": "0xYourWalletAddress",
"COINGECKO_API_KEY": "CG-your_coingecko_api_key",
"ALCHEMY_API_KEY": "your_alchemy_api_key"
}
}
}
}
npm install -g defi-trading-mcp
{
"defi-trading": {
"command": "npx",
"args": ["defi-trading-mcp"],
"env": {
"USER_PRIVATE_KEY": "your_private_key_here",
"USER_ADDRESS": "0xYourWalletAddress",
"COINGECKO_API_KEY": "CG-your_coingecko_api_key",
"ALCHEMY_API_KEY": "your_alchemy_api_key"
}
}
}
For other MCP clients, find the equivalent configuration file and use this pattern:
{
"mcpServers": {
"defi-trading": {
"command": "npx",
"args": ["defi-trading-mcp"],
"env": {
"USER_PRIVATE_KEY": "your_private_key_here",
"USER_ADDRESS": "0xYourWalletAddress",
"COINGECKO_API_KEY": "CG-your_coingecko_api_key",
"ALCHEMY_API_KEY": "your_alchemy_api_key"
}
}
}
}
Get me a quote for 0.1 eth to usdc on Base chain.
Get me a quote for 0.1 eth on ethereum chain and execute the swap.
Scan for newly launched memecoins on Base with >$100K liquidity, pick one or two tokens and analyze the best entry opportunities
Monitor my portfolio and alert me if any position drops more than 15%
get_portfolio_tokens
- Multi-chain portfolio analysis with prices and metadataget_portfolio_balances
- Fast balance checking across all chainsget_portfolio_transactions
- Complete transaction history analysisget_trending_pools
- Identify hot trading opportunities with volume metricsget_new_pools
- Discover newly launched tokens and liquidity poolsget_pool_ohlcv
- Technical analysis with OHLCV candlestick dataget_pool_trades
- Analyze recent trading activityget_token_price
- Real-time pricing with 24h change indicatorsget_token_data
- Deep token research with metadata and social linksget_token_info
- Comprehensive token analysis including descriptionssearch_pools
- Find specific pools by token symbol or contract addressget_swap_price
- Get best prices across all DEXesget_swap_quote
- Get executable quotes with transaction dataexecute_swap
- Execute trades with optimal routingget_supported_chains
- List all 17+ supported blockchainsget_gasless_price
- Get prices for gas-free tradesget_gasless_quote
- Get gasless swap quotessubmit_gasless_swap
- Execute trades without holding ETHget_gasless_status
- Monitor gasless transaction statusThe trading agent supports 17+ blockchain networks including:
Use get_supported_chains
to see the complete current list.
For help and support, join the community:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "defi-trading" '{"command":"npx","args":["defi-trading-mcp"],"env":{"USER_PRIVATE_KEY":"your_private_key_here","USER_ADDRESS":"0xYourWalletAddress","COINGECKO_API_KEY":"CG-your_coingecko_api_key","ALCHEMY_API_KEY":"your_alchemy_api_key"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"defi-trading": {
"command": "npx",
"args": [
"defi-trading-mcp"
],
"env": {
"USER_PRIVATE_KEY": "your_private_key_here",
"USER_ADDRESS": "0xYourWalletAddress",
"COINGECKO_API_KEY": "CG-your_coingecko_api_key",
"ALCHEMY_API_KEY": "your_alchemy_api_key"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"defi-trading": {
"command": "npx",
"args": [
"defi-trading-mcp"
],
"env": {
"USER_PRIVATE_KEY": "your_private_key_here",
"USER_ADDRESS": "0xYourWalletAddress",
"COINGECKO_API_KEY": "CG-your_coingecko_api_key",
"ALCHEMY_API_KEY": "your_alchemy_api_key"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect