Skip to main content
Glama
PanStories

mcp-stock-analyst

by PanStories

MCP Stock Analyst 📈

English | 简体中文 | 繁體中文


MCP Stock Analyst (English)

A Model Context Protocol (MCP) server delivering stock market data for China A-shares, Hong Kong, US and Taiwan markets — live quotes, smart symbol search and historical K-lines.

  • Zero-cost data: powered by free public market-data APIs (Tencent for A-share/HK/US, Yahoo Finance for Taiwan), no API key, no quota

  • 3 practical tools: real-time quotes (batch up to 10), fuzzy search (Chinese name / pinyin / ticker code), historical candlesticks

  • Dual transport: stdio (local desktop clients) + Streamable HTTP (remote hosting on Apify Standby)

  • Live on Apify Store: https://apify.com/neeenja/mcp-stock-analyst — pay-per-call, no subscription

Tools

Tool

What it does

Example input

get_quote

Real-time quote (A-share / HK / US / Taiwan, up to 10 symbols per call)

600519,00700,AAPL,2330.TW

search_stock

Fuzzy search by name, pinyin or partial code

茅台 / GZMT / NVIDIA / 台积电 / TSMC

get_kline

Historical candlesticks (day/week/month, 20–640 bars)

600519 or 2330.TW, period=day

Taiwan stock codes

Taiwan (TWSE listed / TPEx OTC) stocks are served via Yahoo Finance. Accepted formats:

  • 2330.TW — TWSE listed (explicit)

  • 5483.TWO — TPEx OTC (explicit)

  • tw2330 — shorthand; the server auto-detects the exchange (tries .TW first, then .TWO)

  • ^TWII — Taiwan Capitalization Weighted Index (TAIEX)

Related MCP server: A-Stock MCP Server

Use the hosted MCP endpoint with any MCP client via mcp-remote:

{
  "mcpServers": {
    "stock-analyst": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote",
        "https://neeenja--mcp-stock-analyst.apify.actor/mcp",
        "--header", "Authorization: Bearer ${APIFY_TOKEN}"
      ],
      "env": { "APIFY_TOKEN": "<your-apify-api-token>" }
    }
  }
}

Get your token from Apify Console → Settings → API & Integrations.

Or run locally (stdio)

git clone https://github.com/PanStories/mcp-stock-analyst
cd mcp-stock-analyst
npm install && npm run build
{
  "mcpServers": {
    "stock-analyst": {
      "command": "node",
      "args": ["C:\\path\\to\\mcp-stock-analyst\\build\\index.js"]
    }
  }
}

Debug locally

npx @modelcontextprotocol/inspector node build/index.js   # interactive inspector
node e2e-test.mjs        # stdio protocol end-to-end test
node http-e2e-test.mjs   # local HTTP end-to-end test

Pricing (pay-per-event)

No subscription, no monthly fee — you pay per tool call:

Event

Charged when

Price

tool-call (primary)

each get_quote / get_kline call

$0.02

search-call

each search_stock call

$0.005

Always free: the MCP handshake (initialize) and tools/list. Discovery costs nothing.

Every Apify account includes $5 of free platform credit monthly (~250 quote calls), so light users effectively pay nothing.

HTTP endpoints (remote mode)

Method

Path

Purpose

POST

/mcp

MCP protocol endpoint (stateless Streamable HTTP)

GET

/health

health check

GET

/

service info; answers the Apify container readiness probe

Deploying your own instance

npm install -g apify-cli
apify login
cd mcp-stock-analyst
apify push             # builds the Docker image on Apify's infrastructure

The Actor definition (.actor/actor.json) already enables Standby mode with MCP path /mcp. Your endpoint will be https://<username>--mcp-stock-analyst.apify.actor/mcp (verify in Console → Endpoints, or read data.standbyUrl from GET https://api.apify.com/v2/acts/<actorId>?token=<token>).

Tech stack

  • Node.js ≥ 18, TypeScript, official @modelcontextprotocol/sdk

  • Data source: Tencent public market APIs (A-share/HK/US, free, no key) + Yahoo Finance chart API (Taiwan, free, no key)

  • Multi-stage Docker build (node:20-alpine)

Roadmap

  • Pay-per-event billing

  • Taiwan market support (TWSE / TPEx / TAIEX via Yahoo Finance)

  • Money flow / dragon-tiger list data

  • Financial report summaries

  • API-key auth layer (self-hosting)

License

MIT


MCP Stock Analyst(简体中文)

一个提供 A股 / 港股 / 美股 / 台湾股 行情数据的 MCP (Model Context Protocol) 服务器——实时报价、智能搜索、历史K线。

  • 零成本数据源:A股/港股/美股用腾讯免费公开行情接口,台湾股用 Yahoo Finance,均无需 API key,无配额限制

  • 三个实用工具:实时报价(单次最多 10 个标的)、智能搜索(中文名/拼音/代码)、历史K线

  • 双传输模式:stdio(本地桌面客户端)+ Streamable HTTP(Apify Standby 远程托管)

  • 已上架 Apify Store:https://apify.com/neeenja/mcp-stock-analyst —— 按次付费,无订阅

工具列表

工具

功能

示例输入

get_quote

实时报价(A股/港股/美股/台湾股,单次最多10个)

600519,00700,AAPL,2330.TW

search_stock

智能搜索代码/名称/拼音

茅台 / GZMT / NVIDIA / 台积电 / TSMC

get_kline

历史K线(日/周/月,20–640 根)

600519 或 2330.TW,period=day

台湾股票代码格式

台湾股(TWSE 上市 / TPEx 上柜)走 Yahoo Finance 数据源,支持以下输入格式:

  • 2330.TW —— 上市股票(显式指定)

  • 5483.TWO —— 上柜股票(显式指定)

  • tw2330 —— 简写;服务端自动探测交易所(先试 .TW,再试 .TWO)

  • ^TWII —— 台湾加权指数(TAIEX)

接入方式(推荐:云端端点)

任意 MCP 客户端通过 mcp-remote 连接云端端点:

{
  "mcpServers": {
    "stock-analyst": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote",
        "https://neeenja--mcp-stock-analyst.apify.actor/mcp",
        "--header", "Authorization: Bearer ${APIFY_TOKEN}"
      ],
      "env": { "APIFY_TOKEN": "<你的-Apify-token>" }
    }
  }
}

token 在 Apify Console → Settings → API & Integrations 获取。

或本地运行(stdio 模式)

git clone https://github.com/PanStories/mcp-stock-analyst
cd mcp-stock-analyst
npm install && npm run build
{
  "mcpServers": {
    "stock-analyst": {
      "command": "node",
      "args": ["C:\\path\\to\\mcp-stock-analyst\\build\\index.js"]
    }
  }
}

本地调试

npx @modelcontextprotocol/inspector node build/index.js   # 交互式调试界面
node e2e-test.mjs        # stdio 协议端到端测试
node http-e2e-test.mjs   # 本地 HTTP 端到端测试

计费(按事件付费)

无订阅、无月费,按工具调用次数收费:

事件

触发时机

单价

tool-call(主事件)

每次行情数据调用:get_quote / get_kline

$0.02

search-call

每次标的检索:search_stock

$0.005

永远免费: MCP 握手(initialize)和 tools/list——发现类请求不计费。

每个 Apify 账号每月自带 $5 平台免费额度(按 $0.02/次约 250 次报价调用),轻度用户实际等于免费用。

HTTP 端点(远程模式)

方法

路径

说明

POST

/mcp

MCP 协议端点(无状态 Streamable HTTP)

GET

/health

健康检查

GET

/

服务信息;响应 Apify 容器就绪探针

部署你自己的实例

npm install -g apify-cli
apify login
cd mcp-stock-analyst
apify push             # 在 Apify 平台侧构建 Docker 镜像

