Skip to main content
Glama
motucraft

StockPrice

by motucraft

stock-mcp

Yahoo Finance から株価情報を取得する MCP サーバーです。

セットアップ

npm install

Related MCP server: YFinance MCP Server

開発起動

npm run dev

ビルド

npm run build

MCP クライアント設定

このサーバーは stdio transport で起動します。MCP クライアントには、ビルド後の build/index.jsnode で実行するように設定します。

事前にビルドしてください。

npm install
npm run build

Codex

~/.codex/config.toml またはプロジェクトの .codex/config.toml に設定します。

[mcp_servers.stock-mcp]
command = "node"
args = ["/path/to/stock-mcp/build/index.js"]

CLI で追加する場合:

codex mcp add stock-mcp -- node /path/to/stock-mcp/build/index.js

Claude Code

Claude Code の MCP 設定は JSON の mcpServers 形式です。プロジェクトで共有する場合は .mcp.json に設定します。

{
  "mcpServers": {
    "stock-mcp": {
      "command": "node",
      "args": [
        "/path/to/stock-mcp/build/index.js"
      ]
    }
  }
}

CLI で追加する場合:

claude mcp add --transport stdio stock-mcp -- node /path/to/stock-mcp/build/index.js

開発用設定

開発中に TypeScript のまま起動したい場合は、各クライアントで npm --prefix ... run dev を実行するように設定します。

Codex:

[mcp_servers.stock-mcp]
command = "npm"
args = [
  "--prefix",
  "/path/to/stock-mcp",
  "run",
  "dev",
]

Claude Code:

{
  "mcpServers": {
    "stock-mcp": {
      "command": "npm",
      "args": [
        "--prefix",
        "/path/to/stock-mcp",
        "run",
        "dev"
      ]
    }
  }
}

設定後、MCP クライアントを再起動すると StockPriceScreenStocks のツールを利用できます。

MCP ツール

  • サーバー名: stock-mcp

  • StockPrice: symbol に銘柄コードを指定して株価情報を取得します。

  • ScreenStocks: 東証プライムの銘柄を、PER や配当利回りなどの条件で絞り込みます。

StockPrice

入力

パラメータ

必須

説明

symbol

string

Yes

銘柄コード。米国株は AAPL、日本株は 7203.T のように取引所サフィックスを付けます。

例:

{
  "symbol": "AAPL"
}

出力

yahoo-finance2quote() の結果を、加工せず JSON 文字列にしてテキストコンテンツで返します。フィールドの内容は yahoo-finance2 および Yahoo Finance 側の仕様に従うため、詳細は下記を参照してください。

エラー時も yahoo-finance2 が投げた内容がそのまま MCP のツールエラーとして返ります。

ScreenStocks

指定した条件をすべて満たす銘柄だけを返します。

yahoo-finance2 にも screener() はありますが、指定できるのは day_gainersundervalued_large_caps といった定義済みのプリセットで、任意の条件を組み立てることはできません。region パラメータはあるものの、JP を指定しても返るのは米国株でした。日本株を独自の条件で絞り込む用途には不十分なため、銘柄一覧を JPX から、指標を Yahoo Finance から取得して、絞り込みはこのサーバーで行います。

入力

パラメータ

必須

説明

filters

array

Yes

絞り込み条件。すべてを満たす銘柄が対象(AND 条件)

symbols

array

No

対象銘柄。省略すると東証プライムの全銘柄が対象

sector

string

No

33 業種区分での絞り込み(例: 銀行業)。symbols 指定時は無視

sortBy

string

No

並び替えに使う指標

order

string

No

