Skip to main content

A Model Context Protocol server for an investor agent

Project description

MseeP.ai Security Assessment Badge

Trust Score

investor-agent: A Financial Analysis MCP Server

Overview

The investor-agent is a Model Context Protocol (MCP) server that provides comprehensive financial insights and analysis to Large Language Models. It leverages real-time market data, fundamental and technical analysis to deliver:

  • Market Movers: Top gainers, losers, and most active stocks with support for different market sessions
  • Ticker Analysis: Company overview, news, metrics, analyst recommendations, and upgrades/downgrades
  • Options Data: Filtered options chains with customizable parameters
  • Historical Data: Price trends and earnings history
  • Financial Statements: Income, balance sheet, and cash flow statements
  • Ownership Analysis: Institutional holders and insider trading activity
  • Earnings Calendar: Upcoming earnings announcements with date filtering
  • Market Sentiment: CNN Fear & Greed Index, Crypto Fear & Greed Index, and Google Trends sentiment analysis
  • Technical Analysis: SMA, EMA, RSI, MACD, BBANDS indicators (optional)

The server integrates with yfinance for market data and automatically optimizes data volume for better performance.

Architecture & Performance

Robust Caching & Error Handling Strategy:

  1. yfinance[nospam] → Built-in smart caching + rate limiting for Yahoo Finance API
  2. hishel → HTTP response caching for external APIs (CNN, crypto, earnings data)
  3. tenacity → Retry logic with exponential backoff for transient failures

This multi-layered approach ensures reliable data delivery while respecting API rate limits and minimizing redundant requests.

Prerequisites

  • Python: 3.12 or higher
  • Package Manager: uv. Install if needed:
    curl -LsSf https://astral.sh/uv/install.sh | sh
    

Optional Dependencies

Installation

Quick Start

# Core features only
uvx investor-agent

# With technical indicators (requires TA-Lib)
uvx "investor-agent[ta]"

Tools

Market Data

  • get_market_movers(category="most-active", count=25, market_session="regular") - Market movers data including top gainers, losers, or most active stocks. Supports different market sessions (regular/pre-market/after-hours) for most-active category. Returns up to 100 stocks with cleaned percentage changes, volume, and market cap data
  • get_ticker_data(ticker, max_news=5, max_recommendations=5, max_upgrades=5) - Comprehensive ticker report with essential field filtering and configurable limits for news, analyst recommendations, and upgrades/downgrades
  • get_options(ticker_symbol, num_options=10, start_date=None, end_date=None, strike_lower=None, strike_upper=None, option_type=None) - Options data with advanced filtering by date range (YYYY-MM-DD), strike price bounds, and option type (C=calls, P=puts)
  • get_price_history(ticker, period="1mo") - Historical OHLCV data with intelligent interval selection: daily intervals for periods ≤1y, monthly intervals for periods ≥2y to optimize data volume
  • get_financial_statements(ticker, statement_type="income", frequency="quarterly", max_periods=8) - Financial statements (income/balance/cash) with period limiting for context optimization
  • get_institutional_holders(ticker, top_n=20) - Major institutional and mutual fund holders data
  • get_earnings_history(ticker, max_entries=8) - Historical earnings data with configurable entry limits
  • get_insider_trades(ticker, max_trades=20) - Recent insider trading activity with configurable trade limits
  • get_earnings_calendar(start=None, end=None, limit=100) - Upcoming earnings announcements with optional date filtering (YYYY-MM-DD format)

Market Sentiment

  • get_cnn_fear_greed_index(indicators=None) - CNN Fear & Greed Index with selective indicator filtering. Available indicators: fear_and_greed, put_call_options, market_volatility_vix, market_volatility_vix_50, junk_bond_demand, safe_haven_demand
  • get_crypto_fear_greed_index() - Current Crypto Fear & Greed Index with value, classification, and timestamp
  • get_google_trends(keywords, period_days=7) - Google Trends relative search interest for market-related keywords. Requires a list of keywords to track (e.g., ["stock market crash", "bull market", "recession", "inflation"]). Returns relative search interest scores that can be used as sentiment indicators.

Technical Analysis

  • calculate_technical_indicator(ticker, indicator, period="1y", timeperiod=14, fastperiod=12, slowperiod=26, signalperiod=9, nbdev=2, matype=0, num_results=50) - Calculate technical indicators (SMA, EMA, RSI, MACD, BBANDS) with configurable parameters and result limiting. Returns time-aligned data with price history and indicator values. Requires TA-Lib library.

Usage with MCP Clients

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "investor": {
      "command": "uvx",
      "args": ["investor-agent"]
    }
  }
}

Local Testing

For local development and testing, use the included chat.py script:

# Install dev dependencies
uv sync --group dev

# Set up your API key
export OPENAI_API_KEY="your-api-key"  # or ANTHROPIC_API_KEY, GEMINI_API_KEY, etc.

# Optional: Set custom model (defaults to openai:gpt-5-mini)
export MODEL_IDENTIFIER="your-preferred-model"

# Run the chat interface
python chat.py

For available model providers and identifiers, see the pydantic-ai documentation.

Debugging

npx @modelcontextprotocol/inspector uvx investor-agent

License

MIT License. See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

investor_agent-1.3.0.tar.gz (124.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

investor_agent-1.3.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file investor_agent-1.3.0.tar.gz.

File metadata

  • Download URL: investor_agent-1.3.0.tar.gz
  • Upload date:
  • Size: 124.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for investor_agent-1.3.0.tar.gz
Algorithm Hash digest
SHA256 ca45ac34573aada07316b2b572ec7ba9bb7cea56af9d9dfda5b0c409d7c54439
MD5 828025a35dde68d5fffad25840ff4412
BLAKE2b-256 55f314116e0b445456d9410fc7fd601d62a354c09bbfd07a5b8dd54c65e6c923

See more details on using hashes here.

File details

Details for the file investor_agent-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: investor_agent-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for investor_agent-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4d60207845bb46c831424679d5b17d3a503aa9ab28c016aca8a9afa35640607
MD5 583dc77316ab1c2d50eceeb3ffd88e1b
BLAKE2b-256 cbd37489f4cc4d1eda7cec192b3df3b6b5ae79308280830aee21094afac008d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page