Skip to main content
Glama
stock-research-mcp

stock-research-mcp

by mz462

Stock Research MCP Server

An MCP (Model Context Protocol) server that provides comprehensive stock research tools for Claude. Aggregates data from Alpha Vantage and Finnhub APIs.

Features

  • Real-time quotes and historical price data

  • Company profiles and fundamental analysis

  • Technical indicators (SMA, EMA, RSI, MACD, Bollinger Bands)

  • Support/resistance level calculations

  • Analyst ratings and price targets

  • News sentiment analysis

  • Insider trading activity

  • Macro economic indicators

  • Deep research reports combining all data sources

  • Trading execution via Alpaca (paper and live trading)

Related MCP server: Alpha Vantage MCP Server

Installation

  1. Clone the repository:

cd stock-research-mcp
  1. Create a virtual environment and install the package:

uv venv .venv
source .venv/bin/activate
uv pip install -e ".[dev]"
  1. Configure API keys in .env:

ALPHA_VANTAGE_API_KEY=your_key_here
FINNHUB_API_KEY=your_key_here

# Alpaca Trading (optional)
ALPACA_API_KEY=your_key_here
ALPACA_SECRET_KEY=your_secret_here
ALPACA_PAPER=true  # Set to false for live trading

# Risk Controls (optional)
TRADING_MAX_ORDER_VALUE=5000
TRADING_MAX_POSITION_SIZE=10000
TRADING_ALLOWED_SYMBOLS=AAPL,MSFT,GOOGL  # Leave empty for all symbols

Get free API keys at:

Usage with Claude Code

Add to your Claude Code MCP configuration:

claude mcp add stock-research -- .venv/bin/python -m stock_research.server

Or use the installed script:

claude mcp add stock-research -- .venv/bin/stock-research-mcp

Or manually add to ~/.claude/mcp.json:

{
  "mcpServers": {
    "stock-research": {
      "command": "/path/to/stock-research-mcp/.venv/bin/stock-research-mcp"
    }
  }
}

Available Tools

Market Data

  • get_quote(ticker) - Real-time quote

  • get_historical_prices(ticker, timeframe, interval) - Historical OHLCV data

Company Analysis

  • get_company_profile(ticker) - Company overview

  • get_financials(ticker) - Key financial metrics and ratios

  • get_earnings(ticker) - Earnings history and surprises

Technical Analysis

  • get_technical_indicators(ticker, indicators) - SMA, EMA, RSI, MACD, BBands

  • get_support_resistance(ticker, lookback_days) - Support/resistance levels

Sentiment & Activity

  • get_news_sentiment(ticker, limit) - News articles with sentiment

  • get_insider_trades(ticker) - Insider buying/selling

  • get_analyst_ratings(ticker) - Analyst consensus and price targets

Macro

  • get_macro_context() - Economic indicators (Fed rate, yields, GDP, CPI)

Research

  • generate_deep_research(ticker, research_type) - Comprehensive research report

Trading (Alpaca)

  • get_trading_account() - Account info, buying power, equity

  • get_positions() - All open positions

  • get_position(symbol) - Position for specific symbol

  • place_market_order(symbol, qty, side) - Market order

  • place_limit_order(symbol, qty, side, limit_price) - Limit order

  • place_stop_order(symbol, qty, side, stop_price) - Stop order

  • place_stop_limit_order(symbol, qty, side, stop_price, limit_price) - Stop-limit order

  • get_orders(status) - List orders (open/closed/all)

  • cancel_order(order_id) - Cancel specific order

  • cancel_all_orders() - Cancel all open orders

  • close_position(symbol) - Close position for symbol

  • close_all_positions() - Liquidate all positions

  • get_trading_config() - View current risk limits

Development

Run tests:

pytest

Example Usage

Once configured, ask Claude:

"Give me a deep research report on NVDA"
"What's the current price and technical setup for AAPL?"
"Show me analyst ratings for MSFT"
"What's the macro environment looking like?"

Trading Examples

"Show me my current positions"
"Buy 10 shares of AAPL at market"
"Place a limit order for 5 shares of MSFT at $400"
"Set a stop loss on my NVDA position at $120"
"What's my account buying power?"

⚠️ Warning: Trading involves real money. Start with paper trading (ALPACA_PAPER=true) to test your strategies. The server includes risk controls but you are responsible for your trades.

Rate Limits

  • Alpha Vantage Free Tier: 25 API calls/day

  • Finnhub Free Tier: 60 API calls/minute