asc または desc(既定: desc

limit

number

No

返す件数の上限。1〜200(既定: 20)

symbols は証券コードのままでも指定できます。7203166A のように先頭が数字の 4〜5 桁は .T を補って Yahoo Finance のシンボルに変換します(72037203.T)。. を含む文字列はそのまま使います。

filters の各要素は field(指標)、op(比較演算子)、value(しきい値)を持ちます。opgte(以上)、lte(以下)、gt(超)、lt(未満)、eq(等しい)です。

指定できる fieldsortBy:

指標

内容

trailingPE

実績 PER(倍)

forwardPE

予想 PER(倍)

priceToBook

PBR(倍)

dividendYield

配当利回り(%)

marketCap

時価総額(円)

regularMarketPrice

株価(円)

regularMarketVolume

出来高(株)

averageDailyVolume3Month

平均出来高・3ヶ月(株)

regularMarketChangePercent

前日比(%)

epsTrailingTwelveMonths

EPS(円)

bookValue

BPS(円)

fiftyTwoWeekChangePercent

52 週騰落率(%)

例(PER 15 倍以下・PBR 1 倍以下・配当利回り 3.5% 以上を、利回り順に 8 件):

{
  "filters": [
    { "field": "trailingPE", "op": "lte", "value": 15 },
    { "field": "priceToBook", "op": "lte", "value": 1.0 },
    { "field": "dividendYield", "op": "gte", "value": 3.5 }
  ],
  "sortBy": "dividendYield",
  "order": "desc",
  "limit": 8
}

出力

条件と sortBy に使った指標だけを返します(株価は常に含みます)。全銘柄の生データは返しません。

{
  "evaluated": 1559,
  "fetched": 1558,
  "matched": 171,
  "returned": 8,
  "elapsedMs": 2036,
  "fieldLabels": { "trailingPE": "実績PER(倍)" },
  "results": [
    {
      "symbol": "6358.T",
      "name": "酒井重工業",
      "sector": "機械",
      "regularMarketPrice": 2135,
      "trailingPE": 10.383737,
      "priceToBook": 0.5794713,
      "dividendYield": 6.06
    }
  ]
}

evaluated は対象銘柄数、fetched は指標を取得できた銘柄数です。指標が欠けている銘柄は条件を判定できないため対象外になります。

データの取得元と注意点

  • 銘柄一覧は JPX の東証上場銘柄一覧data_j.xls)から取得し、市場・商品区分プライム(内国株式) の銘柄を対象にします

  • 取得結果は ~/.cache/stock-mcp/jpx-prime.json に 7 日間キャッシュします。元ファイルが月次更新のため、上場・廃止の反映は最大 7 日遅れます

  • 株価・指標は Yahoo Finance から取得します。日本株は約 20 分遅延です

  • プライム全銘柄を対象にすると、Yahoo へのリクエストは 250 銘柄ずつ 7 回程度になります(実測 約 2 秒)

Available Tools

1 tool
StockPriceB

Yahoo Finance から株価情報を取得します。

ParametersJSON Schema
NameRequiredDescriptionDefault
symbolYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden of disclosing behavioral traits. It only states that the tool retrieves data, implying a read operation, but does not explain return format, error behavior, rate limits, or any side effects. This lack of transparency is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence, 'Yahoo Finance から株価情報を取得します。' It is front-loaded and contains no fluff or redundant information. It effectively communicates the core purpose in minimal space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema, no annotations, and a very minimal input schema. The description does not compensate for this by explaining what the returned data looks like, how to format the symbol, or any limitations. It fails to provide adequate context for an agent to use the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has one required parameter 'symbol' with no description, and the schema description coverage is 0%. The tool description does not mention the parameter at all, leaving the agent to infer that 'symbol' represents a stock ticker from the tool name. This minimal inference is insufficient for proper parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: it retrieves stock price information from Yahoo Finance. The verb '取得します' (retrieves) and the resource '株価情報' (stock price information) are specific and unambiguous. Since there are no sibling tools, no differentiation is needed.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool or under what circumstances. It does not mention alternatives, prerequisites, or typical use cases. There are no sibling tools, but the absence of any usage context leaves the agent without direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 1 tool updatev1.0.0
    • First observedStockPrice

TDQS

B3.2/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of confusing it with other tools. The tool's purpose is singular and unambiguous.

Naming Consistency5/5

A single tool name 'StockPrice' is clear and self-descriptive. While there is no pattern to compare against, the naming is consistent and follows a standard camelCase convention.

Tool Count2/5

The server has only one tool, which feels too few for a domain like stock prices that typically requires multiple operations (e.g., getting quotes, historical data, or search). The scope appears under-served.

Completeness2/5

The tool offers only a generic stock price fetch, but a complete stock information service would likely need historical data, symbol lookup, and perhaps market summaries. The current surface is too narrow for a 'StockPrice' server.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    A simple MCP server for Yahoo Finance using yfinance. This server provides a set of tools to fetch stock data, news, and other financial information.
    15
    191
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A comprehensive MCP server that provides seamless access to Yahoo Finance stock market data, enabling retrieval of real-time quotes, historical data, charts, financial summaries, and market searches.
    35 npm
    ISC
  • A
    license
    A
    quality
    C
    maintenance
    An MCP server that exposes comprehensive Yahoo Finance data (quotes, financials, options, news, and more) to AI agents via the yfinance library, requiring no API key.
    24
    MIT