get_klines
Get normalized K-line rows for charting.
Quotes and K-lines for A-shares, Hong Kong and US stocks, with automatic fallback across three data sources.
LABSCO SUMMARY
Free market feeds go down individually and quietly; the automatic fallback is what keeps a quote coming back, and the inspection call is what lets you find out why a number looks odd instead of guessing at it.
A stock quote tool in TypeScript with a zero-dependency runtime, usable from Node, a browser, the command line or as an MCP server. It reads public market feeds from Tencent, Sina and East Money, and by default falls back between them automatically rather than failing when one is down.
Node.js 18 or newer and network access to the upstream feeds. Run over stdio from npm as stock-api with the mcp subcommand; no key and no account, because the sources are public endpoints. That is also the limit worth knowing: the project states plainly that it does not guarantee the accuracy, completeness, timeliness or continued availability of third-party data, gives no investment advice, and asks you to check each source's own terms before commercial, high-frequency or production use.
One command — npx -y stock-api mcp
USE CASES
Ask by code and get a normalised quote, whichever of the three sources happens to be answering.
Pass the codes together rather than one call per line, and compare them in the same answer.
Pull K-line rows for the period and count you want, with the adjustment applied, ready to chart or summarise.
Search by keyword and take the symbol from the results before asking for the quote.
Inspect the code to see which providers responded and how the fallback resolved, then force the source you trust.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
get_klinesGet normalized K-line rows for charting.
get_stockGet one normalized stock quote by code.
get_stocksGet normalized stock quotes for multiple codes.
inspect_stockInspect quote availability and provider fallback details.
search_stocksSearch stock symbols by keyword.
BEFORE YOU INSTALL
5 tools when we connected.
All 3 documented clients run the server on your machine.
CONTEXT COST
Rated by the size of the 5 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
npx -y stock-api mcp{
"mcpServers": {
"stock-api": {
"command": "npx",
"args": [
"-y",
"stock-api",
"mcp"
]
}
}
}