Stock MCP Server

Provides real-time market data for A-shares, Hong Kong, and US stocks.

README.md

Stock MCP Server

腾讯股票数据 MCP 服务器,为 AI 助手提供股票数据查询和持仓管理功能。

功能特性

股票行情查询

  • A股实时行情(上海、深圳)
  • 港股实时行情
  • 美股实时行情
  • 支持批量查询

持仓管理

  • 添加、更新、删除持仓
  • 查询持仓列表和详情

观察列表

  • 添加、更新、删除关注股票
  • 查询观察列表

支持的市场

代码 市场
sh 上海A股
sz 深圳A股
hk 港股
us 美股

每手股数 (lotSize)

市场 每手股数
A股普通 100股
A股科创板(688开头) 200股
港股 取数据第61位
美股 1股

快速开始

安装依赖

npm install

构建项目

npm run build

配置 MCP

在 Claude Code 或其他 MCP 客户端的配置文件中添加:

{
  "mcpServers": {
    "stock": {
      "command": "node",
      "args": ["/path/to/stock-mcp/dist/index.js"]
    }
  }
}

使用示例

// 查询股票行情
stock_get({ symbol: "sh000001" })

// 批量查询
stock_get_batch({ symbols: ["sh000001", "sz000001"] })

// 添加持仓
position_add({ symbol: "sz000001", shares: 100, cost: 10.5 })

// 添加观察
watch_add({ symbol: "hk00700", note: "腾讯控股" })

可用工具

工具 描述
stock_get 获取单只股票实时行情
stock_get_batch 批量获取多只股票行情
position_add 添加持仓
position_update 更新持仓
position_remove 删除持仓
position_list 获取所有持仓
position_get 获取单个持仓
watch_add 添加观察股票
watch_update 更新观察股票
watch_remove 删除观察股票
watch_list 获取所有观察
watch_get 获取单个观察

技术栈

  • TypeScript
  • Node.js
  • @modelcontextprotocol/sdk

数据来源

股票数据来自 腾讯财经 API

License

MIT

Tools 12

stock_getGet real-time market data for a single stock.
stock_get_batchGet real-time market data for multiple stocks.
position_addAdd a new stock position.
position_updateUpdate an existing stock position.
position_removeRemove a stock position.
position_listList all current stock positions.
position_getGet details for a specific stock position.
watch_addAdd a stock to the watchlist.
watch_updateUpdate a stock in the watchlist.
watch_removeRemove a stock from the watchlist.
watch_listList all stocks in the watchlist.
watch_getGet details for a specific stock in the watchlist.

Try it

What is the current real-time price for Tencent (hk00700)?
Add 100 shares of sz000001 to my portfolio at a cost of 10.5.
Show me the current performance of all stocks in my watchlist.
Get the latest market data for Apple (usAAPL) and Microsoft (usMSFT).
List all my current stock positions and their details.

Frequently Asked Questions

What are the key features of Stock MCP Server?

Real-time market data for A-shares, Hong Kong, and US stocks. Batch stock price querying. Full portfolio management (add, update, remove, list). Watchlist tracking for monitoring specific stocks. Powered by Tencent Finance API.

What can I use Stock MCP Server for?

Tracking personal stock investments directly within an AI chat interface. Quickly checking real-time market prices for international stocks. Maintaining a watchlist of stocks to monitor for potential entry points. Automating portfolio valuation updates using AI.

How do I install Stock MCP Server?

Install Stock MCP Server by running: npm install && npm run build

What MCP clients work with Stock MCP Server?

Stock MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Stock MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare