Stock API For MCP

by zhangxiangliang

Not rated
GitHub

About

stock-api is a zero-runtime-dependency stock market data toolkit for Node.js, browsers, CLI usage, and MCP-compatible AI clients. Use stocks.auto by default to read from the first available provider.

Details

Author
zhangxiangliang
Categories
Other, Finance, API

Setup

Install Stock API For MCP in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/zhangxiangliang/stock-api

Follow the installation instructions in the repository README, then restart your MCP client.

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 股、港股、美股代码格式
- 零运行时依赖

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前缀,例如SH510500SZ000651

<script src="https://cdn.jsdelivr.net/npm/stock-api/dist/browser/stock-api.iife.min.js"></script>
<script> 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); </script>
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 格力电器
{ "mcpServers": { "stock-api": { "command": "npx", "args": ["-y", "stock-api", "mcp"] } } }

内置工具:get_stockget_stocksget_klinessearch_stocksinspect_stock

不想配置 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 共用同一套数据逻辑,只是接入方式更简单、跨工具通用。

stock-api使用第三方公开行情接口作为数据来源,不保证数据的准确性、完整性、实时性或持续可用性。本项目不提供投资建议,任何交易或投资决策都应由你自行判断。商业、高频或生产使用前,请自行确认第三方数据源的服务条款、授权范围和合规要求。

Connect to any financial, utility, billing accounts; retrieve balance, transactions, payment and identity data instantly.

Analyze and visualize financial data of listed companies using the DART API.

Real-time electricity spot prices and contract recommendations for AI agents — covering the Nordics and Germany.

Stock Market & Financial Data MCP Server – FinancialData.Net

Options Analytics API - GEX Exposure Greeks Volatility

A Model Context Protocol (MCP) server that exposes public Bank of Russia (Центральный банк РФ, CBR) data — currency quotes, key rate, inflation and a compact macro snapshot — to AI agents.

MCP server for Indian APIs — GSTIN, IFSC, PAN, UPI, pincode, HSN/SAC. Zero auth. Offline-first. For AI agents.

Brazilian fixed income & financial data for AI - Selic, CDI, IPCA, CDB/LCI rankings and market quotes via JSON-RPC

Real-time oil, gas, and commodity prices. 40+ energy commodities with natural language queries, price subscriptions, and analyst prompts.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.