NAV Analytics MCP Server
Enables 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.
README
NAV Analytics MCP Server (standalone)
A self-contained MCP server that exposes Indian mutual fund NAV analytics as
tools, querying parquet data through DuckDB — local files or Azure Blob.
No external package or framework of yours is required. The server runs only
read-only SELECTs and never fabricates data.
Tested with mcp==1.28.1, duckdb==1.5.4, python-dateutil==2.9.0.post0.
Files
server.py the MCP server (all tool logic; self-contained)
make_sample_data.py SYNTHETIC fixture generator — dev/smoke-test only
requirements.txt pinned deps
Install
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
Data
The server expects two parquet sources with this schema:
nav_history scheme_code VARCHAR, nav_date DATE, nav DOUBLE
scheme_master scheme_code VARCHAR, scheme_name VARCHAR,
fund_house VARCHAR, category VARCHAR
Point it at data with environment variables (defaults shown):
NAV_HISTORY_PATH ./data/nav_history.parquet
SCHEME_MASTER_PATH ./data/scheme_master.parquet
No data yet? Generate a synthetic fixture to prove the server runs:
python make_sample_data.py # writes ./data/*.parquet
The fixture is a random walk — not real fund data. Replace it with real AMFI-derived parquet before trusting any number.
Azure Blob. Set a connection string and the paths may be az:// URLs; the
server loads DuckDB's azure extension and registers a secret automatically:
export AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=...;AccountKey=...;"
export NAV_HISTORY_PATH="az://mycontainer/nav/*.parquet"
export SCHEME_MASTER_PATH="az://mycontainer/scheme_master.parquet"
Run
python server.py # streamable HTTP at /mcp (default)
MCP_TRANSPORT=stdio python server.py # stdio (for local Cursor / Claude Desktop)
The HTTP mode is what you host as a claude.ai custom connector (below). The stdio mode is the original local mode for Cursor / Claude Desktop.
Host it for the team as a claude.ai connector
Goal: your team uses this in the claude.ai web app, plug-and-play — each teammate adds one URL, nobody installs Python or handles the Azure key. That means hosting the server once over HTTPS with OAuth.
1. Rotate the Azure key first
The old .cursor/mcp.json committed a live Storage account key. Rotate it in
the Azure portal. The new key goes only into the host's settings below — never
into a committed file.
2. Deploy (Azure App Service)
A Dockerfile is included. Build/push the image (or use App Service's
build-from-source), then set these application settings:
AZURE_STORAGE_CONNECTION_STRING <rotated connection string>
NAV_HISTORY_PATH az://mfnavdata/processed/nav_history/year=*/*.parquet
SCHEME_MASTER_PATH az://mfnavdata/processed/scheme_master.parquet
PUBLIC_BASE_URL https://<your-app>.azurewebsites.net
App Service terminates HTTPS and injects $PORT automatically.
Auth. Setting PUBLIC_BASE_URL turns on OAuth: the server runs its own
self-contained OAuth authorization server (fastmcp's InMemoryOAuthProvider) and
advertises the discovery endpoints claude.ai probes — no Azure App
Registration, external identity provider, or scope configuration required.
claude.ai registers itself dynamically and completes the handshake. Any client
that completes the flow is granted access, so this gates on knowing the URL plus
the OAuth handshake — appropriate for a small trusted team behind a URL you
control. (Tokens are in-memory: a server restart means teammates click "reconnect"
once. To add real per-user identity + revocation later, swap in a hosted provider
— Google/GitHub/WorkOS — by editing only _build_auth() in server.py.)
If PUBLIC_BASE_URL is unset, the server runs unauthenticated — use that
only for local testing, never public hosting.
3. Each teammate adds the connector (one-time)
In claude.ai → Settings → Connectors → Add custom connector → paste:
https://<your-app>.azurewebsites.net/mcp
Complete the Entra sign-in when prompted. The 5 NAV tools then appear in the connector picker in any chat. (Personal claude.ai plans can't push org-wide, so each teammate does this once — but that's the whole setup.)
Register with a local client (stdio)
For local use in Cursor (.cursor/mcp.json) or Claude Desktop
(claude_desktop_config.json) — set MCP_TRANSPORT=stdio:
{
"mcpServers": {
"nav-analytics": {
"command": "/absolute/path/to/venv/bin/python",
"args": ["/absolute/path/to/server.py"],
"env": {
"MCP_TRANSPORT": "stdio",
"NAV_HISTORY_PATH": "/absolute/path/to/data/nav_history.parquet",
"SCHEME_MASTER_PATH": "/absolute/path/to/data/scheme_master.parquet"
}
}
}
}
Use absolute paths for command, args, and any file paths; MCP clients don't
run in your project directory. For Azure, put the connection string in env
instead of the local paths.
Tools
- search_funds(query, limit=10) — fuzzy fund-name → scheme_code resolver. Call this first when the user names a fund; feed the resulting code into the returns tools. Returns Regular/Direct and Growth/IDCW variants separately.
- get_fund_returns(scheme_codes, period) — point-to-point
return_pctand annualizedcagr_pctfor one or many funds.cagr_pctis populated only for windows longer than a year (2Y/3Y/5Y, and SI when the fund is >1yr old); it isnullfor shorter windows. - get_category_returns(category, period, sort_by, ascending, staleness_days=7) — returns for every fund in a category, ranked, with a staleness guard.
- list_categories() / list_funds_in_category(category) — discovery.
Periods: 1W 2W 1M 3M 6M 9M 1Y 2Y 3Y 5Y YTD MTD SI.
Conventions worth knowing
- Per-fund anchor. Every window ends at each fund's own latest NAV, not the calendar today (the latest NAV may lag a day or two; non-trading days have no NAV). This matches how Value Research / ET Money report.
- Full-period start. For trailing windows the start snaps to the latest NAV
on/before
(anchor − period)so you capture a complete period. YTD/MTD anchor to the first NAV on/after the calendar start; SI starts at inception. - Staleness. In category queries, a fund whose last NAV lags the category's
freshest as-of date by more than
staleness_daysis flaggedstale, kept in the results list, and excluded fromavg_return_pct/avg_cagr_pctso the averages never blend mismatched as-of dates. - One connection. The server opens a single read-only DuckDB connection at startup and holds it for the process lifetime.
Before trusting the numbers
Validate the start-boundary convention against a golden reference: take one real
fund, compute 1Y/3Y/5Y, and compare to its published figures for the same
as-of date (align the as-of first, or a date mismatch will look like a math
bug). If trailing returns come out consistently low, flip the trailing start
snap from on/before to on/after (anchor − period) in _resolve_window.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。