loading…
Search for a command to run...
loading…
85 tools for Taiwan + US stock-market analysis — quotes, three major institutional flows, chip data, fundamentals, technical indicators, backtesting, risk metri
85 tools for Taiwan + US stock-market analysis — quotes, three major institutional flows, chip data, fundamentals, technical indicators, backtesting, risk metrics. Requires the Stock Analyzer desktop app running locally on port 3000.
📡 The Model Context Protocol server bundled with Stock Analyzer — a macOS desktop app for Taiwan + US stock market analysis.
First MCP server with deep Taiwan stock coverage (TWSE / TPEx + three major institutional flows + chip data + monthly revenue). 85 tools across 14 categories + 6 resources. Local-first — runs in-process inside the Electron app, no API costs, no cloud dependency.
Current version: MCP server 1.2.1 · Stock Analyzer app 0.47.9-beta · Updated 2026-05-27
This repo contains the MCP shim source (mcp-server.js + lib/ai-tools + Dockerfile). The shim is a thin HTTP-to-stdio bridge — when an MCP client invokes a tool, the shim proxies the call to http://localhost:3000/api/*, where the Stock Analyzer desktop app's embedded Express backend does the actual work (DB query, computation, analysis).
The MCP server in this repo, run standalone (e.g. via
docker run), can advertise its 85 tools through introspection but cannot execute them. You need Stock Analyzer running on the same machine for tools to actually return data.
This split is intentional — the analysis engine + market data + license-gated features live in the closed-source desktop app; the MCP shim is open-source (MIT) so the integration surface is fully transparent.
The Stock Analyzer desktop app itself is a commercial product (Lite tier free, Standard NT$1,499, Premium NT$2,999 — all one-time purchases, no subscription). This repo exists to:
docker build -t stock-analyzer-mcp .
docker run -i --rm stock-analyzer-mcp # stdio JSON-RPC on stdin/stdout
Image is ~258 MB (node:20-alpine + 2 npm deps). The build skips better-sqlite3, Electron, and other backend-only dependencies because the shim itself never imports them — all data calls go via HTTP to the locally-running Stock Analyzer app's /api/* endpoints.
| Category | Tools | Examples |
|---|---|---|
| market (13) | Quotes, history, heatmap, sector ranking, news, FX, seasonality, ETF holdings | get_stock_price, get_market_heatmap, get_seasonality |
| chips (6) | Three major institutional flows, fund flow Sankey, insider alerts, abnormal blocks, margin ranking | get_institutional_flow, get_fund_flow_sankey |
| fundamentals (6) | Financial statements, monthly revenue, dividends, EPS, DCF valuation | get_financial_statements, calculate_dcf |
| technical (5) | RSI / MACD / KD / Bollinger / Beta / correlation / candlestick patterns | get_technical_indicators, detect_kline_patterns |
| macro (8) | FED policy, yield curve, inflation, employment, earnings calendar | get_macro_snapshot, get_fed_policy_stance |
| sentiment (5) | News sentiment, market sentiment, per-stock sentiment, forecasts, entry strategies | get_stock_sentiment_v2, get_sentiment_forecasts |
| portfolio (11) | Holdings, P&L, performance, concentration, signals, trade CRUD | get_portfolio, get_portfolio_concentration |
| backtest (5) | Single-stock, multi-strategy, grid search, MC factor mining, random portfolio | backtest_strategy, monte_carlo_factor_mining |
| risk (3) | VaR, systemic risk, portfolio optimization | calculate_portfolio_var, get_systemic_risk |
| ai workflow (6) | Full-stock analysis, screener, workflows, notes, + deep-dive debate + daily briefing + candidate comparison + post-trade review | research_stock_deep_dive, portfolio_daily_briefing |
| thesis (6) | Investment hypothesis CRUD | upsert_thesis |
| watchlist (4) | Watchlist CRUD | add_watchlist |
| alert (3) | Price alerts | set_price_alert |
| backfill (2) | Admin data backfill | trigger_backfill |
Every tool carries:
annotations.readOnlyHint — whether the tool modifies state (clients auto-confirm before destructive ops)annotations.destructiveHint — delete_* / cancel_* flagged trueannotations.idempotentHint — upsert_* / update_* flagged true_meta.tw.stockanalyzer/estimated_cost_usd — worst-case LLM cost (most tools $0; deep-dive ~$0.16)@-mentionable)Inject context into your conversation without burning tool calls:
| Resource | Content |
|---|---|
saa://portfolio |
Full holdings (TW + US, USD/TWD unified pricing, unrealized P&L) |
saa://watchlist |
All watchlist entries with live quotes + alert states |
saa://thesis |
Active investment theses (hypothesis, key levels, next review dates) |
saa://market/today |
Three major institutional flows / sector winners / systemic risk / FX |
saa://reports/recent |
Latest portfolio briefing (free; doesn't auto-trigger LLM) |
saa://system/info |
Server introspection (version, schema version, active profile, tool count) |
Set SAA_MCP_PROFILE env var to gate which tools are visible to the LLM client:
| Profile | Tools exposed | Use case |
|---|---|---|
default (omit) |
All 85 | Your personal Claude Desktop |
safe_readonly |
70 read-only tools | Shared / untrusted LLM clients — blocks add_trade / delete_* / upsert_thesis / set_price_alert / etc. |
Resources stay available in both profiles (they're read-only by definition).
| Server | TW coverage | US coverage | Local | License model |
|---|---|---|---|---|
| Alpha Vantage MCP | ⚠️ Delayed quotes only | ✅ Full | ❌ Cloud API | Pay per call |
| Financial Datasets MCP | ❌ None | ✅ Full | ❌ Cloud API | Subscription |
| EODHD MCP | ⚠️ EOD only | ✅ Full | ❌ Cloud API | Subscription |
| Lambda Finance | ❌ None | ✅ Full + options | ❌ Cloud | Subscription |
| Stockflow (Yahoo) | ⚠️ Spotty TW data | ✅ Full | ❌ Cloud | Free (rate-limited) |
| Stock Analyzer MCP | ✅ Deep TWSE + TPEx + institutional + chip | ✅ Full | ✅ Local SQLite | One-time license (Lite free) |
For non-Taiwan readers: Taiwan stock market has its own data ecosystem (TWSE, TPEx OpenAPI, three major institutional investors, monthly revenue reporting) that's nearly absent from English-speaking financial data platforms. If you want an AI agent that can answer "How are TSMC's institutional investors trading lately?" or "Find me TW small-caps with >30% YoY revenue growth", Stock Analyzer MCP is currently the only viable option.
Get the free Lite tier from stockanalyzer.tw. Version 0.47.4-beta or later ships MCP server v1.2.0.
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"stock-analyzer": {
"command": "/Applications/Stock Analyzer.app/Contents/Resources/app.asar.unpacked/bin/saa-mcp",
"env": { "PORT": "3000" }
}
}
}
Why the wrapper? Running
node mcp-server.jsdirectly hits abetter-sqlite3ABI mismatch (the binding is compiled for Electron's Node, not the system's). Thebin/saa-mcpwrapper auto-finds the SAA Electron runtime and runs the MCP server withELECTRON_RUN_AS_NODE=1. Older configs that point tonodewill need updating.
If the LLM client isn't fully trusted (shared Claude project, third-party agent), add:
"env": { "PORT": "3000", "SAA_MCP_PROFILE": "safe_readonly" }
This blocks 15 write tools (add_trade, delete_trade, upsert_thesis, set_price_alert, etc.) but keeps all read tools + all 6 resources.
cmd+Q then reopen)"List all SAA stock-analyzer tools"
"Analyze 2330 — institutional flow last month + 3-month momentum + radar score + give me a buy/sell view"
"@saa://portfolio — what's my biggest concentration risk?"
"Compare 2330, 2454, and 3008 as candidates. Include their theses if they exist."
Claude will orchestrate multiple tool calls (or @-mentions for resources) and synthesize a research report.
research_stock_deep_dive — Premium tier5 specialized AI agents debate in parallel:
strong_buy → avoid)Each agent uses a distinct subset of the 85 tools. Output includes per-agent reasoning + final action + confidence score. ~$0.16/call LLM cost (Anthropic Sonnet / OpenAI).
portfolio_daily_briefing — Lite tierPre-market or post-market portfolio briefing. Aggregates current holdings, unrealized P&L, sector exposure, relevant macro / institutional flow into an actionable summary.
mode='get' → reads the latest cached briefing (free, instant)mode='generate' → runs a fresh one (~10-20s, ~$0.04/call LLM cost)compare_investment_candidates — Lite, cost $0Side-by-side deep analysis of 2-5 candidate stocks. Parallel fan-out of get_full_stock_analysis (fundamentals + technical + chip + institutional + levels) per candidate, plus existing thesis status. Deterministic — the agent sees raw evidence rather than an LLM-synthesized opinion, which empirically produces better reasoning.
post_trade_review — Lite, cost $0Past-N-days reflection. Aggregates analyze_trade_performance (FIFO P&L, win rate, hold time) + get_trade_journal (recent trades) + get_portfolio_signals (current state). Auto-detects observable patterns:
low_win_rate (< 40%) → systematic selection or timing problemover_trading (avg hold < 5 days) → fees eating returnslopsided_pnl (avg loss > avg win) → poor stop-loss disciplineHands the agent objective indicators to write narrative review against.
~/.twse-analyzer/stock_history.db (SQLite, single file). MCP server runs in-process inside the Electron app via stdio transport./methodology.html inside the app._meta.tw.stockanalyzer/estimated_cost_usd. No hidden cloud-API spend.The MCP server uses two version numbers:
| Field | Meaning | Bump on |
|---|---|---|
server_version |
SAA MCP binary version (shown at initialize) |
Each SAA app release |
tools_schema_version (in saa://system/info) |
Tool/resource shape version | Tool added/removed/renamed/required-changed |
Rules:
readOnlyHint changeCurrent: server 1.2.0, schema 1.2.0. Changelog inside mcp-server.js header.
This documentation repo is MIT licensed (see LICENSE). The Stock Analyzer app itself is closed-source commercial software.
Run in your terminal:
claude mcp add stock-analyzer-mcp -- npx Security
Low riskAutomated heuristic from public metadata — not a security guarantee.