financial-research-agent
MCP server that exposes stock research tools (fundamentals, news, technicals, analyst ratings) to AI clients, enabling autonomous generation of structured investment briefs.
README
AI Financial Research Agent
An autonomous stock research agent built with LangGraph, LangChain, and the ReAct pattern. It researches any ticker — fundamentals, news sentiment, technical indicators, and analyst consensus — then produces a structured buy/sell investment brief.
Includes a Streamlit web UI, MCP server for tool exposure, and session tracking for the full ReAct loop.
Based on Building a Financial Research Agent with ReAct, LangGraph, and LangChain.
Features
- ReAct Agent Loop — Agent decides tool order dynamically (Reason → Act → Observe)
- 4 Research Tools — Fundamentals, news sentiment, technicals, analyst ratings
- Streamlit UI — Live ReAct step tracking + investment brief display
- Session Tracking — Persisted JSON logs of every research session
- MCP Server — Expose tools to Cursor, Claude Desktop, or any MCP client
- Ticker Normalization — Handles mixed case input (
reliance.ns→RELIANCE.NS)
Project Structure
financial-research-agent/
├── app/
│ └── streamlit_app.py # Streamlit web interface
├── financial_mcp/
│ ├── server.py # MCP server (stdio transport)
│ └── config.json # Sample MCP client config
├── src/financial_agent/
│ ├── state.py # LangGraph agent state
│ ├── tools.py # Research tools (yfinance, Tavily, pandas-ta)
│ ├── agent.py # LLM + system prompt
│ ├── graph.py # LangGraph ReAct graph
│ ├── runner.py # Streaming runner with tracking
│ ├── utils.py # Ticker normalization
│ └── tracking/
│ └── session_tracker.py # ReAct step & session persistence
├── data/sessions/ # Tracked research sessions (JSON)
├── main.py # CLI entry point
├── requirements.txt
├── .env.example
└── README.md
Setup
1. Clone and install
cd financial-research-agent
python -m venv .venv
.venv\Scripts\activate # Windows
pip install -r requirements.txt
2. Configure API keys
Copy .env.example to .env and add your keys:
OPENAI_API_KEY=your_openai_key
TAVILY_API_KEY=your_tavily_key
OPENAI_MODEL=gpt-4o
Get a free Tavily key at tavily.com.
3. Run
Streamlit UI (recommended):
streamlit run app/streamlit_app.py
CLI:
python main.py RELIANCE.NS
python main.py AAPL
MCP Server:
python -m financial_mcp.server
Add to your MCP client config (see financial_mcp/config.json):
{
"mcpServers": {
"financial-research-agent": {
"command": "python",
"args": ["-m", "financial_mcp.server"],
"cwd": "/path/to/financial-research-agent",
"env": { "PYTHONPATH": "/path/to/financial-research-agent/src" }
}
}
}
Architecture
User: "Research RELIANCE.NS"
│
▼
┌─────────────┐ tool_call ┌─────────────┐
│ Agent Node │ ─────────────────► │ Tools Node │
│ (LLM) │ ◄───────────────── │ (ToolNode) │
└─────────────┘ observation └─────────────┘
│
▼ (no more tool calls)
Final Investment Brief
Session Tracking
Every research run is tracked step-by-step:
| Step Type | Description |
|---|---|
tool_call |
Agent decides to call a tool |
tool_result |
Tool observation returned |
final_brief |
Structured investment brief |
Sessions are saved to data/sessions/{session_id}_{ticker}.json.
Supported Tickers
| Market | Format | Example |
|---|---|---|
| US | SYMBOL |
AAPL, MSFT |
| NSE | SYMBOL.NS |
RELIANCE.NS |
| BSE | SYMBOL.BO |
RELIANCE.BO |
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.