Actor 定义(.actor/actor.json)已启用 Standby 模式,MCP 路径 /mcp。端点形如 https://<username>--mcp-stock-analyst.apify.actor/mcp(以 Console → Endpoints 页为准,或通过 GET https://api.apify.com/v2/acts/<actorId>?token=<token> 返回的 data.standbyUrl 字段获取准确地址)。

技术栈

  • Node.js ≥ 18、TypeScript、官方 @modelcontextprotocol/sdk

  • 数据源:腾讯公开行情接口(A股/港股/美股,免费无 key)+ Yahoo Finance chart 接口(台湾,免费无 key)

  • 多阶段 Docker 构建(node:20-alpine)

路线图

  • 按事件计费

  • 台湾市场支持(TWSE / TPEx / 加权指数,Yahoo Finance 数据源)

  • 资金流向 / 龙虎榜

  • 财报摘要

  • 自定义 API key 鉴权层(自托管时用)

许可证

MIT


MCP Stock Analyst(繁體中文)

一個提供 A股 / 港股 / 美股 / 台股 行情資料的 MCP (Model Context Protocol) 伺服器——即時報價、智慧搜尋、歷史K線。

  • 零成本資料源:A股/港股/美股使用騰訊免費公開行情介面,台股使用 Yahoo Finance,皆無需 API key,無配額限制

  • 三個實用工具:即時報價(單次最多 10 個標的)、智慧搜尋(中文名稱/拼音/代碼)、歷史K線

  • 雙傳輸模式:stdio(本機桌面用戶端)+ Streamable HTTP(Apify Standby 遠端託管)

  • 已上架 Apify Store:https://apify.com/neeenja/mcp-stock-analyst —— 按次計費,無訂閱

工具列表

工具

功能

範例輸入

get_quote

即時報價(A股/港股/美股/台股,單次最多10個)

600519,00700,AAPL,2330.TW

search_stock

智慧搜尋代碼/名稱/拼音

茅台 / GZMT / NVIDIA / 台積電 / TSMC

get_kline

歷史K線(日/週/月,20–640 根)

600519 或 2330.TW,period=day

台灣股票代碼格式

台股(TWSE 上市 / TPEx 上櫃)使用 Yahoo Finance 資料源,支援以下輸入格式:

  • 2330.TW —— 上市股票(顯式指定)

  • 5483.TWO —— 上櫃股票(顯式指定)

  • tw2330 —— 簡寫;伺服器自動探測交易所(先試 .TW,再試 .TWO)

  • ^TWII —— 台灣加權指數(TAIEX)

連接方式(推薦:雲端端點)

任意 MCP 用戶端透過 mcp-remote 連接雲端端點:

{
  "mcpServers": {
    "stock-analyst": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote",
        "https://neeenja--mcp-stock-analyst.apify.actor/mcp",
        "--header", "Authorization: Bearer ${APIFY_TOKEN}"
      ],
      "env": { "APIFY_TOKEN": "<你的-Apify-token>" }
    }
  }
}

token 在 Apify Console → Settings → API & Integrations 取得。

或本機執行(stdio 模式)

git clone https://github.com/PanStories/mcp-stock-analyst
cd mcp-stock-analyst
npm install && npm run build
{
  "mcpServers": {
    "stock-analyst": {
      "command": "node",
      "args": ["C:\\path\\to\\mcp-stock-analyst\\build\\index.js"]
    }
  }
}

本機除錯

npx @modelcontextprotocol/inspector node build/index.js   # 互動式除錯介面
node e2e-test.mjs        # stdio 協定端對端測試
node http-e2e-test.mjs   # 本機 HTTP 端對端測試

計費(按事件付費)

無訂閱、無月費,按工具呼叫次數收費:

事件

觸發時機

單價

tool-call(主事件)

每次行情資料呼叫:get_quote / get_kline

$0.02

search-call

每次標的檢索:search_stock

$0.005

永遠免費: MCP 握手(initialize)和 tools/list——探索類請求不計費。

