← Back to Docs

MCP Server

Connect AI assistants to Cotrader's stock screening, pattern detection, and market data via the Model Context Protocol.

1. What is MCP?

The Model Context Protocol (MCP) is an open standard that lets AI assistants call external tools. Cotrader's MCP server gives your AI assistant direct access to stock screening, chart pattern detection, and market data — so you can ask questions in plain English and get real-time results without leaving your AI workflow.

With the Cotrader MCP server connected, you can ask your AI assistant things like:

  • "Find stocks with RSI under 30 that are above their 200-day moving average"
  • "Detect chart patterns on AAPL and tell me about support/resistance levels"
  • "Scan the market for stocks forming double bottom patterns"
  • "Show me the last 90 days of price data for NVDA"

2. Available Tools

The Cotrader MCP server exposes five tools that your AI assistant can call:

screen_stocks

Screen stocks using natural language queries. Supports 35+ technical indicators, 20+ fundamental metrics, and chart pattern filters (trendlines, support/resistance, MACD divergence, and more).

Parameters:

query       (string, required)  Natural language screening query
maxResults  (int, default 50)   Maximum results to return
detect_patterns

Detect chart patterns for a specific stock. Returns support/resistance levels, trendlines, channels, double/triple bottoms, pennants, head & shoulders, and MACD divergences.

Parameters:

symbol        (string, required)  Ticker symbol (e.g., "AAPL")
patternTypes  (string, optional)  Comma-separated types to detect (omit for all)
days          (int, default 90)   Lookback period in trading days

Pattern types:

horizontal_levels rising_trendline descending_trendline channel multi_bottom pennant head_shoulders macd_divergence
scan_patterns

Scan the entire stock universe for a specific chart pattern. Returns top matches ranked by pattern strength.

Parameters:

patternType  (string, required)   Pattern type to scan for
topN         (int, default 20)    Number of top matches
days         (int, default 200)   Lookback period in trading days
search_symbols

Search for stock ticker symbols by name or symbol prefix.

Parameters:

query  (string, required)  Search term (e.g., "AAPL" or "Apple")
limit  (int, default 10)   Maximum results (1-50)
get_stock_bars

Get historical daily OHLCV price bars for a stock symbol.

Parameters:

symbol  (string, required)  Ticker symbol (e.g., "MSFT")
days    (int, default 90)   Trading days of history (max 365)

3. Setup: Claude Desktop

Add Cotrader as a connector in Claude Desktop using the built-in UI.

  1. 1. Open Claude Desktop → SettingsConnectorsAdd custom connector
  2. 2. Set the Name to Cotrader
  3. 3. Set the URL to:
https://api.getcotrader.com/mcp?api_key=YOUR_API_KEY
  1. 4. Click Add and restart Claude Desktop.

Note: Replace YOUR_API_KEY with your actual API key from the API Keys page. The connection is over HTTPS so your key is encrypted in transit.

4. Setup: Claude Code / VS Code / Cursor

Claude Code (CLI)

Add the Cotrader MCP server with a single command:

claude mcp add cotrader \
  --transport http \
  --url https://api.getcotrader.com/mcp \
  --header "X-API-Key: YOUR_API_KEY"

VS Code (Copilot Chat)

Add to your .vscode/mcp.json:

{
  "servers": {
    "cotrader": {
      "type": "http",
      "url": "https://api.getcotrader.com/mcp",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Cursor

Add to your .cursor/mcp.json:

{
  "mcpServers": {
    "cotrader": {
      "url": "https://api.getcotrader.com/mcp",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

5. Example Conversations

Once connected, just ask your AI assistant in plain English. Here are some examples of what you can do:

Screening for oversold stocks

"Find me stocks with RSI under 30, price above the 200 EMA, and average volume over 1 million shares"

The AI calls screen_stocks with your query, scans 11,000+ stocks, and returns a table of matches with their indicator values.

Analyzing chart patterns

"What chart patterns do you see on TSLA? Focus on the last 6 months."

The AI calls detect_patterns and returns support/resistance levels, trendlines, channels, and formations found in the price data.

Scanning for setups across the market

"Scan the whole market for stocks forming double bottom patterns"

The AI calls scan_patterns to find stocks across the entire universe that match the pattern, ranked by strength.

Screening with MACD divergence

"Find small-cap stocks up on above average volume that are showing a bullish MACD divergence"

The AI calls screen_stocks which combines indicator conditions with chart pattern detection — filtering 11,000+ stocks for both technical criteria and MACD divergences.

Multi-step research

"Screen for tech stocks making new 52-week highs, then check each one for head and shoulders patterns"

The AI chains multiple tool calls — screening first, then running pattern detection on each result — to give you a complete analysis.

6. Get an API Key

You need a Cotrader API key to connect your AI assistant. Create one from the API Keys page — the free tier includes 10 screens per day.

Note: Your API key is shown only once when created. Store it securely. If lost, revoke it and create a new one.

Ready to connect your AI assistant?