The MCP Trader Server is a specialized server implementing the Model Context Protocol (MCP) for stock and cryptocurrency analysis. It provides technical analysis tools and market data access with minimal configuration requirements.
Create a .env
file in your project root:
# Tiingo API Key (free tier works great)
TIINGO_API_KEY=your_tiingo_api_key_here
# Optional: For higher rate limits
BINANCE_API_KEY=your_binance_api_key_here
BINANCE_API_SECRET=your_binance_api_secret_here
# Clone the repository
git clone https://github.com/wshobson/mcp-trader.git
cd mcp-trader
# Create virtual environment and install dependencies
uv venv --python 3.11
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv sync
# Copy the example environment file
cp .env.example .env
# Edit .env and add your Tiingo API key
The configuration file location varies by platform:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"stock-analyzer": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-trader",
"run",
"mcp-trader"
],
"env": {
"TIINGO_API_KEY": "your_api_key_here"
}
}
}
}
To enable FastMCP resources alongside the standard tools:
{
"mcpServers": {
"stock-analyzer": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-trader",
"run",
"python",
"-m",
"mcp_trader.fastmcp_server"
],
"env": {
"TIINGO_API_KEY": "your_api_key_here"
}
}
}
}
uv run mcp-trader
# Run with Python directly
uv run python -m mcp_trader.server
# Run with MCP Inspector for debugging
npx @modelcontextprotocol/inspector uv --directory . run mcp-trader
# Build the Docker image
docker build -t mcp-trader .
# Run the container
docker run -e TIINGO_API_KEY=your_api_key_here -p 8000:8000 mcp-trader
# Run in HTTP server mode
docker run -e TIINGO_API_KEY=your_api_key_here -p 8000:8000 mcp-trader uv run mcp-trader --http
analyze-stock: Performs technical analysis on a stock symbol
Required argument: symbol (string, e.g. "NVDA")
analyze-crypto: Analyzes cryptocurrency assets
Required argument: symbol (string, e.g. "BTC", "ETH", "BTCUSDT")
Optional arguments:
- provider (string, default: "tiingo", options: "tiingo", "binance")
- lookback_days (integer, default: 365)
- quote_currency (string, default: "usd" for Tiingo, "USDT" for Binance)
relative-strength: Calculates a stock's relative strength compared to a benchmark
Required argument: symbol (string, e.g. "AAPL")
Optional argument: benchmark (string, default: "SPY")
volume-profile: Analyzes volume distribution by price
Required argument: symbol (string, e.g. "MSFT")
Optional argument: lookback_days (integer, default: 60)
detect-patterns: Identifies chart patterns in price data
Required argument: symbol (string, e.g. "AMZN")
position-size: Calculates optimal position size based on risk parameters
Required arguments:
- symbol (string, e.g. "TSLA")
- stop_price (number)
- risk_amount (number)
- account_size (number)
Optional argument: price (number, default: current price)
suggest-stops: Suggests stop loss levels based on technical analysis
Required argument: symbol (string, e.g. "META")
stock://{symbol}
- Get current stock price and statisticsstock://{symbol}/history
- Get historical price datacrypto://{symbol}
- Get current crypto price (supports Tiingo & Binance)crypto://{symbol}/history
- Get historical crypto datamarket://cache/clear
- Clear the data cachemarket://cache/status
- View cache statisticsIn Claude Desktop, simply ask:
Analyze the technical setup for NVDA
For crypto analysis:
Analyze BTC using Binance data
"TIINGO_API_KEY not set" error
.env.example
to .env
.env
fileImport errors
source .venv/bin/activate
uv sync --force-reinstall
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "stock-analyzer" '{"command":"uv","args":["--directory","/absolute/path/to/mcp-trader","run","mcp-trader"],"env":{"TIINGO_API_KEY":"your_api_key_here"}}'
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": {
"stock-analyzer": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-trader",
"run",
"mcp-trader"
],
"env": {
"TIINGO_API_KEY": "your_api_key_here"
}
}
}
}
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": {
"stock-analyzer": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/mcp-trader",
"run",
"mcp-trader"
],
"env": {
"TIINGO_API_KEY": "your_api_key_here"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect