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

xueqiu-mcp-server

v0.1.0

Published

MCP server for Xueqiu finance data

Readme

Xueqiu MCP Server

  • 独立的 Node/TS MCP 服务,依赖雪球 Cookie 访问接口。
  • 参考本机模板 server-larkoffice 的项目结构与启动方式。

使用

  1. 提供 Cookie:通过进程环境变量注入 XQ_A_TOKEN,可选 XQ_R_TOKENXQ_U,或运行时调用工具 updateCookies 注入结构化 Cookie(xq_a_token/xq_r_token/u 或整串 cookieHeader)
  2. 安装依赖并构建:
    • npm i
    • npm run build
  3. 启动:
    • npm run start
  4. MCP 客户端接入(示例):在 Claude Desktop/VS Code MCP 配置中注册本服务并声明工具:
    • 基础:pingupdateCookies
    • 行情:getRealtimeQuotesquotecquote_detailpankougetQuoteSnapshot
    • 走势:getKlinegetMinuteTimeline
    • 搜索与自选:searchSymbolssuggest_stockgetWatchlistwatch_listwatch_stock
    • 资金:getCapitalAssortcapital_margincapital_blocktranscapital_flowcapital_history
    • 财务:finance_cash_flowfinance_cash_flow_v2finance_indicatorfinance_indicator_v2finance_balancefinance_balance_v2finance_incomefinance_income_v2finance_business
    • 研报:report_latestreport_earningforecast
    • F10:f10_skholderchgf10_skholderf10_industryf10_holdersf10_bonusf10_org_holding_changef10_industry_comparef10_business_analysisf10_shareschgf10_top_holdersf10_main_indicator
    • 组合:getCubeInfocube_nav_dailycube_rebalancing_historycube_rebalancing_currentcube_quote_current
    • 基金:fund_detailfund_infofund_growthfund_nav_historyfund_achievementfund_assetfund_managerfund_trade_datefund_derived
    • 指数:index_basic_infoindex_details_dataindex_weight_top10index_perf_7index_perf_30index_perf_90
    • 港股通:hkex_northbound
    • 其他:convertible_bond

示例

  • examples/check-quotes.js 读取环境变量并验证实时行情。
  • examples/check-minute.js 分钟/分时数据(该接口通常需要有效 Cookie,若返回 400016 请使用真实 Cookie)。
  • examples/check-capital.js 资金成交分布(通常需要有效 Cookie)。
  • examples/check-finance.js 财务指标与资金流示例(需设置 SYMBOL 与 Cookie)。

架构概览

  • 入口:src/server.ts(McpServer + stdio),统一工具注册,不改变业务逻辑
  • 客户端:src/xueqiu/client.ts,请求头与 Cookie 追加、拦截器与轻量缓存
  • 常量与类型:src/core/constants.tssrc/core/types.ts;工具注册辅助:src/core/registry.ts
  • 工具:src/tools/*.ts,每个工具包含 zod 入参/出参与执行器

常见错误码

  • 400016:Cookie 无效或权限不足;请确保使用有效 xq_a_token
  • 429:触发限速;客户端已进行指数退避重试
  • 5xx:服务端异常;客户端有限次重试

安全

  • Cookie 仅存于内存,不写入日志与仓库;日志已做脱敏处理。