StocksMCP
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@StocksMCPAnalyze Apple stock fundamentals"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
š MCP Stock Research Agent & Dashboard
An AI-powered stock research platform built using the Model Context Protocol (MCP). It implements a fully compliant FastMCP server exposing fundamental analysis, local file-based database CRUD tools, and a dynamic dashboard layout via the Prefab UI protocol, combined with a standalone FastAPI + HTML5 interactive browser terminal.
š Live Demo: stocksmcp-dashboard-sg.onrender.com ā try it now, no install required (free-tier instance, may take ~30s to wake up on first load).
šļø Architecture
User Prompt (e.g., "Analyze National Aluminium")
ā
ā¼
āāāāāāāāāāāāāāāā
ā MCP Client ā
ā (Agent) ā
āāāāāāāā¬āāāāāāāā
ā (stdio connection)
ā¼
āāāāāāāāāāāāāāāā
ā MCP Server ā
ā (FastMCP) ā
āāāāāāāā¬āāāāāāāā
ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā¼ ā¼ ā¼
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā Internet Tool ā ā CRUD Tool ā ā UI Tool ā
ā ā ā ā ā (Prefab UI) ā
ā yfinance API ā ā local reports/ ā ā Generative App ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāThe system is split into two access interfaces:
MCP Protocol Interface: For AI agent clients (like Claude Desktop) using Stdio transport and Prefab UI.
Standalone Web Terminal: A browser interface at
http://localhost:8000presenting a fully responsive dark-themed terminal with real-time Plotly.js charts, quarterly indicators, and side-by-side stock comparisons.
Related MCP server: financial-research-agent
ā” Key Features
Internet Data Tool: Real-time fundamentals, quarterly statement retrieval, and historical OHLCV pricing via
yfinance.Local CRUD Tool: Persistent JSON storage for analyzed stocks under
reports/.UI Communication (Prefab UI): Exposes structural layout component trees (
show_dashboard) to MCP-compatible rendering clients.Valuation Estimation Model: Calculates growth-adjusted fair PE, EPS, and valuation gap percentage.
Growth Scoring System: Evaluates companies out of 10 points based on quarterly revenue/PAT trends, ROE, debt-to-equity, and promoter holdings.
Interactive Candlestick Charts: Fully interactive Plotly.js charting (Zoom, Pan, Hover details, Date range slider).
Stock Comparison: Compare two stocks side-by-side on all fundamental metrics.
š ļø Setup Instructions
1. Prerequisites
Python 3.8 or higher installed on your system.
2. Project Directory Installation
Clone or navigate to the project directory:
cd /Users/pawanthanay/Project/StocksMCP3. Create a Virtual Environment and Install Dependencies
Initialize a Python virtual environment, activate it, and install all required modules (this also installs prefab-ui, the rendering engine behind the show_dashboard Prefab UI tool):
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtmacOS / Homebrew Python troubleshooting: If
pip installfails withImportError: ... Symbol not found: _XML_SetAllocTrackerActivationThreshold(a known Homebrew Python 3.12 ā systemlibexpatmismatch), prefix yourpip/python3commands with the Homebrew expat lib path, e.g.:export DYLD_LIBRARY_PATH="$(brew --prefix expat)/lib:$DYLD_LIBRARY_PATH" pip install -r requirements.txt
4. Configuration
Create a .env file from the example:
cp .env.example .envš Running the Application
Option A: Running the Standalone Web Dashboard (Recommended)
This starts the FastAPI web server. You can view the dashboard in any standard browser:
python3 -m src.web_dashboardOnce started, open your browser and go to: š http://localhost:8000
Select stocks from the dropdown (e.g. National Aluminium, TCS, Infosys) to perform live analysis, view interactive Plotly candlestick charts, read AI-generated summaries, and run comparisons.
Option B: Running the MCP Client Agent (Automatic Workflow)
Run the client script to execute the agentic loop. The agent connects to the server, fetches data, performs calculations, saves the JSON report, and registers the Prefab dashboard:
python3 -m src.client "Analyze National Aluminium stock"To run a different stock, pass it in the prompt:
python3 -m src.client "Analyze TCS stock"Option C: Testing the MCP Server Directly
To run the server in stdio mode (for Claude Desktop or testing):
python3 -m src.serverāļø Deploying the Web Dashboard (Render)
The web dashboard is a standard FastAPI app and can be deployed for free on Render:
Fork or push this repo to your own GitHub account.
On Render, choose New + ā Blueprint and point it at your repo ā it will pick up
render.yamlautomatically and configure the build (pip install -r requirements.txt) and start (uvicorn src.web_dashboard:app --host 0.0.0.0 --port $PORT) commands.Click Apply / Create Web Service. Render builds and deploys automatically, and redeploys on every push to
main.Once live, share the
https://<your-service>.onrender.comURL ā every visitor gets the same live Yahoo Finance data, fetched fresh per request.
Note on region: pick a region other than US-Oregon if you can ā some free-tier shared IP pools (e.g. Render's Oregon pool) are currently IP-blocked by Yahoo Finance, which causes the live dashboard to return empty data even though everything works locally. Singapore's pool is currently unaffected ā that's what powers the live demo above.
No server-side secrets are required: each visitor supplies their own optional
Gemini API key directly in the dashboard UI (used only for that request, never
stored server-side ā see gemini_client.py).
Note: Render's free tier spins the service down after periods of inactivity, so the first request after idling can take ~30ā60 seconds to wake up.
š Growth Scoring System
Ratios are checked and scored out of 10 points:
Revenue Growth QoQ: Growing = 2 points, Flat = 1 point, Declining = 0 points
PAT Growth QoQ: Growing = 2 points, Flat = 1 point, Declining = 0 points
ROE (Return on Equity): >15% = 2 points, 10-15% = 1 point, <10% = 0 points
Debt-to-Equity: <50% (0.5) = 2 points, 50-100% (0.5-1.0) = 1 point, >100% = 0 points
Promoter Holdings: >=50% = 2 points, 30-50% = 1 point, <30% = 0 points
Growth Categories:
0-4 Points: š“ Weak
5-7 Points: š” Neutral
8-10 Points: š¢ Growth
š Project Structure
StocksMCP/
āāā requirements.txt # Python dependencies (fastmcp, yfinance, fastapi, etc.)
āāā .env.example # Template for server & dashboard config
āāā .gitignore # Git rules (ignoring .env and reports/*.json)
āāā reports/ # Directory where local JSON reports are saved
ā āāā NATIONALUM_NS.json # Sample generated report
āāā src/
ā āāā __init__.py # Package init
ā āāā server.py # FastMCP Server containing tool endpoints
ā āāā client.py # MCP client agent running automatic pipelines
ā āāā data_fetcher.py # yfinance scraper & parser
ā āāā analyzer.py # Computes fair value, growth scores, & AI summaries
ā āāā dashboard.py # Prefab UI layout compiler
ā āāā web_dashboard.py # FastAPI server backend
āāā templates/
āāā dashboard.html # HTML5 terminal dashboard with Plotly chartsš Verification Checklist
To verify all requirements are met:
Tool 1: fetch_stock_data: Call
fetch_stock_data("NATIONALUM.NS")ā returns raw stock fundamentals, financials, and historical price history.Tool 2: save_stock_report: Call
save_stock_report("NATIONALUM", report)ā createsreports/NATIONALUM_NS.jsonwith calculated metrics, AI summary, and raw data.Tool 3: show_dashboard: Call
show_dashboard("NATIONALUM.NS")ā registers and returns structural generative UI.CRUD CRUD CRUD: Test update/delete tools (
update_stock_reportanddelete_stock_report).FastAPI Web Server: Run
python3 -m src.web_dashboardand inspect interactive elements athttp://localhost:8000.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityFmaintenanceA comprehensive MCP server for stock analysis and trading insights, including stock screening, fundamental analysis, insider trading, options analysis, social media research, and news analysis.Last updated1074MIT
- Flicense-qualityCmaintenanceMCP server that exposes stock research tools (fundamentals, news, technicals, analyst ratings) to AI clients, enabling autonomous generation of structured investment briefs.Last updated
- Flicense-qualityCmaintenanceA production-grade MCP server that provides tools to fetch historical stock data, company information, and technical indicators (SMA, EMA, RSI, MACD, Bollinger Bands) via yfinance, and includes a Flask web dashboard for visual analysis.Last updated
- Flicense-qualityDmaintenanceA multi-agent MCP server for comprehensive stock research and analysis using natural language queries, backed by SEC filings and real-time market data.Last updated
Related MCP Connectors
Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.
The financial MCP for AI agents - 90+ financial tables, SEC filings, signals, alt-data.
Alpha Vantage MCP ā Stock market data, fundamentals, and earnings
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pawanthanay/StocksMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server