Agentic-Investor
Provides comprehensive financial analysis and real-time market data including stock information, options chains, technical indicators, financial statements, earnings calendars, and market sentiment indicators through integration with yfinance and other financial APIs.
README
Agentic-Investor: A Financial Analysis MCP Server
Overview
The Agentic-Investor 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)
- Intraday Data: 15-minute historical stock bars via Alpaca API (optional)
The server integrates with yfinance for market data and automatically optimizes data volume for better performance.
Architecture & Performance
Robust Caching & Error Handling Strategy:
yfinance[nospam]→ Built-in smart caching + rate limiting for Yahoo Finance APIhishel→ HTTP response caching for external APIs (CNN, crypto, earnings data)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
- TA-Lib C Library: Required for technical indicators. Follow official installation instructions.
- Alpaca API: Required for intraday stock data. Get free API keys at Alpaca Markets.
Installation
Quick Start
# Core features only
uvx agentic-investor
# With technical indicators (requires TA-Lib)
uvx "agentic-investor[ta]"
# With Alpaca intraday data (requires Alpaca API keys)
uvx "agentic-investor[alpaca]"
# With all optional features
uvx "agentic-investor[ta,alpaca]"
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 dataget_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/downgradesget_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 volumeget_financial_statements(ticker, statement_types=["income"], frequency="quarterly", max_periods=8)- Financial statements with parallel fetching support. Returns dict with statement type as keyget_institutional_holders(ticker, top_n=20)- Major institutional and mutual fund holders dataget_earnings_history(ticker, max_entries=8)- Historical earnings data with configurable entry limitsget_insider_trades(ticker, max_trades=20)- Recent insider trading activity with configurable trade limitsget_nasdaq_earnings_calendar(date=None, limit=100)- Upcoming earnings announcements using Nasdaq API (YYYY-MM-DD format, defaults to today).fetch_intraday_data(stock, window=200)- Fetch 15-minute historical stock bars using Alpaca API. Returns CSV string with timestamp and close price data in EST timezone. Requiresagentic-investor[alpaca]installation and ALPACA_API_KEY/ALPACA_API_SECRET environment variables.
Market Sentiment
get_cnn_fear_greed_index(indicators=None)- CNN Fear & Greed Index with selective indicator filtering. Available indicators: fear_and_greed, fear_and_greed_historical, put_call_options, market_volatility_vix, market_volatility_vix_50, junk_bond_demand, safe_haven_demandget_crypto_fear_greed_index()- Current Crypto Fear & Greed Index with value, classification, and timestampget_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=100)- Calculate technical indicators (SMA, EMA, RSI, MACD, BBANDS) with configurable parameters and result limiting. Returns dictionary with price_data and indicator_data as CSV strings. matype values: 0=SMA, 1=EMA, 2=WMA, 3=DEMA, 4=TEMA, 5=TRIMA, 6=KAMA, 7=MAMA, 8=T3. Requires TA-Lib library.
Usage with MCP Clients locally
Install mcp-remote
https://www.npmjs.com/package/mcp-remote
npm i mcp-remote
Start the server and add to your claude_desktop_config.json:
uv run python -m agentic_investor.server
{
"mcpServers": {
"Agentic-Investor": {
"command": "npx",
"args": [
"mcp-remote",
"http://0.0.0.0:8000/mcp",
"--allow-http"
]
}
}
}
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
MCP Inspector
npx @modelcontextprotocol/inspector uvx agentic-investor
Debug Logging
Enable detailed debug logging for development and troubleshooting:
# Enable debug logging
export DEBUG_LOGGING=true
# Run with debug logging
DEBUG_LOGGING=true python -m agentic_investor.server
See DEBUG_LOGGING.md for more details on what gets logged and how to use it.
License
MIT License. See LICENSE file for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。