Stock MCP Server
Provides real-time A-share stock quotes and historical K-line data via public APIs from Sina/Tencent, deployable on Cloudflare Workers.
README
A股实时行情 MCP Server
通过新浪财经 / 腾讯财经公开行情接口,为 Claude 提供 A 股实时行情和历史K线查询能力。 部署在 Cloudflare Workers(免费)上,代码托管在 GitHub。
功能
get_realtime_quote:查询一只或多只股票的最新价/收盘价、开高低、成交量额、涨跌幅get_history_kline:查询单只股票指定日期区间的历史日K线(开盘/收盘/最高/最低/成交量)
部署步骤
1. 准备账号
- 注册 GitHub(已有可跳过)
- 注册 Cloudflare(免费)
2. 上传代码到 GitHub
- 在 GitHub 新建一个仓库,例如命名为
stock-mcp-server - 把本项目文件夹(
stock-mcp-server/)里的所有文件上传到该仓库- 可以直接在 GitHub 网页用 "Add file → Upload files" 拖拽上传
- 或用 git 命令行:
git init git add . git commit -m "init" git remote add origin https://github.com/你的用户名/stock-mcp-server.git git push -u origin main
3. 连接 Cloudflare 部署(推荐:网页一键集成,无需命令行)
- 登录 Cloudflare Dashboard
- 左侧菜单选择 Workers & Pages → 创建 → Workers
- 选择 连接到 Git(Connect to Git)
- 授权并选择你刚创建的 GitHub 仓库
stock-mcp-server - 部署配置保持默认(Cloudflare 会自动识别
wrangler.toml),点击 保存并部署 - 部署完成后,Cloudflare 会给你一个网址,形如:
https://a-share-stock-quote.你的子域名.workers.dev
之后每次你在 GitHub 更新代码,Cloudflare 会自动重新部署,无需手动操作。
4. 验证部署是否成功
浏览器直接打开(替换成你自己的网址):
https://a-share-stock-quote.你的子域名.workers.dev/quote?codes=300346,002428
如果返回类似下面的 JSON,说明部署成功:
[
{"code":"sz300346","name":"南大光电","price":71.43, ...},
{"code":"sz002428","name":"云南锗业","price":124.0, ...}
]
5. 把这个 MCP Server 接入 Claude
把部署好的网址(注意路径是 /mcp,不是 /quote)告诉 Claude 或在 claude.ai 的 Connector 设置里添加:
https://a-share-stock-quote.你的子域名.workers.dev/mcp
具体添加方式:claude.ai 设置 → Connectors → 添加自定义连接器 → 填入上面的 URL。
本地命令行部署(可选,给熟悉命令行的用户)
npm install
npx wrangler login # 浏览器授权登录 Cloudflare
npx wrangler deploy # 部署
调试接口(不经过MCP,直接用浏览器/curl测试)
- 实时行情:
GET /quote?codes=300346,002428 - 历史K线:
GET /history?code=300346&start=2026-06-01&end=2026-06-29
数据来源说明
- 实时行情:新浪财经公开接口
hq.sinajs.cn - 历史K线:腾讯财经公开接口
web.ifzq.gtimg.cn
均为公开免登录接口,仅供个人学习研究使用,请勿用于高频请求或商业用途。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.