Skip to main content
Glama
sip-advisor-mcp

sip-advisor-mcp

Market-Aware SIP Timing Advisor — FastMCP (workshop)

A ~180-line Python MCP server that turns live NSE index data into an SIP step-up / pause recommendation. Built for the mfAPIs × SunitechAI webinar.

Design: the server owns no data. Raw NIFTY 50 PE and OHLC rows come from the MF Engine REST API; the valuation-percentile, price-trend and SIP-rule logic live here in Python. That split is the teachable part.

Tool

What it does

get_nifty_valuation_context

current PE + percentile + z-score vs 10y history → cheap / fair / expensive

get_nifty_trend

DMA50/200, distance from 52w high/low, 1/3/6m returns → uptrend / sideways / downtrend

recommend_sip_action

band (+ trend) → pause / continue / step_up + suggested new amount

Setup

cd workshop/sip-advisor-mcp
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env      # then paste MFAPI_TOKEN

MFAPI_TOKEN is a JWT access-token for a partner / investor / admin user. Get it from the zinni-app browser session (DevTools → Application → Local Storage, or the Network tab) or a login API call. It is not the MCP static token — the REST endpoints use normal user auth.

Related MCP server: Quant Brain MCP

Run

# stdio — for Claude Desktop
python server.py

# HTTP — for ChatGPT developer mode / remote clients  (serves :8000/mcp)
MCP_TRANSPORT=http python server.py

Quick check without an LLM:

pip install fastmcp   # includes the CLI
fastmcp run server.py --transport http &
npx @modelcontextprotocol/inspector   # connect to http://localhost:8000/mcp

Connect to Claude

Claude Desktop — merge claude_desktop_config.example.json into ~/Library/Application Support/Claude/claude_desktop_config.json (fix the absolute path + token), restart Claude Desktop.

Claude Code

claude mcp add sip-advisor -- python /abs/path/workshop/sip-advisor-mcp/server.py
# set MFAPI_TOKEN in the shell that launches claude, or via --env

Connect to ChatGPT

Run in HTTP mode, expose it (cloudflared tunnel --url http://localhost:8000 or ngrok http 8000), then Settings → Connectors → Advanced → Developer mode → Add the https://…/mcp URL. Regular ChatGPT connectors need search/fetch tools; this server works via developer mode or the Responses API only.

Demo script

"I run a ₹10,000/month NIFTY 50 SIP. Given where the market is, should I step it up, hold, or pause?"

The model chains get_nifty_valuation_context → get_nifty_trend → recommend_sip_action(band, trend, 10000) and explains the call with the PE percentile, the trend, and the as_of date.

Note on data freshness

The prod NSE OHLC / valuation tables can lag the live market by weeks. The tools return as_of — always read it out in the demo, and fix the ingestion in the data repo before going live.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Indian stock market (NSE & BSE) MCP server with 55 tools: live quotes, financials, technicals, a 326-ratio screener, FII/DII flows, option chains with IV, parsed annual reports and concall transcripts, IPOs and portfolio tracking for ~8,200 stocks.
    55
    229 npm
    147
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables natural language quantitative analysis for US and Indian equities, including trade plans, portfolio optimization, backtests, and price alerts using real market data.
    4
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Gives AI assistants live Indian market data without any API keys, spanning NSE quotes and indices, option chains with Greeks, max pain and OI analytics, company financials, shareholding and corporate actions, plus mutual fund NAVs and trailing returns. It also ships research, market-brief and options-positioning prompts so users can compare stocks, trace sector leadership or size up an expiry through natural language.
    13
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI clients to pull live Indian and global market data and run research workflows, including multi-agent stock debate, sentiment and insider-activity detection, options and Greeks analytics, and portfolio risk scanning. It also covers institutional flows, mutual fund overlap, pledge alerts, and macro indicators so users can go from a single question to a ranked, reasoned trade or risk assessment.
    MIT