每個 Apify 帳號每月自帶 $5 平台免費額度(按 $0.02/次約 250 次報價呼叫),輕度用戶實際等於免費用。

HTTP 端點(遠端模式)

方法

路徑

說明

POST

/mcp

MCP 協定端點(無狀態 Streamable HTTP)

GET

/health

健康檢查

GET

/

服務資訊;回應 Apify 容器就緒探測

部署你自己的實例

npm install -g apify-cli
apify login
cd mcp-stock-analyst
apify push             # 在 Apify 平台側建置 Docker 映像檔

Actor 定義(.actor/actor.json)已啟用 Standby 模式,MCP 路徑 /mcp。端點形如 https://<username>--mcp-stock-analyst.apify.actor/mcp(以 Console → Endpoints 頁為準)。

技術棧

  • Node.js ≥ 18、TypeScript、官方 @modelcontextprotocol/sdk

  • 資料源:騰訊公開行情介面(A股/港股/美股,免費無 key)+ Yahoo Finance chart 介面(台股,免費無 key)

  • 多階段 Docker 建置(node:20-alpine)

路線圖

  • 按事件計費

  • 台灣市場支援(TWSE / TPEx / 加權指數,Yahoo Finance 資料源)

  • 資金流向 / 龍虎榜

  • 財報摘要

  • 自訂 API key 驗證層(自架時用)

授權條款

MIT

Available Tools

3 tools
get_klineB

Get historical K-line (candlestick) data for a stock. Day/week/month periods, up to 640 bars.

ParametersJSON Schema
NameRequiredDescriptionDefault
codeYesStock code, e.g. "600519" or "sh600519"
daysNoNumber of bars (20-640, default 120)
periodNoK-line periodday

TDQS

B3.4/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It adds 'up to 640 bars' and 'day/week/month periods', but these restate the input schema rather than revealing new behavior such as return format, error behavior, or whether the data is read-only. This is thin coverage for a tool with no annotation support.

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

Conciseness4/5

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

One clean sentence with no filler, and the core action is front-loaded. Some words ('day/week/month periods', 'up to 640 bars') duplicate schema details rather than adding new information, so it is concise but not maximally informative.

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

Completeness3/5

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

The input side is fully covered by the schema (code, days, period), so an agent can construct a valid call. However, there is no output schema and the description never describes the shape of a K-line response, leaving the agent to guess how to consume the result. For a simple read tool this is a moderate gap, not a fatal one.

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

Parameters3/5

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

Schema description coverage is 100%, and the schema documents defaults, ranges, and enum values for all three parameters. The description's mention of periods and bar limit adds no parameter meaning beyond the schema, so the baseline of 3 applies.

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 opens with 'Get historical K-line (candlestick) data for a stock', naming a specific verb, resource, and scope. The 'historical' qualifier and the K-line/candlestick terminology distinguish it from the sibling tools get_quote and search_stock even without naming them.

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

Usage Guidelines3/5

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

The word 'historical' implies this tool is for past bar data rather than current quotes, but the description never tells an agent when to prefer it over get_quote or search_stock, nor does it mention any exclusions or prerequisites. Usage is only implied, not stated.

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

get_quoteA

Get real-time stock quote for A-share / HK / US stocks. Accepts codes like "600519", "sh600519", "00700" (HK), "AAPL" (US). Multiple codes separated by comma.

ParametersJSON Schema
NameRequiredDescriptionDefault
codesYesStock code(s), comma separated, e.g. "600519,00700,AAPL"

TDQS

A3.9/5.0
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It only states what it does, not whether it is read-only, has rate limits, or any side effects. It does not mention authentication, error handling, or response behavior. For a tool with zero annotation coverage, this is insufficient.

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 two sentences, front-loads the core purpose, and packs all necessary usage details (accepted formats, comma separation) without redundancy. Every sentence contributes meaning, making it highly efficient.

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

Completeness3/5

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

