Skip to main content
Glama
sip-advisor-mcp

sip-advisor-mcp

市场感知的 SIP 时机顾问 — FastMCP(工作坊)

一个约 180 行的 Python MCP 服务器,将实时 NSE 指数数据转化为 SIP 加投(step-up)/暂停建议。为 mfAPIs × SunitechAI 网络研讨会而构建。

**设计:**服务器自身不持有数据。原始 NIFTY 50 PE 和 OHLC 行数据来自 MF Engine REST API;估值百分位、价格趋势和 SIP 规则逻辑则用 Python 写在这里。这种拆分正是教学点所在。

工具

功能说明

get_nifty_valuation_context

当前 PE + 百分位 + 相对 10 年历史的 z-score → cheap / fair / expensive

get_nifty_trend

DMA50/200、距 52 周高点/低点的距离、1/3/6 个月回报 → uptrend / sideways / downtrend

recommend_sip_action

区间(+ 趋势)→ pause / continue / step_up + 建议的新金额

设置

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 是面向合作伙伴 / 投资者 / 管理员用户的 JWT access-token。可从 zinni-app 浏览器会话(DevTools → Application → Local Storage,或 Network 标签页)或登录 API 调用中获取。它不是 MCP 静态令牌 —— REST 端点使用普通用户认证。

Related MCP server: Quant Brain MCP

运行

# stdio — for Claude Desktop
python server.py

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

无需 LLM 的快速检查:

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

连接到 Claude

Claude Desktop —— 将 claude_desktop_config.example.json 合并到 ~/Library/Application Support/Claude/claude_desktop_config.json(修正绝对路径 + 令牌),然后重启 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

连接到 ChatGPT

以 HTTP 模式运行并暴露它(cloudflared tunnel --url http://localhost:8000 或 ngrok http 8000),然后设置 → 连接器 → 高级 → 开发者模式 → 添加 https://…/mcp URL。普通 ChatGPT 连接器需要 search/fetch 工具;此服务器只能通过开发者模式或 Responses API 使用。

演示脚本

“我每月投资 ₹10,000 的 NIFTY 50 SIP。鉴于当前市场所处的位置,我该加投、持有还是暂停?”

模型会将 get_nifty_valuation_context → get_nifty_trend → recommend_sip_action(band, trend, 10000) 串联起来,并结合 PE 百分位、趋势以及 as_of 日期解释该调用。

关于数据新鲜度的说明

生产环境中的 NSE OHLC / 估值表可能比实时市场滞后数周。工具会返回 as_of —— 在演示中务必读出该日期,并在上线前修复数据仓库中的数据摄取逻辑。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    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
      143 npm
      151
      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.
      10
      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