npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pidanmoe/mcp-stock

v1.0.3

Published

这是一个基于 [FastMCP](https://github.com/fastmcp/fastmcp) 框架构建的 MCP (Model Context Protocol) 工具包,用于获取中国A股市场相关的股票数据。

Readme

mcp-stock

这是一个基于 FastMCP 框架构建的 MCP (Model Context Protocol) 工具包,用于获取中国A股市场相关的股票数据。

功能

当前实现了以下股票数据查询工具:

  • current_time: 获取当前时间
  • ipo_new_share: 获取新股IPO信息
  • stock_company: 获取上市公司基本信息
  • daily: 获取股票每日行情数据
  • weekly: 获取股票每周行情数据
  • monthly: 获取股票每月行情数据
  • rt_k: 获取股票实时行情数据

安装依赖

bun install

环境变量配置

需要配置 Tushare Token 才能正常使用数据查询功能:

# 复制示例环境变量文件
cp .env.example .env

# 编辑 .env 文件,填入你的 Tushare Token

运行项目

bun run dev

调试项目

bun run inspect

构建项目

bun run build

部署 MCP

{
  "mcpServers": {
    "mcp-stock": {
      "args": ["-y","@pidanmoe/mcp-stock"],
      "command": "npx",
      "env": {
        "TUSHARE_TOKEN": "YOUR_TUSHARE_TOKEN"
      }
    }
  }
}

项目结构

使用说明

该项目遵循 Model Context Protocol 规范,可以通过标准 I/O 或其他传输方式与支持 MCP 的客户端进行通信。

工具详细说明

current_time

获取当前系统时间

  • 无参数
  • 返回:当前时间字符串,格式为 "YYYY-MM-DD HH:mm:ss"

ipo_new_share

获取新股IPO信息

  • 可选参数:
    • start_date: 上网发行开始日期(YYYYMMDD)
    • end_date: 上网发行结束日期(YYYYMMDD)
  • 返回:包含以下信息的文本:
    • 股票名称和代码
    • 申购代码
    • 上网发行日期
    • 上市日期
    • 发行总量(万股)
    • 上网发行量(万股)
    • 发行价格(元)
    • 市盈率
    • 个人申购上限(万股)
    • 募集资金(亿元)
    • 中签率

stock_company

获取上市公司基本信息

  • 可选参数:
    • ts_code: 股票代码
    • exchange: 交易所代码(SSE: 上交所, SZSE: 深交所, BSE: 北交所)
  • 返回:包含以下信息的文本:
    • 公司全称和股票代码
    • 统一社会信用代码
    • 交易所
    • 法人代表
    • 总经理
    • 董秘
    • 注册资本(万元)
    • 注册日期
    • 所在省市
    • 公司主页
    • 电子邮件
    • 办公地址
    • 员工人数
    • 公司简介
    • 经营范围
    • 主要业务

daily

获取股票每日行情数据

  • 可选参数:
    • ts_code: 股票代码(支持多个股票同时提取,逗号分隔)
    • start_date: 开始日期(YYYYMMDD)
    • end_date: 结束日期(YYYYMMDD)
  • 返回:包含以下信息的文本(按股票代码分组):
    • 交易日期
    • 开盘价、最高价、最低价、收盘价
    • 昨收价、涨跌额、涨跌幅
    • 成交量(手)、成交额(千元)

weekly

获取股票每周行情数据

  • 可选参数:
    • ts_code: 股票代码(支持多个股票同时提取,逗号分隔)
    • start_date: 开始日期(YYYYMMDD)
    • end_date: 结束日期(YYYYMMDD)
  • 返回:包含以下信息的文本(按股票代码分组):
    • 交易日期
    • 开盘价、最高价、最低价、收盘价
    • 上周收盘价、涨跌额、涨跌幅
    • 成交量、成交额

monthly

获取股票每月行情数据

  • 可选参数:
    • ts_code: 股票代码(支持多个股票同时提取,逗号分隔)
    • start_date: 开始日期(YYYYMMDD)
    • end_date: 结束日期(YYYYMMDD)
  • 返回:包含以下信息的文本(按股票代码分组):
    • 交易日期
    • 开盘价、最高价、最低价、收盘价
    • 上月收盘价、涨跌额、涨跌幅
    • 成交量、成交额

rt_k

获取股票实时行情数据

  • 必需参数:
    • ts_code: 股票代码,支持通配符方式,例如 6.SH、301.SZ、600000.SH
  • 返回:包含以下信息的文本:
    • 股票名称和代码
    • 昨收价
    • 开盘价、最高价、最低价、最新价
    • 成交量(股)、成交金额(元)
    • 开盘以来成交笔数

技术栈

  • Bun - JavaScript/TypeScript 运行时
  • FastMCP - MCP 框架
  • Zod - TypeScript-first schema declaration and validation library
  • Tushare - 金融数据提供商

此项目使用 bun v1.2.19 创建。Bun 是一个快速的一体化 JavaScript 运行时。