Crypto Trading MCP is a Model Context Protocol server that enables price lookup and trading functionality across multiple cryptocurrency exchanges. It provides a standardized interface to interact with various exchanges through a simple API, currently supporting Upbit, Gate.io, and Binance for spot trading.
Before using the server, you need to configure authentication information for each exchange you plan to use. Set the required environment variables for your exchanges:
export UPBIT_ACCESS_KEY="your-access-key"
export UPBIT_SECRET_KEY="your-secret-key"
export GATE_API_KEY="your-api-key"
export GATE_API_SECRET="your-api-secret"
export BINANCE_API_KEY="your-api-key"
export BINANCE_API_SECRET="your-api-secret"
To start the MCP server:
python -m crypto_trading_mcp.server
By default, the server runs on port 8000. You can specify a different port using the --port
option:
python -m crypto_trading_mcp.server --port 9000
Once the server is running, you can interact with it using HTTP requests. Here are common operations:
Retrieve current price for a specific trading pair:
curl "http://localhost:8000/price?exchange=binance&symbol=BTC-USDT"
Place a limit buy order:
curl -X POST "http://localhost:8000/order" \
-H "Content-Type: application/json" \
-d '{
"exchange": "binance",
"symbol": "BTC-USDT",
"side": "buy",
"type": "limit",
"price": "30000",
"amount": "0.001"
}'
Place a market sell order:
curl -X POST "http://localhost:8000/order" \
-H "Content-Type: application/json" \
-d '{
"exchange": "upbit",
"symbol": "BTC-KRW",
"side": "sell",
"type": "market",
"amount": "0.001"
}'
Get the status of a specific order:
curl "http://localhost:8000/order/status?exchange=binance&order_id=123456789"
Retrieve account balance for a specific exchange:
curl "http://localhost:8000/balance?exchange=upbit"
When making API requests, use the following exchange identifiers:
upbit
- Upbit exchangegate
- Gate.io exchangebinance
- Binance exchangeFor trading pairs, use the format specific to each exchange:
BTC-KRW
, ETH-KRW
BTC_USDT
, ETH_USDT
BTCUSDT
, ETHUSDT
The MCP server will automatically convert these formats as needed for consistent handling across exchanges.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "crypto-trading" '{"command":"python","args":["-m","crypto_trading_mcp"]}'
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": {
"crypto-trading": {
"command": "python",
"args": [
"-m",
"crypto_trading_mcp"
]
}
}
}
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": {
"crypto-trading": {
"command": "python",
"args": [
"-m",
"crypto_trading_mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect