stockdata-mcp
stockdata-mcp
株式調査のためのMCPサーバー。2つのバックエンド、1つのツールサーフェス。
FMP ( | 生データ — 財務諸表、クォート、レシオ、見積もり、価格、配当。ドキュメント化された公開API。常時稼働。 |
Qualtrim ( | QualtrimがFMPの上に導出するもののみ — 彼らのDCF、厳選されたKPIチャート、AIコメンタリー、ディップファインダー、さらに自分のポートフォリオとウォッチリスト。オプション。 |
この分割は意図的です。QualtrimはFMPの顧客です。生データを購入し、レイヤーを追加します。したがって、このサーバーは生のものはすべてFMPに直接アクセスし、Qualtrimの呼び出しはQualtrim独自のものにのみ使用します。
52ツール — 30 FMP、22 Qualtrim。
Qualtrimバックエンドを有効にする前に
このサーバーのFMP側は普通です。ドキュメント化された公開API、サインアップするキー、好きなように使えます。
Qualtrim側はそうではありません。QualtrimはAPIを公開していません — それらのルートは彼らの出荷されたJavaScriptから読み取られたものであり、彼らの利用規約は、プラットフォームのリバースエンジニアリングと、事前の書面による同意なしに 自動化された手段でデータを取得することを禁止しています。
その同意は譲渡できず、このリポジトリはそれを付与しません。Qualtrimバックエンドを実行したい場合は、独自の有料Qualtrimアカウント と、自分で取得したQualtrimからの書面による許可 が必要です。support@qualtrim.com に直接問い合わせてください。
それがない場合は、
QUALTRIM_USERNAME/QUALTRIM_PASSWORDを設定せずにサーバーを実行してください。FMPツールは単独で問題なく動作し、ここでQualtrimに依存するものはありません。このコードは、そのようなクライアントがどのように構成されているかの参考として公開されており、誰かのサービスに向けるための招待状ではありません。Qualtrimの違反に対する表明された救済策はアカウントの終了であり、彼らの手数料は返金不可です。
インストール
cd ~/Projects/stockdata-mcp
uv venv && uv pip install -e .
./scripts/set-credentials.sh # prompts; password input is hiddenset-credentials.sh は 0600 パーミッションで .env を書き込みます。gitignoreされています。
無料のFMPキーを https://site.financialmodelingprep.com/developer/docs で取得してください。
マシン上のすべてのセッションで一度だけ登録します:
claude mcp add stockdata --scope user -- ~/Projects/stockdata-mcp/.venv/bin/stockdata-mcp-e フラグは不要 — サーバーは .env を自分で読み取るため、資格情報は ~/.claude.json に残りません。実際の環境変数はファイルを上書きするため、MCPクライアントは必要に応じて -e を渡すことができます。
任意のセッションから backend_status で確認できます。
モデルへのガイダンス
サーバーはMCPプロトコルを介して独自の使用手順を提供します — バックエンドの選択、無料層の制限、Qualtrimの癖、数値の報告方法。すべてのMCPクライアントは、追加設定なしでこれらを自動的に受け取ります。
また、.claude/skills/stock-research/ に、より詳細なスキルがあり、調査ワークフローをより深くカバーしています。Claude Codeは ~/.claude/skills/ から読み取ります(そこにシンボリックリンクします)。Claude Desktopはスキルを独自の場所で管理し、そのディレクトリからは取得しません — 上記のサーバー手順に依存しており、決定に重要な部分が含まれています。
Related MCP server: StocksMCP
キャッシュと予算
応答は ~/.cache/stockdata-mcp/cache.db のSQLiteストアにキャッシュされます。ストアは グローバルであり、クライアントごとではありません — このユーザーのすべてのサーバープロセスが同じファイルを開くため、Claude CodeとClaude Desktopは1つのキャッシュと1つの日次合計を共有します。これは効率性だけでなく、正確性のために必要です: FMPクォータはAPIキーに属し、両方のアプリが同じキーを使用します。
TTLはエンドポイントごとに選択されます。クォートは1分、プロファイルは1週間、参照データは1か月。日付範囲が今日より前に終了した履歴バーは期限切れになりません。過去に発生した終値は変更できないためです。今日まで続く範囲はまだ移動するエッジがあり、15分間のTTLが適用されます。
3つのツールがこれを管理します:
ツール | 目的 |
| 今日送信されたリクエスト、残り、リセット時間、キャッシュ統計 |
| 実行前に、計画された呼び出しのセットが上流でいくらかかるか |
| 期限切れエントリ (安全) またはバックエンド全体を削除 |
estimate_cost は、ツールとリクエストの比率が1:1ではなく、呼び出し側からは見えないため存在します: fmp_search は2リクエスト、fmp_price_target は3、fmp_quote は無料キーではシンボルごとに1つ。最悪のリクエスト数、すでにキャッシュされているレッグ数、今日の残り予算に対する純額を報告します。検証済み: その予測は、混合5呼び出しプランで実際の支出と正確に一致し、同じプランをウォームで再実行した場合は0を返しました。
同じシンボルを同時に要求する6つの独立したプロセスで測定: 1つの上流リクエスト、5つのキャッシュヒット、ロックの競合なし。
設定
変数 | デフォルト | 目的 |
| — |
|
| — |
|
|
| ポートフォリオ/ウォッチリストを変更するツールを許可 |
|
| Qualtrimリクエスト間の最小秒数 |
|
| FMPリクエスト間の最小秒数 |
|
| 過大なツールペイロードをトリミング |
|
| 環境ファイルへの代替パス |
FMPツール
検索と参照: fmp_search、fmp_profile、fmp_quote、fmp_peers、fmp_reference。
ファンダメンタルズ: fmp_income_statement、fmp_balance_sheet、fmp_cash_flow、fmp_key_metrics、fmp_ratios、fmp_financial_growth、fmp_financial_scores、fmp_revenue_segmentation、fmp_enterprise_values。
アナリストと評価: fmp_analyst_estimates、fmp_price_target、fmp_grades、fmp_dcf。
イベントと市場: fmp_dividends、fmp_earnings、fmp_earnings_calendar、fmp_historical_prices、fmp_technical_indicator、fmp_screener、fmp_market_movers、fmp_sector_performance、fmp_insider_trading、fmp_news。
fmp_request(endpoint, params) は、FMPの約250の安定したエンドポイント — ETF保有、13F、上院取引、経済指標、SEC提出書類、トランスクリプト — に専用のラッパーなしで到達します。
無料層が実際にカバーするもの
ライブの無料キーで検証済み: 29ツールのうち22が動作します。
有料プランが必要: fmp_screener、fmp_reference、fmp_news、fmp_insider_trading、fmp_technical_indicator。それぞれが原因としてプランを明示する明確なエラーを返します。
2つの注意点:
複数シンボルの
fmp_quoteは、バッチルートが有料であるため、シンボルごとのリクエストにフォールバックします。日次クォータを保護するために20シンボルに制限されています。fmp_technical_indicatorが有料であることは簡単に回避できます —fmp_historical_pricesは無料であるため、インジケーターはOHLCVからローカルで計算できます。
無料層は1日あたり約250リクエストを許可します。limit と from_date/to_date を渡してください。価格履歴のデフォルトはシリーズ全体です。
Qualtrimツール
シンボルごと: qualtrim_overview、qualtrim_profile、qualtrim_quote、qualtrim_dcf、qualtrim_kpi_charts、qualtrim_chart、qualtrim_ai_analysis、qualtrim_analyst_estimates。
比較: qualtrim_available_kpis、qualtrim_compare。
あなたのアカウント: qualtrim_portfolios、qualtrim_portfolio、qualtrim_portfolio_look_through_earnings、qualtrim_portfolio_ai_analysis、qualtrim_portfolio_dividends、qualtrim_watchlists、qualtrim_watchlist、qualtrim_dip_finder、qualtrim_watchlist_valuation_ranges。
エスケープハッチ: qualtrim_request(path)、GETのみ。
書き込み (qualtrim_add_watchlist_stock、qualtrim_add_portfolio_holding) は、QUALTRIM_ENABLE_WRITES=true でない限り実行を拒否します。
Qualtrim認証が実際にどのように機能するか
彼らの配信されたバンドルはベアラートークン認証のように見えます — authTokens が localStorage に、Authorization: Bearer。実際はそうではありません。ログインはユーザーオブジェクトを返し、Expressセッションクッキー (connect.sid) を設定します。そのクッキーが通常のリクエストを承認します。バンドルのトークンパスは、そのリフレッシュ呼び出しによってのみ実行されます。
このクライアントはクッキージャーを保持し、セッションを ~/.cache/stockdata-mcp/qualtrim-session.json (0600) にキャッシュし、401で自動的に再度ログインします。
既知のドリフト
彼らのデプロイされたバックエンドは、ルートが読み取られたバンドルからすでに分岐しています:
バンドル内のルート | 現実 |
| 404 — |
| 保存された計算機のみを返します; |
両方のツールはすでに動作するバリアントを使用しています。時間の経過とともにさらに多くのことを期待してください — Qualtrimツールからの404は、ルートが移動したことを意味し、ティッカーが間違っていることを意味しません。
qualtrim_dcf が空を返すのは失敗ではありません。アカウント内のそのシンボルにDCFが保存されていないことを意味します。
Qualtrimとその利用規約
QualtrimはAPIを公開していません。これらのルートは彼らの配信されたJavaScriptから読み取られました。2つの結果:
予告なく壊れる可能性があります。 上記の「既知のドリフト」を参照してください — すでに発生しています。
彼らの条件によって制限されています。 彼らの許容使用セクションは、事前の書面同意なしに自動化された手段でサイトからデータを体系的に取得することを禁止し、プラットフォームのリバースエンジニアリングを別途禁止しています。彼らの執行レバーはアカウントの終了であり、彼らの手数料は返金不可です。
同意は取得可能です — 禁止はそれに条件付きです。support@qualtrim.com でQualtrimに直接問い合わせ、彼らの返信を保管してください。
ここでのデフォルトは控えめです: 1リクエスト/秒、最大2同時、ブラウザに一致するユーザーエージェント、デフォルトでGET、バルク列挙なし。インタラクティブな研究量に保ってください。
レイアウト
src/stockdata_mcp/
server.py tool definitions for both backends
fmp.py FMP stable-API client
qualtrim.py Qualtrim cookie-session client
util.py throttling, response trimming, .env loading
scripts/
set-credentials.sh
.claude/skills/stock-research/SKILL.md投資アドバイスではありません
あなた自身の調査のためのデータ。どちらのソースも正確性を保証せず、ここにあるものは売買の推奨ではありません。
Available Tools
33 toolsbackend_statusA
Report which backends are configured and how this server is set up.
Inputs: no named parameters. Returns: result
cache_clearA
Drop cached responses. Use when data looks stale despite its TTL.
"expired" (the default) only removes entries already past their TTL and is always safe. Clearing live entries means paying for those requests again — note that past price bars never expire by design, because they cannot change.
Inputs: backend. Returns: result
estimate_costA
Say what a set of tool calls will cost upstream before running them.
The tool-to-request ratio is not 1:1 — fmp_search issues two requests, fmp_price_target three, and fmp_quote falls back to one per symbol on a free key. Cached legs cost nothing. Use this before a multi-step analysis, or whenever a plan touches many symbols.
Args: calls: Tool calls to price, e.g. [{"tool": "fmp_profile", "args": {"symbol": "AAPL"}}, {"tool": "fmp_quote", "args": {"symbols": "AAPL,MSFT,NVDA"}}]
Returns per-call worst-case requests, how many legs are already cached, and the net spend against today's remaining budget.
Inputs: calls (required). Returns: result
fmp_analyst_estimatesC
Forward analyst estimates for revenue, EPS, EBITDA and net income.
Inputs: symbol (required), limit, period. Returns: result
fmp_balance_sheetD
Balance sheet statements.
Inputs: symbol (required), limit, period. Returns: result
fmp_cash_flowD
Cash flow statements.
Inputs: symbol (required), limit, period. Returns: result
fmp_dcfB
FMP's discounted cash flow valuation for a symbol.
Args: levered: Use the levered (post-debt) DCF instead of the standard one.
Inputs: symbol (required), levered. Returns: result
fmp_dividendsB
Dividend history for a symbol: declaration, record, payment dates and amounts.
Inputs: symbol (required), limit. Returns: result
fmp_earningsB
Earnings history and upcoming dates: actual vs estimated EPS and revenue.
Inputs: symbol (required), limit. Returns: result
fmp_earnings_calendarB
Market-wide earnings calendar over a date range (YYYY-MM-DD).
Inputs: to_date (required), from_date (required). Returns: result
fmp_enterprise_valuesC
Enterprise value, market cap, and net debt over time.
Inputs: symbol (required), limit, period. Returns: result
fmp_financial_growthC
Period-over-period growth rates across the three statements.
Inputs: symbol (required), limit, period. Returns: result
fmp_financial_scoresB
Altman Z-score and Piotroski F-score for a symbol.
Inputs: symbol (required). Returns: result
fmp_gradesC
Analyst upgrades and downgrades, or the consensus grade distribution.
Inputs: symbol (required), historical. Returns: result
fmp_historical_pricesA
Historical OHLCV data.
Args: symbol: Ticker, index (^GSPC), crypto (BTCUSD) or FX pair (EURUSD). from_date: Start date, YYYY-MM-DD. Strongly recommended — without it you get the full history, which is large. to_date: End date, YYYY-MM-DD. interval: "1day" for end-of-day, otherwise an intraday bar size. full: For daily data, include change/VWAP columns rather than the light form.
Inputs: symbol (required), full, to_date, interval, +1 more. Returns: result
fmp_income_statementC
Income statements. Use limit to control how many periods come back.
Inputs: symbol (required), limit, period. Returns: result
fmp_insider_tradingC
Insider transactions for a symbol, or aggregate insider buy/sell statistics.
Inputs: symbol (required), limit, statistics. Returns: result
fmp_key_metricsC
Per-share and valuation metrics: P/E, EV/EBITDA, ROIC, FCF per share, etc.
Args: ttm: Return trailing-twelve-month values instead of discrete periods.
Inputs: symbol (required), ttm, limit, period. Returns: result
fmp_market_moversA
Today's biggest gainers, biggest losers, or most actively traded names.
Inputs: kind. Returns: result
fmp_newsA
Recent news articles for one or more comma-separated symbols.
Inputs: symbols (required), limit. Returns: result
fmp_peersC
Comparable companies for a symbol, as identified by FMP.
Inputs: symbol (required). Returns: result
fmp_price_targetB
Analyst price-target summary and consensus, plus the current rating snapshot.
Inputs: symbol (required). Returns: result
fmp_profileC
Company profile: sector, industry, market cap, description, exchange, CEO.
Inputs: symbol (required). Returns: result
fmp_quoteA
Current quote for one or more symbols.
Args: symbols: One symbol, or several comma-separated ("AAPL,MSFT,NVDA"). short: Return only price/volume rather than the full quote.
Inputs: symbols (required), short. Returns: result
fmp_ratiosC
Financial ratios: margins, liquidity, leverage, returns, payout.
Inputs: symbol (required), ttm, limit, period. Returns: result
fmp_referenceA
Look up the valid values for screener filters, or an index's constituents.
Inputs: kind (required). Returns: result
fmp_requestA
Call any FMP stable endpoint directly — an escape hatch for the ~250 endpoints without a dedicated tool here (ETF holdings, 13F, senate trades, economic indicators, SEC filings, transcripts, and so on).
Args: endpoint: Path after /stable/, e.g. "etf/holdings" or "treasury-rates". params: Query parameters, e.g. {"symbol": "SPY"}. The API key is added automatically.
Inputs: endpoint (required), params. Returns: result
fmp_revenue_segmentationB
Revenue split by product line or by geography.
Inputs: symbol (required), by. Returns: result
fmp_screenerB
Screen for stocks matching fundamental and market filters.
Call fmp_reference("sectors") or fmp_reference("industries") first if you need the exact spelling of a sector or industry value.
Inputs: limit, is_etf, sector, country, +14 more. Returns: result
fmp_searchA
Find a ticker symbol by symbol fragment or company name.
Args: query: A symbol fragment ("AAP") or company name ("Apple"). limit: Max results. exchange: Optional exchange filter, e.g. "NASDAQ".
Inputs: query (required), limit, exchange. Returns: result
fmp_sector_performanceB
Sector performance, or sector P/E ratios, as of a date (YYYY-MM-DD).
Inputs: pe, date. Returns: result
fmp_technical_indicatorD
A technical indicator series — useful for backtesting signal ideas.
Inputs: symbol (required), to_date, from_date, indicator, +2 more. Returns: result
usage_statusA
Upstream requests spent today, what remains, and when the budget resets.
Counts requests that actually left this machine — cache hits are free and
are reported separately as saved. The count is shared by every client on
this machine (Claude Code and Claude Desktop use the same store and the
same API key), so it reflects total spend, not this session's.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 33 tools
Most tools map cleanly to a distinct data category, and the fmp_ prefixes help separate market data, fundamentals, analyst data, and utilities. A few analyst-related tools and the key_metrics/ratios pair overlap enough that an agent must read the descriptions carefully to pick the right one.
All data tools follow a consistent fmp_<category> snake_case pattern, making the group recognizable and predictable. The operational tools like usage_status and cache_clear break the prefix convention, but they are still readable and clearly grouped, so the deviation is minor.
At 33 tools, the server exceeds the 25+ threshold and presents a heavy surface for an agent to navigate. Many fundamental and analyst tools could be consolidated, and fmp_request already provides a catch-all for less common FMP endpoints.
The set covers the core market-data workflow thoroughly: quotes, historical prices, fundamentals, financial statements, dividends, earnings, analyst data, screening, news, and insider trades. The fmp_request escape hatch also covers any remaining FMP endpoints, so there are no obvious dead ends.
Maintenance
Related MCP Connectors
Production MCP server for US equity and options intelligence: real-time IV radar, Monte Carlo simulation, options pressure, strategy backtesting, AI prediction, pre-trade risk analysis, and automated stock research reports.
MCP server for Financial Modeling Prep API with 250+ financial data tools
Hosted MCP server for Indian NSE/BSE stock research: 59 tools for quotes, financials and ratios, peers, shareholding and pledge, filings with extracted facts, screens, F&O and FII/DII context. Source and freshness on every answer; no buy/sell calls.
Research-only MCP server: your AI as a quant research desk. 90 tools, no trades, no brokers.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that provides comprehensive access to real-time stock quotes, financial statements, analyst estimates, and technical indicators via the Financial Modeling Prep API. It enables users to conduct in-depth financial analysis and track market performance through specialized tools, resources, and prompt templates.2647 npm1MIT
- FlicenseNot gradedqualityDmaintenanceAI-powered stock research MCP server with real-time data, CRUD operations, and interactive dashboard for fundamental analysis and comparisons.-
- AlicenseAqualityDmaintenanceA comprehensive MCP server for stock analysis and trading insights, including stock screening, fundamental analysis, insider trading, options analysis, social media research, and news analysis.1075MIT
- AlicenseAqualityBmaintenanceA modular MCP server providing 64 tools across 13 modules for real-time stock and crypto market data, including scanning, technical analysis, options flow, insider trades, and personalized watchlists.39184 npm8MIT