stock-api skill

A skill and MCP server that give an agent quotes, candles and ticker search for the China, Hong Kong and US markets

  • 1,986 ★ on the repository
  • Last commit
  • MIT
Skill

Extended access

Why this level

  • Uses the network: requests quotes from public interfaces of Chinese finance portals
  • Runs through npx and pulls the package from npm on first call without a pinned version
All reasons and checks

zhangxiangliang/stock-api

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add skills/stock-api

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • Uses the network: requests quotes from public interfaces of Chinese finance portals
  • Runs through npx and pulls the package from npm on first call without a pinned version

This is third-party code. Review the repository files before installing.

What it does

stock-api answers questions about a share price, candlestick history and a security's code from a company name. One npm package works four ways: as a TypeScript library for Node.js, as a browser script, as a command line and as an MCP server. All four share the same logic and data. An agent without MCP can read SKILL.md from the repository and run npx stock-api commands itself. They print JSON: get-stock for one quote, get-stocks for several, get-klines for daily, weekly and monthly candles with optional price adjustment, and search-stocks to find a code by name. By default the package tries Tencent, Sina and Eastmoney in turn and returns the first available answer; the --source option picks a source by hand. The MCP server exposes the get_stock, get_stocks, get_klines, search_stocks and inspect_stock tools.

Who it is for. For developers and analysts who want to give Claude Code, Codex or another agent quick access to Chinese, Hong Kong and US quotes.

Good fit when

  • You need the current price of one or several securities, such as SH510500 and SZ000651, right inside an agent conversation
  • A chart or analysis needs daily, weekly or monthly candles for a set number of periods with qfq or hfq adjustment
  • You only know a company name such as "格力电器" and the agent must find the code first, then the quote
  • A TypeScript project needs a zero-dependency quote client and you want to hand the same code to an agent through MCP

Not a fit when

  • You need quotes for Russian securities: the package covers the China, Hong Kong and US markets
  • You need licensed exchange data for reporting
  • You want to trade: the package only reads data and places no orders

Example request

Show the price of Gree Electric and daily candles for the last 20 days; find the code first by searching the name 格力电器

Limitations

  • Data comes from the public interfaces of Tencent, Sina and Eastmoney. The developer does not guarantee accuracy, completeness, timeliness or availability.
  • Before commercial, high-frequency or production use, check the sources' terms and data licensing.
  • Eastmoney search may fail from overseas networks and cloud server IPs because the source returns an anti-bot response. In auto mode search falls back to Tencent and Sina, and quotes and candles are unaffected.
  • It needs Node.js 18 or newer. The MCP server declares support for protocol versions 2025-11-25 and 2025-06-18.
  • Documentation and SKILL.md are in Chinese and English.

How to disable. Remove the stock-api block from mcpServers in the client settings. In your own project the package is removed with `npm uninstall stock-api`. It creates no keys or persistent processes.

FAQ

How do I install stock-api in Claude Code?

Add a stock-api entry to your MCP settings with the command npx and arguments -y, stock-api, mcp. If you do not need MCP, give the agent a link to SKILL.md from the repository and it will run the npx stock-api commands itself.

Which markets and code formats does stock-api support?

Mainland China, Hong Kong and the US. A code carries a prefix: SH and SZ for mainland exchanges, HK for Hong Kong, US for the United States, for example SH510500, SZ000651, HK02020 and USDJI.

Where does stock-api get quotes, and what happens if a source is down?

From the public interfaces of Tencent, Sina and Eastmoney. If a source does not answer, the package moves to the next one, and the repository carries status badges for each interface.

Can I use stock-api for trading decisions?

It is reference data: the developer gives no investment advice and does not promise the sources will run without interruption.

How is stock-api different from Alpha Vantage MCP?

stock-api needs no keys and focuses on the China and Hong Kong markets with US support, using free public sources. Alpha Vantage works through a key and its own API with its own limits.

Discussion

No questions or reviews yet.

Skills

A skill with Chinese A-share market data: quotes, research reports, financials, news and 11 more categories from 34 sources, no keys

SkillExtended access11.3KRepository stars

A local database of China A-share and ETF market data with an MCP server for natural-language queries

MCP serverExtended access3.1KRepository stars

A skill that finds bottlenecks in an industry's supply chain and shortlists A-share, Hong Kong and US stocks with data checks

SkillExtended access504Repository stars

Thirteen skills for quantitative trading on China's A-share market: AKShare and BaoStock data, Backtrader and RQAlpha backtests, QMT and JoinQuant docs

SkillBroad access469Repository stars

An unofficial Yahoo Finance client with an MCP server, a CLI and an agent skill: quotes, price history, financial statements and options for an agent

MCP serverBroad access810Repository stars

Claude for Financial Services CN

claude-for-financial-services-cn

An unofficial set of 63 skills for Claude Code: DCF, comps, LBO, notes and decks for Chinese equities with Wind, iFind and AkShare data

PluginExtended access876Repository stars

Comparison with similar tools

Entries that share the main search query, and how they differ.

EntryOfficialAuthenticationRepository starsMain difference
stock-api (this entry)no1,986
Alpha Vantage MCP ServeryesOAuth223the official Alpha Vantage MCP server with historical series and indicators, works through an API key
a-stock-datano11,281a skill for the China market only, with reports, financials and news from dozens of sources
FinanceMCPnokey is optional865an MCP finance data server via Tushare and Binance, covering bonds, macro indicators and crypto

README in short

A dependency-free package for Node.js, the browser, the command line and MCP, with install steps and examples for each mode. A table compares the three sources and what they offer.

README badge

Original SKILL.md

---
name: stock-api
description: Fetch real-time stock quotes, K-line (candlestick) history, and search symbols for China A-shares, Hong Kong, and US markets. Use when the user asks for a stock price, a quote, market data, candlestick/K-line data, or to look up a stock code by company name.
---

# stock-api

Get normalized stock market data by running the `stock-api` CLI. It covers
China A-shares, Hong Kong, and US markets, with automatic provider fallback
across Tencent, Sina, and Eastmoney.

## When to use

- The user wants a current price or quote for one or more stocks.
- The user wants K-line / candlestick history for charting or analysis.
- The user knows a company name but not its code (search first, then quote).

## How to run

Use `npx stock-api <command>`. Every command prints JSON to stdout.

Stock codes use a market prefix: `SH` / `SZ` (China), `HK` (Hong Kong),
`US` (US). Examples: `SH510500`, `SZ000651`, `HK02020`, `USDJI`.

### Get one quote

```bash
npx stock-api get-stock SH510500
```

### Get several quotes at once

```bash
npx stock-api get-stocks SH510500 SZ000651
```

Report a problem

Foxx AIstock-api
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.