The server uses aggressive caching to stay within free tier limits.

License

MIT

Available Tools

25 tools
cancel_all_ordersA

Cancel all open orders.

Use with caution - this will cancel ALL pending orders.

Returns count of cancelled orders.

Inputs: no named parameters. Returns: object

cancel_orderC

Cancel an open order.

Args: order_id: The order ID to cancel

Returns confirmation of cancellation.

Inputs: order_id (required). Returns: object

close_all_positionsA

Close all open positions.

Use with extreme caution - this will liquidate your entire portfolio. Also cancels all open orders.

Returns count of positions closed.

Inputs: no named parameters. Returns: object

close_positionA

Close an entire position for a symbol.

Args: symbol: Stock symbol to close position for

Places a market order to sell (for long) or buy (for short) all shares of the position.

Inputs: symbol (required). Returns: object

get_analyst_ratingsA

Get analyst ratings and price targets for a stock.

Args: ticker: Stock symbol (e.g., 'AAPL', 'MSFT')

Returns: Analyst consensus, rating counts, and price targets.

Inputs: ticker (required). Returns: object

get_company_profileA

Get company profile and overview.

Args: ticker: Stock symbol (e.g., 'AAPL', 'MSFT')

Returns: Company profile including name, sector, industry, description, etc.

Inputs: ticker (required). Returns: object

get_earningsA

Get earnings history and upcoming earnings date.

Args: ticker: Stock symbol (e.g., 'AAPL', 'MSFT')

Returns: Earnings data including quarterly history and surprises.

Inputs: ticker (required). Returns: object

get_financialsA

Get key financial metrics and ratios.

Args: ticker: Stock symbol (e.g., 'AAPL', 'MSFT')

Returns: Financial metrics including valuation ratios, margins, growth rates.

Inputs: ticker (required). Returns: object

get_historical_pricesA

Get historical price data for a stock.

Args: ticker: Stock symbol (e.g., 'AAPL', 'MSFT') timeframe: Time range - '1D', '1W', '1M', '3M', '1Y', '5Y' interval: Data interval - '1min', '5min', '15min', '30min', '60min', '1day'

Returns: Historical OHLCV data as a list of candles.

Inputs: ticker (required), interval, timeframe. Returns: object

get_insider_tradesA

Get insider trading activity for a stock.

Args: ticker: Stock symbol (e.g., 'AAPL', 'MSFT')

Returns: Recent insider transactions and overall insider sentiment.

Inputs: ticker (required). Returns: object

get_macro_contextA

Get current macroeconomic indicators and context.

Returns: Key economic indicators including Fed funds rate, treasury yields, GDP growth, unemployment, and inflation (CPI).

Inputs: no named parameters. Returns: object

get_news_sentimentA

Get news articles and sentiment analysis for a stock.

Args: ticker: Stock symbol (e.g., 'AAPL', 'MSFT') limit: Maximum number of articles to return (default 20)

Returns: News articles with sentiment scores and overall sentiment summary.

Inputs: ticker (required), limit. Returns: object

get_orderA

Get details of a specific order by ID.

Args: order_id: The order ID returned when placing an order

Returns order status, fill details, and timestamps.

Inputs: order_id (required). Returns: object

get_ordersA

Get a list of orders with optional filters.

Args: status: Filter by status - 'open', 'closed', or 'all' limit: Maximum number of orders to return (default 50) symbol: Filter by stock symbol (optional)

Returns list of orders matching the criteria.

Inputs: limit, status, symbol. Returns: object

get_positionA

Get position for a specific symbol.

Args: symbol: Stock symbol (e.g., 'AAPL')

Returns position details or null if no position exists.

Inputs: symbol (required). Returns: object

get_positionsA

Get all open positions in the portfolio.

Returns a list of positions with:

  • Symbol and quantity

  • Market value and cost basis

  • Unrealized P/L and percentage

  • Current price and average entry price

Inputs: no named parameters. Returns: object

get_quoteA

Get real-time quote for a stock.

Args: ticker: Stock symbol (e.g., 'AAPL', 'MSFT')

Returns: Quote data including price, change, volume, and more.

Inputs: ticker (required). Returns: object

get_support_resistanceB

Calculate support and resistance levels for a stock.

Args: ticker: Stock symbol (e.g., 'AAPL', 'MSFT') lookback_days: Number of days to analyze (default 60)

Returns: Support and resistance levels with current price position.

Inputs: ticker (required), lookback_days. Returns: object