The tool is simple with one parameter and no output schema, but the description does not describe the return format or expected data structure. For a quote tool, the agent may need to know whether it returns a price object, a string, or errors. Given the lack of output schema and annotations, a bit more detail on what the caller should expect would improve completeness, but the core calling instructions are adequate.

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

Parameters4/5

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

Schema coverage is 100%, but the description adds valuable context beyond the schema: it explicitly mentions the 'sh' prefix format and clarifies that HK codes like '00700' and US codes like 'AAPL' are accepted. This enhances the agent's understanding beyond the schema's single example, justifying a score above baseline 3.

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 it gets real-time stock quotes for three markets, lists accepted code formats, and implies a distinction from siblings (search_stock, get_kline) by focusing on real-time quote retrieval. The verb 'Get' plus the resource 'real-time stock quote' is specific and unambiguous.

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

Usage Guidelines4/5

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

While no explicit alternatives or when-not-to-use are given, the purpose is clear enough that an agent would infer this tool is for quotes, not searching or historical data. The context of real-time quotes differentiates it from siblings without needing explicit exclusion statements.

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

search_stockA

Search stock code/name. Supports Chinese name, pinyin abbreviation, or partial code. Returns matched stocks with codes.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMax results (default 8)
queryYesSearch keyword, e.g. "茅台", "GZMT", "600", "Tesla"

TDQS

A3.7/5.0
Behavior3/5

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

No annotations are provided, so the description must carry the full burden. It discloses that matches are returned with codes, but does not mention edge cases (e.g., no matches), result ordering, or how the limit parameter affects results. The behavior is mostly captured but lacks important contextual details.

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 two sentences, front-loads the purpose, and contains no filler or redundancy. Every phrase adds useful information about supported inputs and outputs.

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

Completeness3/5

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

The tool is simple (2 params, no output schema, no annotations). The description explains the core purpose and input flexibility, but does not describe the result shape beyond 'stocks with codes' and omits notes about default limits or behavior when multiple matches exist. While adequate for a simple search, it leaves some operational details unspecified.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description adds the concept of pinyin abbreviation and partial code support, which slightly extends the schema's examples, but the schema already includes illustrative examples. The description does not add meaningful information about the limit parameter, so added value is minimal.

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 verb 'search' and the resource 'stock', and specifies supported input formats (Chinese name, pinyin abbreviation, partial code). It also states the output ('matched stocks with codes'), which distinguishes it from siblings like get_quote and get_kline that retrieve specific data rather than search.

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

Usage Guidelines3/5

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

The description implies when to use the tool (when you have a partial identifier or name) through examples, but it does not explicitly state when to use this tool versus alternatives like get_quote or get_kline. No exclusions or alternative routing are mentioned, so guidance is merely implied rather than explicit.

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. 3 tool updatesv0.1.0
    • First observedget_kline
    • First observedget_quote
    • First observedsearch_stock

TDQS

A3.9/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct role: search_stock resolves symbols, get_quote fetches live prices, and get_kline returns historical bars. There is no overlap or ambiguity between them.

Naming Consistency5/5

All three tools follow the same lowercase snake_case verb_noun convention: get_quote, search_stock, get_kline. The naming pattern is consistent and predictable.

Tool Count4/5

Three tools is within the reasonable range and each one earns its place, but for a server calling itself a 'stock analyst' the set is slightly lean. It covers the basics without bloat.

Completeness4/5

The core search -> quote -> kline workflow is well covered, and the read-only nature of the domain means CRUD operations are not expected. However, a true analyst toolset might also include fundamentals, market indices, or order book data, so there are minor gaps.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Provides real-time market data for A-shares, Hong Kong, and US stocks using the Tencent Finance API. It enables users to manage stock positions and watchlists through an AI assistant.
    12
    17 npm
    1
    ISC
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides free Chinese A-share stock data including real-time quotes, historical K-lines, market scanning, and multi-factor stock screening via BaoStock and Sina Finance APIs.
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Provides real-time A-share stock quotes and historical K-line data via public APIs from Sina/Tencent, deployable on Cloudflare Workers.
    -