FinanceMCP
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., "@FinanceMCPShould I buy TCS stock?"
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.
FinanceMCP – AI Financial Intelligence Platform
FinanceMCP is an end‑to‑end AI financial intelligence platform that combines:
AI stock advisor
financial resilience predictor
portfolio analysis and optimization
market regime detection
AI‑driven stock forecasting
The system merges ideas from machine learning, quantitative finance, technical analysis, and macro indicators into a unified AI assistant for Indian markets.
The same backend powers:
A React dashboard for human users.
Programmatic APIs for developers and quants.
An AI‑native MCP server that exposes tools to language models.
Live demo: https://bharatfinancemcp.netlify.app/
Core Features
AI Stock Advisor
Conversational AI that answers real‑world investment questions such as:
“Should I buy this stock?”
“Give me a fundamentals view on TCS.”
“What do RSI and MACD say about INFY?”
“What’s the AI‑predicted return for RELIANCE?”
“What is the current market regime?”
“How should I rebalance my portfolio?”
Under the hood, the advisor:
Parses natural‑language queries into structured intents.
Fetches live market data and technical indicators.
Runs ensemble prediction models and quant screens.
Generates human‑readable, risk‑aware explanations.
See docs/AI_ADVISOR.md for a deep dive into the advisor architecture.
Financial Resilience Predictor
The financial resilience predictor estimates how well a person can handle financial shocks (job loss, market crashes, emergencies).
Inputs typically include:
income
savings and liquid assets
recurring expenses
debt and EMIs
employment stability / sector risk
Output:
a financial resilience score (0–100)
qualitative risk band (e.g. strong / moderate / vulnerable)
runway in months and scenario‑specific adjustments
This module uses ML models, Monte Carlo simulation, and macro stress signals to summarize a household’s shock‑absorbing capacity.
See docs/RESILIENCE_PREDICTOR.md for full details.
AI Prediction Engine
The prediction engine forecasts short‑term stock movements using an ensemble of models:
Uses:
price momentum signals
technical indicators (RSI, MACD, moving averages)
volatility modeling and regime adjustments
Outputs:
expected return (as a fraction or %)
predicted price for a selected horizon
confidence score/label
These predictions are surfaced via:
Advisor endpoints (
/advisor/v2,/advisor/v3,/advisor/v4).The conversational AI advisor (Advisor V5) for “What does AI predict for X?” queries.
Portfolio Intelligence
Portfolio analytics modules provide:
Risk analysis – volatility, drawdown, concentration, beta‑like metrics.
Diversification scoring – sector/stock concentration and Herfindahl‑style indices.
Allocation analysis – sector and asset‑class level splits.
Optimization – Markowitz‑style approximations to suggest more balanced allocations.
These capabilities feed into both:
REST APIs for portfolio dashboards.
The AI advisor’s “analyze my portfolio” and “how should I rebalance?” intents.
Cross-Market Causality Engine
Cross-Market Causality Engine – Live macro signal tracking (bond yields, crude oil, USD/INR, gold, India VIX) with rule-based causal inference connecting macro events to sector impacts. See
docs/cross_market_causality.md.
Market Regime Detection
Market regime engines classify the current state of the index (e.g. NIFTY) as:
bullish
bearish
sideways / range‑bound
using:
trend strength
volatility levels
recent index returns
The regime is used to:
Provide standalone market context (“What is the market regime?”).
Adjust portfolio and position‑sizing suggestions inside the AI advisor.
Related MCP server: Indian Market MCP
Tech Stack
Frontend
React + Vite – modern SPA architecture.
TailwindCSS and custom components for charts, watchlists, and the chat UI.
Backend
FastAPI – high‑performance Python API server.
Layered services in
backend/app/servicesfor data, analytics, and AI.
ML / Quant
Python (NumPy, pandas, scikit‑learn, etc.).
Custom models and heuristics for:
ensemble price prediction
volatility modeling
portfolio risk scoring
financial resilience estimation.
Market Data
yfinance – quotes, historical OHLCV, and basic fundamentals.
Additional HTTP APIs for mutual funds, macro data, and news when configured.
Visualization
Charting libraries on the frontend (e.g. candlesticks, line charts, gauges).
Textual summaries and tabular views in the AI advisor responses.
System Architecture
The AI advisor stack is organized into layers, each with a focused responsibility.
Layer 1 – Query Router & Intent Parser
Parses the user’s natural‑language query.
Extracts:
primary intent (e.g. prediction, comparison, portfolio analysis)
entities (stock symbols, sectors, time horizons)
additional constraints (risk appetite, long‑term vs short‑term, etc.).
Routes to one or more downstream engines:
prediction
technicals
quant models
portfolio analytics
resilience predictor.
Layer 2 – Market Data Engine
Fetches:
current prices
OHLCV history
sector and index data
news headlines.
Normalizes data into a consistent internal structure reused across advisor versions.
Layer 3 – Technical Indicator Engine
Computes:
RSI
MACD and signal line
simple / exponential moving averages (SMA20, SMA50, SMA200, etc.)
momentum and overbought/oversold flags.
Exposes outputs to both REST APIs and higher‑level advisor modules.
Layer 4 – Prediction Engine
Ensemble models ingest:
recent price history
volatility estimates
technical indicators and simple features.
Produces:
expected return
predicted price for each horizon
confidence score / label.
Layer 5 – Advisor Reasoning Engine
Combines signals from:
prediction engine
technical indicators
market regime detector
news sentiment
portfolio risk modules.
Produces:
multi‑factor stock scores
explanations and rationales
recommendations tagged with risk and confidence.
Layer 6 – Response Generator
Converts structured analysis into human‑readable responses:
formatted text
sections (Summary, Interpretation, Risk, Conclusion)
comparison tables for multi‑stock queries.
Guarantees that chat responses are never raw JSON, making them suitable for both humans and AI tools.
Project Structure
High‑level layout:
bharat-finance-ai/
├── backend/
│ ├── main.py
│ ├── mcp_server.py
│ └── app/
│ ├── routes/ # API endpoints (stocks, technicals, portfolio, advisor, resilience, etc.)
│ ├── services/ # Core business and analytics logic
│ ├── utils/
│ └── models/
├── src/
│ ├── server.py # Finance MCP server (tools over stdio)
│ ├── tools/ # Mutual funds, IPO, macro, tax tools
│ └── utils/ # MCP payload optimizer
├── frontend/
│ ├── src/
│ │ ├── components/ # Chat, charts, watchlists, dashboards
│ │ ├── pages/ # Dashboard, Resilience Predictor, etc.
│ │ ├── context/
│ │ ├── lib/
│ │ └── services/
│ └── package.json
├── docs/ # Technical documentation (AI advisor, resilience predictor, MCP, ...)
└── README.mdKey advisor/quant modules
backend/app/routesAPI endpoints for stocks, technical indicators, portfolio, advisor, resilience, and cross-market.
backend/app/servicesadvisor_v2 – prediction engine and signal scoring.
advisor_v3 – reasoning engine.
advisor_v4 – quant engine (regime detection, strategies, risk).
advisor_v5 – chat interface, intent parsing, and response generation.
cross_market_service.py – live macro signal fetcher.
causality_engine.py – rule-based causal inference.
backend/app/utilscache.py – TTL in-memory cache.
yfinance_wrapper.py – cached yfinance wrapper.
frontendReact UI, including the AI Advisor chat, Resilience Predictor screens, and CrossMarketPanel.
frontend/src/componentsCrossMarketPanel.jsx – macro intelligence dashboard.
docsAI_ADVISOR.md– detailed advisor architecture.RESILIENCE_PREDICTOR.md– resilience prediction system.cross_market_causality.md– causality engine documentation.
External APIs and Data Sources
The platform is designed to reuse existing, battle‑tested data sources:
yfinance
Stock quotes, OHLCV history.
Basic fundamentals (PE, dividend yield, sector, market cap).
Index and sector data.
Mutual fund APIs (e.g.
mfapi.in)NAV history and scheme metadata for Indian mutual funds.
Macro indicators
GDP growth (e.g. World Bank).
Inflation / CPI series.
RBI repo rate and other policy rates.
Market news APIs (optional)
For simple sentiment and macro stress heuristics.
The specific configuration of keys and endpoints is environment‑driven; see environment configuration files for details.
Algorithms and Indicators
Key financial and ML/quant building blocks used in the system include:
RSI (Relative Strength Index)
MACD (Moving Average Convergence Divergence) and signal line
Moving averages
SMA20
SMA50
SMA200
Momentum indicators
Ensemble prediction models
Volatility estimation
standard deviation of log returns
regime‑aware heuristics.
Portfolio risk scoring
diversification and concentration measures
simple VaR/ES‑style metrics in quant modules.
Mathematical Formulas (Core)
Relative Strength Index (RSI)
[ RSI = 100 - \left( \frac{100}{1 + RS} \right) ]
where:
[ RS = \frac{\text{average gain}}{\text{average loss}} ]
over a chosen look‑back period (commonly 14 days).
MACD (Moving Average Convergence Divergence)
[ MACD = EMA_{12} - EMA_{26} ]
with:
( EMA_{12} ): 12‑period exponential moving average.
( EMA_{26} ): 26‑period exponential moving average.
Signal line:
[ \text{Signal} = EMA_9(MACD) ]
Histogram:
[ \text{Histogram} = MACD - \text{Signal} ]
Expected Return
For a single forecast horizon:
[ \text{Expected Return} = \frac{\text{Predicted Price} - \text{Current Price}}{\text{Current Price}} ]
This is typically expressed as a percentage in the advisor responses.
Volatility
Volatility is approximated as the standard deviation of log returns:
[ r_t = \ln\left(\frac{P_t}{P_{t-1}}\right) ] [ \sigma = \sqrt{\frac{1}{N-1}\sum_{t=1}^{N} (r_t - \bar{r})^2} ]
where:
( P_t ) is the price at time ( t ).
( r_t ) is the log return.
( \sigma ) is the volatility estimate.
Z‑score (Volume analysis)
Used in unusual‑volume / smart‑money style scans:
[ Z = \frac{\text{Current Volume} - \text{Mean Volume}}{\text{Standard Deviation of Volume}} ]
Higher positive ( Z ) suggests unusually high volume; low or negative values suggest normal or weak participation.
What Makes This Project Unique
Compared with tools like Yahoo Finance, TradingView, or generic ChatGPT financial plug‑ins, this project is designed as a modular AI financial platform:
AI conversational advisor
Domain‑aware intent parsing and symbol resolution.
Multi‑layer reasoning with predictions, technicals, and regime context.
Quant‑based predictions
Ensemble forecasts instead of single black‑box outputs.
Rich factor breakdowns for transparency.
Portfolio intelligence
Risk and diversification analytics.
Example optimizations and rebalancing hints.
Market regime detection
Explicit bull/bear/sideways classification.
Integration into position sizing and risk commentary.
ML resilience prediction
Household‑level financial resilience, not just asset‑level risk.
Modular AI architecture
Advisor V2–V5 are composable, making it easy to extend or swap models without breaking the frontend.
The result is a stack that is suitable both for end‑users (via the dashboard) and AI agents (via MCP tools and structured APIs).
Future Improvements
Some directions for extending FinanceMCP:
Real‑time market data feeds
WebSocket quotes and order‑book snapshots.
Intraday regime and microstructure‑aware indicators.
Deep learning models
LSTM / Transformer models for sequence prediction.
Hybrid models combining fundamentals and price action.
Enhanced institutional flow detection
More granular volume‑profile analysis.
Cross‑asset and derivatives‑driven flow heuristics.
Risk‑adjusted portfolio optimization
Sharpe, Sortino, and drawdown‑aware optimizers.
Multi‑objective optimization (return, risk, diversification).
Richer explanation layers
Counterfactual “what‑if” analysis for portfolios.
Scenario‑based narratives (e.g. rate‑hike shocks, sector rotations).
Getting Started (Quick)
Backend
cd backendpython -m venv venv && venv\Scripts\activate(Windows) orsource venv/bin/activate(Unix)pip install -r requirements.txtuvicorn main:app --host 127.0.0.1 --port 8000
Frontend
cd frontendnpm installnpm run dev
Open the app in your browser and explore:
AI Advisor chat.
Technical analysis tools.
Portfolio and resilience modules.
For deeper internals, start with:
docs/AI_ADVISOR.mddocs/RESILIENCE_PREDICTOR.md
Setup
Prerequisites
Python 3.9+
Node.js 18+
Firebase project (Auth + Realtime Database)
Backend
Navigate to the backend directory:
cd backendCreate and activate a virtual environment:
python -m venv venv # Windows: venv\Scripts\activate # macOS/Linux: source venv/bin/activateInstall dependencies:
pip install -r requirements.txtStart the server:
uvicorn main:app --host 127.0.0.1 --port 8000API:
http://127.0.0.1:8000Swagger:
http://127.0.0.1:8000/docs
Frontend
Navigate to the frontend directory:
cd frontendInstall dependencies:
npm installStart the dev server:
npm run devApp:
http://localhost:5173(or next available port)Ensure the backend is running at
http://localhost:8000
Firebase
Configure Firebase in frontend/src/lib/firebase.ts with your project config. Ensure:
Authentication – Email/Password sign-in method enabled
Realtime Database – Rules allow read/write for authenticated users, e.g.:
{ "rules": { "users": { "$uid": { ".read": "$uid === auth.uid", ".write": "$uid === auth.uid" } } } }
API Overview
High‑level view of key backend routes (see /docs for the full OpenAPI schema):
Endpoint | Method | Description |
| GET | Health check |
| GET | Stock quote for NSE/BSE symbol |
| GET | Search stocks by name or symbol |
| GET | Curated list of popular NSE stocks |
| GET | RSI for a symbol |
| GET | MACD for a symbol |
| GET | Market news for a stock/index via yfinance |
| GET | Latest NAV for a mutual fund scheme |
| GET | Mutual fund search by name/keyword |
| GET | SIP future value calculator |
| GET | Capital gains/tax calculator (equity/debt) |
| GET | Upcoming IPOs |
| GET | Grey Market Premium data |
| GET | Recent IPO listing performance |
| GET | SME stock analysis |
| GET | Detailed performance for a sector |
| GET | Performance summary across sectors |
| GET | List of supported sector names |
| GET | Latest RBI repo rate |
| GET | India CPI inflation time‑series |
| GET | India GDP growth time‑series |
| POST | Portfolio risk/return and sector analytics |
| POST | Lightweight portfolio summary |
| POST | Financial shock resilience scoring (ML + simulation) |
| POST | Advisor V2: stock analytics (optional) |
| POST | Advisor V2: portfolio analytics (optional) |
| POST | Advisor V3: reasoning + factor scoring (optional) |
| POST | Advisor V4: quant strategies + VaR/ES (optional) |
| POST | Advisor V5: conversational assistant (optional) |
| GET | Advisor V5: AI insights feed (optional) |
| GET | Live macro signals |
| GET | Signals + causal insights |
Documentation
AI Advisor (V1–V6):
docs/AI_ADVISOR.mdCross-Market Causality Engine:
docs/cross_market_causality.mdResilience Predictor:
docs/RESILIENCE_PREDICTOR.mdMCP setup:
docs/mcp_setup.md
MCP Tools Overview
The BharatFinanceMCP_v1 server (in src/server.py) exposes a set of AI-first tools over MCP/stdio. Highlights:
Mutual funds (
src/tools/mutual_funds.py)get_mutual_fund_nav_tool– Latest NAV and daily change for a scheme.mutual_fund_search_tool– Search schemes viamfapi.in.sip_calculator_tool– SIP projection using standard compounding.
IPO & SME (
src/tools/ipo.py)get_upcoming_ipos_tool– Mainboard + SME IPO pipeline with key terms.get_ipo_gmp_tool– Grey Market Premium (GMP) with fuzzy name matching.get_ipo_subscription_tool– Live subscription (QIB / NII / Retail).
Macroeconomy (
src/tools/macro.py)get_rbi_rates_tool– RBI policy rates + CRR (scraped with fallbacks).get_india_inflation_tool– Latest CPI from World Bank, WPI note.get_india_gdp_growth_tool– Latest annual GDP growth (World Bank).get_forex_reserves_tool– FX reserves (USD mn) from RBI WSS.
Tax calculators (
src/tools/calculators.py)calculate_indian_tax_tool– Indian capital-gains estimate for equity, equity MF, debt MF, and gold, with INR output formatted in lakhs/crores.
All MCP tools are wrapped with optimize_payload from src/utils/optimizer.py to:
Trim historical price arrays to the last 5 entries.
Truncate long descriptions / news summaries to ~200 characters.
Drop non-essential metadata (like
uuid,internal_id).
This adaptive truncation helps prevent “overloaded context” errors in AI clients while preserving the essential financial insight.
Environment Variables
All API keys and secrets must be set via environment variables. Copy .env.example to .env in each directory and fill in values. Never commit .env files — they are in .gitignore.
Backend
Copy backend/.env.example to backend/.env:
Variable | Description |
| Comma-separated list of frontend URLs |
| Mutual fund API base (optional, has default) |
| NSE equities list URL (optional) |
| World Bank inflation API (optional) |
| World Bank GDP API (optional) |
| IPO list source URL (optional) |
| IPO performance source (optional) |
| GMP data source URL (optional) |
Frontend (Vite)
Copy frontend/.env.example to frontend/.env:
Variable | Description |
| Backend API base URL |
| Firebase API key (required) |
| Firebase auth domain |
| Firebase project ID |
| Firebase storage bucket |
| Firebase messaging sender ID |
| Firebase app ID |
| Firebase analytics measurement ID (optional) |
| NewsAPI key for news fallback (optional) |
| Finnhub key for news fallback (optional) |
| CORS proxy URL (optional) |
| Mutual fund search API base (optional) |
Deploy to Render
The backend is configured for Render.
Blueprint
Push this repo to GitHub.
In Render Dashboard, create a Blueprint.
Connect the repo; Render will use
render.yaml.Add
CORS_ORIGINSwith your frontend URL(s).
Manual Web Service
Create a Web Service on Render.
Configure:
Root Directory:
backendBuild:
pip install -r requirements.txtStart:
uvicorn main:app --host 0.0.0.0 --port $PORT
Add
CORS_ORIGINS(comma-separated URLs).
After deployment, set the frontend baseURL in api.js to your Render API URL.
License
MIT
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
- Alicense-qualityCmaintenanceAn MCP server that provides comprehensive Indian stock market data from the NSE and BSE, including live quotes, historical trends, and fundamental analysis. Users can compare stock performance, track major indices, and access financial statements without the need for an API key.Last updated2MIT
- AlicenseBqualityBmaintenanceA comprehensive MCP server for the Indian stock market, providing 68 tools for stocks, derivatives, mutual funds, commodities, and more without any API keys.Last updated683MIT
- AlicenseAqualityBmaintenanceMCP server for Indian stock market data. Provides 16 tools for quotes, history, fundamentals, mutual funds, indices, corporate actions, options, IPOs, and portfolio analysis.Last updated16615MIT
- FlicenseAqualityAmaintenanceAn advanced MCP server for real-time worldwide stock market data, technical indicators, financials, news, and Python sandboxing with AI models, supporting US and Indian markets.Last updated29
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
Open-source MCP server for Zerodha Kite Connect. Portfolio, market data, backtesting, alerts.
Hosted MCP for stocks, options, Greeks, brokers, order previews, alerts, and workflows.
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/Beta0024/FinanceMCP_v4'
If you have feedback or need assistance with the MCP directory API, please join our Discord server