bahi-mcp
This MCP server gives AI assistants access to Indian mutual fund data, NSE/BSE stock and index data, and financial calculators.
Search mutual fund schemes and fetch latest NAV, scheme details, NAV history, and portfolio valuation.
Simulate SIP returns, compare funds on returns/risk, and analyze rolling-return distributions.
Fetch stock quotes, Indian index quotes, and OHLCV price history via Yahoo Finance.
Calculate XIRR, CAGR, EMI, FD/RD maturity, lumpsum future value, SIP projections, SWP sustainability, and retirement corpus/SIP needs.
Estimate mutual fund capital gains tax under FY 2026-27 assumptions, including equity STCG/LTCG and debt slab-rate treatment.
Clear cached AMFI data to fetch fresh NAVs after updates.
Click on "Deploy 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., "@bahi-mcp find SBI midcap direct growth schemes and give me the latest NAV"
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.
bahi-mcp
MCP server that gives AI assistants (Claude, Cursor, VS Code and others) access to Indian mutual fund data, NSE/BSE market data and financial calculators.
Bahi (बही) is the traditional Indian ledger. This server keeps the numbers straight so your assistant doesn't guess them.
Disclaimer: bahi-mcp provides information and calculations from public data sources (AMFI via the
mftoollibrary, and Yahoo Finance for stocks) and from assumptions you supply. It is not investment or tax advice and the author is not a SEBI-registered adviser. Data may be delayed or inaccurate, and tax rules change. Verify before making decisions.
What you can ask
"Compare these three flexi-cap funds on 3-year return, volatility and max drawdown."
"How often has this fund beaten 12% on rolling 3-year returns?"
"If I had invested ₹10,000 a month in scheme 119551 since January 2020, what would it be worth today, and what is my XIRR?"
"What's the Nifty at, and how has RELIANCE done over the last year?"
"How much tax would I pay if I sell this equity fund after 14 months with a ₹2 lakh gain?"
"How much corpus do I need to retire at 55 if I spend ₹60,000 a month today?"
Related MCP server: Fund Dashboard MCP Server
Tools
Mutual fund data (AMFI)
Tool | What it does |
| Search schemes by name, returns AMFI scheme codes |
| Latest NAV and quote for a scheme code |
| Fund house, type, category, start date |
| NAV history with optional date range (capped to keep responses small) |
| Current value of a list of holdings (scheme code + units) |
| Drop cached AMFI data so the next call fetches fresh NAVs |
Mutual fund analytics
Tool | What it does |
| Monthly SIP simulation on a fund's real NAV history: invested, units, value, absolute return, XIRR |
| Side-by-side 1/3/5-year returns, volatility, max drawdown and Sharpe ratio for 1 to 5 funds |
| Distribution of rolling returns: min, max, mean, median, how often positive or above a threshold |
Stocks and market data (NSE/BSE, via Yahoo Finance; unofficial and best-effort)
Tool | What it does |
| Latest price, day and 52-week range for an NSE/BSE stock |
| Nifty 50, Sensex, Bank Nifty, Nifty IT, India VIX |
| OHLCV history for a stock or index |
Calculators
Tool | What it does |
| XIRR for any dated cash flows |
| CAGR between two values over a date range |
| Loan EMI, total payment, total interest |
| Fixed and recurring deposit maturity |
| Future value of a one-time investment |
| SIP projection at an assumed return, with optional yearly step-up |
| Does a corpus last under a monthly withdrawal? |
| Corpus needed and the monthly SIP to build it |
| Capital gains tax estimate on a fund redemption; use purchase/sale dates for exact 12-month classification |
Dates can be DD-MM-YYYY or YYYY-MM-DD.
Install
Requires Python 3.10+.
pip install bahi-mcp # mutual funds + calculators
pip install "bahi-mcp[stocks]" # adds NSE/BSE stock and index dataOr run without installing, using uv:
uvx bahi-mcp
uvx --with yfinance bahi-mcp # with stock dataConfigure your MCP client
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"bahi-mcp": {
"command": "uvx",
"args": ["--with", "yfinance", "bahi-mcp"]
}
}
}Drop "--with", "yfinance" if you don't need stock data. Restart Claude Desktop.
Cursor and other clients
{
"mcpServers": {
"bahi-mcp": {
"command": "uvx",
"args": ["--with", "yfinance", "bahi-mcp"]
}
}
}For Cursor, save this in ~/.cursor/mcp.json. Remove "--with", "yfinance" if you don't need stock data.
Notes on data and accuracy
Mutual fund data comes from AMFI through
mftool(3.4 or newer). NAVs are published after market close, usually by about 9 PM IST. mftool caches NAVs for 24 hours, so useclear_cacheafter the evening update to see the latest.Stock data comes from Yahoo Finance through
yfinance. It is unofficial, can be delayed, rate-limited or change without notice. Don't use it for trading decisions.Tax estimates follow the configured FY 2026-27 assumptions for equity funds (STCG 20%, LTCG 12.5% above the remaining ₹1.25 lakh annual exemption); provide purchase and sale dates for exact calendar 12-month classification, or holding days for an approximate 365-day cutoff. The exemption is shared across eligible gains in a financial year. Debt funds are modelled at slab rate only for units bought on/after 1 April 2023. Surcharge, loss set-off and older indexation rules are not modelled; verify current law and consult a tax professional.
Projections (
project_sip,calculate_swp,plan_retirement) assume constant returns. Real markets don't behave that way.
Development
git clone https://github.com/NayakwadiS/bahi-mcp
cd bahi-mcp
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev,stocks]"
pytest
python -m bahi_mcp # runs the server over stdioLayout in src/bahi_mcp/:
analytics.py,fund_analytics.py,calculators.py: pure Python, no network, fully tested offlinedata.py: AMFI access throughmftoolmarket.py: stock and index access throughyfinanceserver.py: the MCP tool definitions
Roadmap
Portfolio overlap and fund-to-fund correlation
Document search over factsheets and SEBI/RBI circulars
Hosted version with caching
Contributing
Issues and pull requests are welcome.
License
MIT. See LICENSE.
Available Tools
22 toolscalculate_cagrC
CAGR between two values over a date range.
Inputs: end_date (required), start_date (required), final_value (required), initial_value (required). Returns: object
calculate_emiB
Loan EMI, total payment and total interest (reducing balance).
Inputs: years (required), principal (required), annual_rate_pct (required). Returns: object
calculate_fdA
Fixed deposit maturity amount and effective yield (quarterly compounding by default).
Inputs: years (required), principal (required), annual_rate_pct (required), compounding_per_year. Returns: object
calculate_lumpsum_valueB
Future value of a one-time investment at a constant assumed annual return.
Inputs: years (required), principal (required), expected_return_pct (required). Returns: object
calculate_rdC
Recurring deposit maturity amount (quarterly compounding).
Inputs: months (required), annual_rate_pct (required), monthly_deposit (required). Returns: object
calculate_sip_returnsA
Simulate a monthly SIP in a scheme using its real NAV history.
Returns total invested, units, current value, absolute return and XIRR.
end_date defaults to today. Dates as DD-MM-YYYY or YYYY-MM-DD.
Inputs: start_date (required), scheme_code (required), monthly_amount (required), end_date. Returns: object
calculate_swpC
Systematic withdrawal plan: does the corpus last, and how much remains?
Inputs: years (required), corpus (required), monthly_withdrawal (required), expected_return_pct (required). Returns: object
calculate_xirrA
XIRR for dated cash flows.
Each item: {"date": "YYYY-MM-DD", "amount": -10000}. Investments are negative, redemptions / current value positive.
Inputs: cashflows (required). Returns: object
clear_cacheA
Clear cached AMFI data so the next call fetches fresh NAVs.
NAVs are cached for 24 hours. AMFI usually publishes the day's NAVs after about 9 PM IST, so clear the cache after that to see them.
Inputs: no named parameters. Returns: object
compare_fundsA
Compare 1 to 5 mutual funds side by side.
For each fund: latest NAV, 1/3/5-year annualised returns (null if the fund is
too new), and risk over risk_years: volatility, max drawdown and Sharpe ratio.
Inputs: scheme_codes (required), risk_years, risk_free_rate_pct. Returns: object
estimate_mf_taxA
Estimate capital gains tax on a mutual fund redemption (FY 2026-27 rules).
Supply holding_days, or both purchase_date and sale_date for exact calendar
holding-period classification. Equity STCG is 20%; LTCG is 12.5% above the
remaining annual exemption. 'debt'/'other': taxed at slab_rate_pct.
Excludes surcharge and loss set-off. Confirm with a tax professional.
Inputs: sale_amount (required), purchase_amount (required), fund_type, sale_date, +4 more. Returns: object
get_index_quoteA
Latest level of an Indian index: nifty50, sensex, banknifty, niftyit or indiavix.
Inputs: index. Returns: object
get_portfolio_valueB
Current value of a mutual fund portfolio at latest NAVs.
Each holding: {"scheme_code": "119551", "units": 125.5}.
Inputs: holdings (required). Returns: object
get_rolling_returnsA
Rolling-return distribution for a fund.
Shows min, max, mean and median annualised return across all window_years
windows in its history, plus how often it was positive and above
threshold_pct. Better than a single start-to-end return.
Inputs: scheme_code (required), step_days, window_years, threshold_pct. Returns: object
get_scheme_detailsC
Fund house, scheme type, category and start date for a scheme code.
Inputs: scheme_code (required). Returns: object
get_scheme_quoteA
Latest NAV and basic quote for a scheme, by AMFI scheme code.
Inputs: scheme_code (required). Returns: object
get_stock_historyA
Price history (OHLCV) for an NSE/BSE stock or index ticker like '^NSEI'.
period: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max.
interval: 1d, 5d, 1wk, 1mo. Returns at most max_points recent rows.
Inputs: symbol (required), period, exchange, interval, +1 more. Returns: object
get_stock_quoteA
Latest price for an NSE/BSE stock, e.g. symbol 'RELIANCE' on exchange 'NSE'.
Source is Yahoo Finance (unofficial, may be delayed).
Inputs: symbol (required), exchange. Returns: object
plan_retirementC
Corpus needed at retirement and the monthly SIP required to build it.
Inputs: current_age (required), retirement_age (required), life_expectancy (required), current_monthly_expense (required), +4 mor… Returns: object
project_sipA
Project a SIP at an assumed constant return, with an optional yearly step-up.
This is a what-if projection. For a SIP on a real fund's history, use calculate_sip_returns.
Inputs: years (required), monthly_amount (required), expected_return_pct (required), annual_step_up_pct. Returns: object
search_schemesA
Search Indian mutual fund schemes by name (e.g. 'sbi midcap direct growth').
Returns scheme codes (AMFI) and names. Use a code with the other tools.
Inputs: query (required), limit. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
Each tool targets a distinct action/resource: scheme search, scheme data, NAV history, portfolio valuation, mutual-fund returns, tax, calculators, and stock/index quotes. The closest overlap is project_sip versus calculate_sip_returns, but the descriptions explicitly separate what-if SIP projection from real-NAV SIP simulation. No tool pair appears interchangeable.
All tool names use consistent snake_case verb_noun patterns such as get_scheme_quote, calculate_xirr, compare_funds, and get_stock_history. Verb choices vary semantically by operation, but the convention is predictable throughout.
The 22-tool surface is heavy for a single MCP server, though it covers several related areas: mutual funds, financial calculators, and stock/index quotes. Each tool has a plausible role, but the count sits in the borderline-heavy 16–25 range.
Core mutual-fund workflows are well covered: search, scheme details, NAV history, SIP returns, portfolio valuation, comparison, rolling returns, tax estimation, and planning calculators. Minor gaps remain, such as richer scheme metadata like AUM/expense ratio and broader stock search/fundamental operations.
Maintenance
Related MCP Connectors
Indian mutual fund search, latest AMFI NAVs, side-by-side comparison and SIP or lumpsum returns.
India's financial MCP — cards, loans, FDs, insurance, MFs; EMI/SIP/tax calcs; NAV lookup; RAG.
Research Indian mutual funds and manage consent-based portfolio tracking records.
MFAPI.in MCP — Indian mutual-fund NAV (net asset value) data.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables querying Indian mutual fund NAV data through MFAPI.in, providing net asset value information and fund details.99 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to manage and analyze personal investment portfolios, including fund and stock holdings, net value tracking, XIRR calculations, penetration analysis, and backtesting.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceProvides AI assistants with real-time Indian mutual fund NAV data from AMFI's official feed, requiring no API key.MIT
- FlicenseNot gradedqualityCmaintenanceEnables querying Indian mutual fund NAV analytics via DuckDB, offering tools for fund search, point-to-point returns, category rankings, and more, using local or Azure parquet data.-