Skip to main content
Glama
sip-advisor-mcp

sip-advisor-mcp

マーケット連動SIPタイミングアドバイザー — FastMCP(ワークショップ)

約180行のPython MCPサーバーで、ライブNSEインデックスデータをSIPのステップアップ/一時停止の推奨に変換します。mfAPIs × SunitechAI ウェビナー向けに構築されました。

設計: このサーバーはデータを保持しません。生のNIFTY 50 PEおよびOHLC行はMF Engine REST APIから取得し、バリュエーション・パーセンタイル、価格トレンド、SIPルールのロジックはここ(Python)にあります。この分割が学びどころです。

ツール

機能

get_nifty_valuation_context

現在のPE + パーセンタイル + 10年履歴とのzスコア → 割安 / 適正 / 割高

get_nifty_trend

DMA50/200、52週高値/安値からの距離、1/3/6か月リターン → 上昇トレンド / 横ばい / 下降トレンド

recommend_sip_action

バンド(+ トレンド)→ 一時停止 / 継続 / ステップアップ + 推奨される新しい金額

セットアップ

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)。次に Settings → Connectors → Advanced → Developer mode → Add で https://…/mcp URLを追加します。通常のChatGPTコネクタでは search/fetch ツールが必要です。このサーバーは developer mode または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 を返すので、デモでは必ず読み上げ、本番移行前にデータリポジトリの取り込みを修正してください。

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