get_technical_indicatorsA

Get technical indicators for a stock.

Args: ticker: Stock symbol (e.g., 'AAPL', 'MSFT') indicators: List of indicators to fetch. Options: 'sma', 'ema', 'rsi', 'macd', 'bbands'. If None, fetches all.

Returns: Technical indicator values and trend analysis.

Inputs: ticker (required), indicators. Returns: object

get_trading_accountA

Get trading account information.

Returns account details including:

  • Buying power and cash available

  • Portfolio value and equity

  • Account status and restrictions

  • Whether this is a paper trading account

Inputs: no named parameters. Returns: object

get_trading_configA

Get current trading configuration and risk limits.

Returns:

  • Whether paper trading is enabled

  • Maximum position size allowed

  • Maximum single order value

  • List of allowed symbols (if restricted)

Inputs: no named parameters. Returns: object

place_limit_orderA

Place a limit order at a specified price.

Args: symbol: Stock symbol (e.g., 'AAPL') qty: Number of shares to trade side: 'buy' or 'sell' limit_price: Maximum price (buy) or minimum price (sell) time_in_force: 'day', 'gtc', 'ioc', 'fok'

Returns order confirmation. Order will only fill at limit_price or better.

Inputs: qty (required), side (required), symbol (required), limit_price (required), +1 more. Returns: object

place_market_orderA

Place a market order to buy or sell shares.

Args: symbol: Stock symbol (e.g., 'AAPL') qty: Number of shares to trade side: 'buy' or 'sell' time_in_force: Order duration - 'day', 'gtc' (good till cancelled), 'ioc' (immediate or cancel), 'fok' (fill or kill)

Returns order confirmation with order ID and status.

Note: Market orders execute at the current market price. Use limit orders for price control.

Inputs: qty (required), side (required), symbol (required), time_in_force. Returns: object

place_stop_limit_orderA

Place a stop-limit order combining stop and limit orders.

Args: symbol: Stock symbol (e.g., 'AAPL') qty: Number of shares to trade side: 'buy' or 'sell' stop_price: Price at which the limit order is triggered limit_price: Limit price for the triggered order time_in_force: 'day' or 'gtc'

When stop_price is reached, a limit order at limit_price is placed.

Inputs: qty (required), side (required), symbol (required), stop_price (required), +2 more. Returns: object

place_stop_orderA

Place a stop order that triggers at a specified price.

Args: symbol: Stock symbol (e.g., 'AAPL') qty: Number of shares to trade side: 'buy' or 'sell' stop_price: Price at which the order becomes a market order time_in_force: 'day' or 'gtc'

Useful for stop-loss orders to limit downside risk.

Inputs: qty (required), side (required), symbol (required), stop_price (required), +1 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 25 tools

    Disambiguation4/5

    Research tools are clearly separated by data type, and order tools are distinct by order type. The only mild ambiguity is between get_trading_account and get_trading_config, and between get_positions/get_position, though singular/plural helps.

    Naming Consistency5/5

    Tool names follow a consistent verb_noun pattern: get_* for data retrieval, place_* for order entry, cancel_* for cancellations, and close_* for position liquidation. There are no mixed naming conventions or vague verbs.

    Tool Count3/5

    25 tools is at the heavy end, especially since the server mixes research functionality with a fairly complete trading execution suite. The count is not unreasonable, but the scope feels broader than the 'stock-research-mcp' name suggests.

    Completeness4/5

    Research coverage is strong: quotes, history, fundamentals, technicals, sentiment, insider trades, and macro context are all present. Trading coverage is also solid with order placement, retrieval, cancellation, and position management, though order modification is missing.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language trading operations through Alpaca's Trading API, supporting stocks, options, crypto, portfolio management, and real-time market data access through AI assistants like Claude.
      MIT
    • A
      license
      C
      quality
      D
      maintenance
      Provides access to real-time and historical stock market data through the Alpha Vantage API, enabling financial analysis and market data queries through natural language.
      100
      118 PyPI
      74
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables trading and portfolio management through the Alpaca API, allowing users to place orders, manage positions and watchlists, access market data, and retrieve account information through natural language.
      22 npm
      4
      ISC
    • F
      license
      Not graded
      quality
      C
      maintenance
      Provides comprehensive stock intelligence and technical analysis by integrating Alpha Vantage and Finnhub data. It enables users to generate detailed research reports and retrieve real-time market metrics, indicators, and news sentiment.
      -