MCP Stock Assistant

MCP Stock Assistant

Provides real-time stock information for Chinese A-shares and US stocks using the Xueqiu API. Enables users to fetch comprehensive market data including current price, percentage changes, volume, and other key metrics by stock code.

Category
Visit Server

README

MCP Stock Assistant

一个基于模型上下文协议 (MCP) 的股票信息服务器,使用东方财富API提供实时股票数据。

功能特性

  • 📈 获取实时股票数据(支持股票代码或名称查询)
  • 📊 获取股票历史K线数据(日K、周K、月K)
  • 🏛️ 获取大盘指数信息(上证指数、深证成指)
  • 💹 详细的买卖盘口信息
  • 📋 支持中国A股市场(沪深两市)
  • 🔍 智能股票搜索(支持股票名称模糊匹配)

安装说明

  1. 克隆仓库:

    git clone <repository-url>
    cd mcp-stock
    
  2. 安装依赖:

    pnpm install
    
  3. 构建项目:

    pnpm run build
    

使用方法

配置MCP客户端

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

{
  "mcpServers": {
    "mcp-stock": {
      "command": "node",
      "args": [
        "/Users/zhangyanhua/Documents/augment-projects/mcp-stock/build/index.js" // 打包后的真实路径
      ]
    }
  }
}

该服务器实现了模型上下文协议,可以与任何支持MCP的客户端配合使用,如Claude Desktop。

可用工具

服务器提供以下三个工具:

  1. get-stock-info: 获取股票实时信息

    • 参数: stock_code - 股票代码或名称(例如:600519 或 贵州茅台)
  2. get-stock-history: 获取股票历史数据

    • 参数:
      • stock_code - 股票代码或名称
      • period - 时间周期(1d=日K线, 1w=周K线, 1m=月K线,默认1d)
      • days - 获取天数(1-500天,默认30天)
  3. get-market-index: 获取大盘指数信息

    • 无参数,返回上证指数和深证成指的实时数据

使用示例

1. 获取股票实时信息

股票信息: 600519 (贵州茅台)

当前价格: 1756.00
跌幅: -0.85%
涨跌额: -15.00
开盘价: 1770.00
最高价: 1775.00
最低价: 1750.00
昨收价: 1771.00
成交量: 45678.00手
成交额: 8023456.00万
换手率: 0.36%
市盈率(动态): 35.2
振幅: 1.41%
更新时间: 15:00:00

买卖盘口:
卖5: 1758.00 / 120.00手
卖4: 1757.00 / 89.00手
卖3: 1756.50 / 156.00手
卖2: 1756.20 / 234.00手
卖1: 1756.00 / 67.00手
买1: 1755.80 / 145.00手
买2: 1755.50 / 78.00手
买3: 1755.20 / 203.00手
买4: 1755.00 / 167.00手
买5: 1754.80 / 89.00手

2. 获取股票历史数据

📈 贵州茅台(600519) 历史数据 (最近10个交易日)

日期        开盘    收盘    最高    最低    成交量(手)  涨跌幅
─────────────────────────────────────────────────────────────────
2024-01-15  1770.00 1756.00 1775.00 1750.00  45678.00 📉-0.85%
2024-01-12  1780.00 1771.00 1785.00 1765.00  52341.00 📈+0.57%
...

📊 统计信息:
最高价: 1785.00
最低价: 1720.00
平均价: 1752.50
总成交量: 456789.00手

3. 获取大盘指数信息

📊 大盘指数信息

指数名称      当前点位    涨跌幅     涨跌点    成交量(手)   成交额(万)
──────────────────────────────────────────────────────────────────
上证指数       2956.48 📉-0.42%    -12.56  123456789.00 45678901.00
深证成指      9234.67 📉-0.38%    -35.23   98765432.00 32109876.00

🕐 更新时间: 15:00:00

股票代码格式

支持以下格式的股票查询:

按代码查询

  • 沪市A股: 6位数字代码(如:600519601318688981
  • 深市A股: 6位数字代码(如:000858002415300750

按名称查询

  • 股票全名: 如 贵州茅台平安银行
  • 股票简称: 如 茅台平安

代码规则

  • 沪市主板: 600、601、603、605开头
  • 科创板: 688开头
  • 深市主板: 000开头
  • 中小板: 002开头
  • 创业板: 300、301开头

技术说明

  • 📡 使用东方财富API获取实时股票数据
  • 🔌 基于stdio传输协议,与MCP客户端完全兼容
  • 🆓 无需API密钥,免费使用(可能存在频率限制)
  • 🚀 支持智能搜索,可通过股票名称模糊匹配
  • 📊 提供完整的技术指标和盘口数据

开源协议

ISC

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured