Install
$ agentstack add mcp-zhangxiangliang-stock-api ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
stock-api
支持 A 股、港股、美股行情查询的 TypeScript 股票数据工具。
English | 简体中文
stock-api 是一个零运行时依赖的股票行情工具,支持 Node.js、浏览器、CLI 和 MCP。默认使用 stocks.auto,自动从可用数据源获取行情。
支持使用方式
特性
- Node.js / Browser bundler API + TypeScript 类型
- CLI 查询股票行情、K 线和搜索股票
- MCP tools 给 AI 客户端直接调用股票接口
- 默认自动兜底:
tencent -> sina -> eastmoney - 指定数据源:
stocks.tencent/stocks.sina/stocks.eastmoney - 支持 A 股、港股、美股代码格式
- 零运行时依赖
Node.js
安装
Node.js 环境要求 >=18。
npm install stock-api
使用
import { stocks } from "stock-api";
const stock = await stocks.auto.getStock("SH510500");
const list = await stocks.auto.getStocks(["SH510500", "SZ000651"]);
const klines = await stocks.auto.getKlines("SH600519", { period: "day" });
const results = await stocks.auto.searchStocks("格力电器");
股票代码使用 SH / SZ / HK / US 前缀,例如 SH510500、SZ000651。
浏览器
引用
使用
StockApi.stocks.auto.getStock("SH510500").then(console.log);
StockApi.stocks.auto.getStocks(["SH510500", "SZ000651"]).then(console.log);
StockApi.stocks.auto.getKlines("SH600519", { period: "day" }).then(console.log);
StockApi.stocks.auto.searchStocks("格力电器").then(console.log);
浏览器示例:GitHub Pages
CLI
npx stock-api get-stock SH510500
npx stock-api get-stocks SH510500 SZ000651
npx stock-api get-klines SH600519 --period day --count 120
npx stock-api search-stocks 格力电器
MCP
把 stock-api 接到支持 MCP 的 AI 客户端:
{
"mcpServers": {
"stock-api": {
"command": "npx",
"args": ["-y", "stock-api", "mcp"]
}
}
}
内置工具:get_stock、get_stocks、get_klines、search_stocks、inspect_stock。
AI Agent(任意工具)
不想配置 MCP?把下面这句话发给任意 AI 工具(Claude Code、Codex、GLM 等),它读完就知道怎么用 stock-api:
请阅读 https://raw.githubusercontent.com/zhangxiangliang/stock-api/main/SKILL.md
然后用 stock-api 回答我的股票问题。
SKILL.md 里写了具体的 npx stock-api 命令,所以和 MCP 共用同一套数据逻辑,只是接入方式更简单、跨工具通用。
数据源
内置腾讯、新浪、东方财富数据源,默认由 stocks.auto 自动处理。
| 数据源 | 用法 | 能力 | | --- | --- | --- | | 自动兜底 | stocks.auto | 单只行情、批量行情、K 线、搜索、诊断 | | 腾讯 | stocks.tencent | 单只行情、批量行情、K 线、搜索、诊断 | | 新浪 | stocks.sina | 单只行情、批量行情、K 线、搜索、诊断 | | 东方财富 | stocks.eastmoney | A 股单只行情、批量行情、K 线、搜索、诊断 |
文档
| 文档 | 内容 | | --- | --- | | [API 使用](docs/api.md) | TypeScript API、自动兜底、诊断返回结构 | | [CLI 使用](docs/cli.md) | 命令、参数、输出、退出码 | | [项目架构](docs/architecture.md) | 目录结构、provider 工厂、解析和错误模型 | | [开发指南](docs/development.md) | 本地开发、测试、发布前检查、新增数据源 | | [API 监控](docs/monitoring.md) | 定时检查第三方数据源并更新状态徽章 |
免责声明
stock-api 使用第三方公开行情接口作为数据来源,不保证数据的准确性、完整性、实时性或持续可用性。本项目不提供投资建议,任何交易或投资决策都应由你自行判断。商业、高频或生产使用前,请自行确认第三方数据源的服务条款、授权范围和合规要求。
License
MIT
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: zhangxiangliang
- Source: zhangxiangliang/stock-api
- License: MIT
- Homepage: https://zhangxiangliang.github.io/stock-api/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.