ZS

zhangxiangliang/stock-api

Developer tools

This page was translated automatically. Technical details may differ from the original. View the original

2K stars Quality 83 Trend 45MIT

Query A-share, US, Hong Kong stock, and on-exchange fund market trends, and quickly access via Node.js, browser, CLI, or MCP.

Overview

stock-api is a zero-runtime dependency stock market tool supporting Node.js, browser, CLI, and MCP. By default, it uses stocks.auto and automatically retrieves market data from available data sources. - Node.js / Browser bundler API + TypeScript type - CLI for stock quotes, candlesticks, and stock search - MCP tools to directly call stock interfaces for AI clients - Default automatic backup: tencent -> sina -> eastmoney - Specified data source: stocks.tencent / stocks.sina / stocks.eastmoney - Supports A-share, Hong Kong, and US stock code formats - zero runtime dependency Stock codes use prefixes like SH / SZ / HK / US, such as SH510500 and SZ000651. Built-in tools: get_stock, get_stocks, get_klines, search_stocks, inspect_stock. Don't want to configure MCP? Send the following sentence to any AI tool (Claude Code, Codex, GLM, etc.), and it will read it and immediately know how to use the stock-api: SKILL.md contains specific npx stock-api commands, so it shares the same set of data logic as MCP, except the access method is simpler and it is cross-tool. Stock-API uses third-party public market quotation interfaces as data sources and does not guarantee the accuracy, completeness, real-time performance, or continuous availability of the data. This project does not provide investment advice; any transaction or investment decision should be made by you alone. Before commercial, high-frequency, or production use, please confirm the service terms, authorization scope, and compliance requirements of the third-party data source yourself.

Overview (machine translated)

stock-api

TypeScript stock data tool supporting A-share, Hong Kong, and US stock market quotes.

English | Chinese Simplified

stock-api is a zero-runtime dependency stock quotation tool that supports Node.js, browser, CLI, and MCP. By default, stocks.auto is used to automatically obtain quotes from available data sources.

Supported usage methods

Features

  • Node.js / Browser bundler API + TypeScript type
  • CLI to query stock quotes, candlesticks, and search stocks
  • MCP tools allow AI clients to directly call stock interfaces
  • Default auto backup: tencent -> sina -> eastmoney
  • Specify data source: stocks.tencent / stocks.sina / stocks.eastmoney
  • Supports code formats for A-shares, Hong Kong stocks, and US stocks
  • Zero runtime dependencies

Node.js

Installation

Node.js Environmental requirements >=18.

Usage

Stock codes use prefixes SH / SZ / HK / US prefixes, such as SH510500, SZ000651.

Browser

Quotes

Usage

Browser example: GitHub Pages

CLI

MCP

Connect stock-api to an AI client that supports MCP:

Built-in tools: get_stock, get_stocks, get_klines, [T17]], [T18]].

Supported MCP protocol versions: 2025-11-25, 2025-06-18. When shaking hands, the client returns the requested version; if not supported, it reverts to the latest version.

AI Agent (Any Tool)

Don’t want to configure MCP? Send the following sentence to any AI tool (Claude Code, Codex, GLM, etc.), and it will know how to use it after reading it stock-api:

SKILL.md contains specific npx stock-api commands, so it shares the same set of data logic as MCP, but the access method is simpler and it is cross-tool.

Data Source

Built-in data sources for Tencent, Sina, and Eastmoney, automatically processed by default by stocks.auto.

Data source Usage Capability
Automatic Backing stocks.auto Single quotes, batch quotes, candlesticks, search, diagnostics
Tencent stocks.tencent Single market quotes, batch quotes, candlesticks, search, diagnostics
Sina `stocks.

This page was translated automatically. Technical details may differ from the original.

Recommended Tools

Try a different keyword or remove a filter.

Install

npx skillfish add zhangxiangliang/stock-api
New to MCP? Start with the mcpskill.org guide →