Skip to main content
Glama
jwangkun

Stock Analysis MCP Server

by jwangkun

股票分析MCP工具

基于fastmcp和AKShare API构建的股票分析MCP服务器,支持CherryStudio的SSE标准协议。

功能特性

🚀 核心功能

  • 实时行情: 获取股票实时价格、涨跌幅、成交量等数据

  • 历史数据: 支持日线、周线、月线历史数据查询

  • 技术指标: 计算MA、MACD、RSI等常用技术指标

  • 市场情绪: 分析市场整体情绪和资金流向

  • 股票搜索: 根据股票名称或代码搜索股票信息

  • 新闻资讯: 获取股票相关新闻和市场资讯

🔧 技术特性

  • 基于fastmcp框架,支持MCP协议

  • 集成AKShare API,数据来源可靠

  • 内置缓存机制,提高响应速度

  • 支持CherryStudio的SSE标准协议

  • 异步处理,高性能并发

Related MCP server: Stock-MCP

安装配置

1. 安装依赖

pip install -r requirements.txt

2. 启动服务器

python stock_mcp_server.py

3. 配置CherryStudio

在CherryStudio中添加MCP服务器配置:

{
  "name": "股票分析工具",
  "command": "python",
  "args": ["stock_mcp_server.py"],
  "cwd": "/path/to/your/project"
}

工具使用说明

1. 获取实时行情

get_stock_realtime_data(symbol="000001")
  • symbol: 股票代码,如 "000001"(平安银行)

2. 获取历史数据

get_stock_history_data(
    symbol="000001", 
    period="daily", 
    start_date="20240101", 
    end_date="20241231"
)
  • symbol: 股票代码

  • period: 数据周期 ("daily", "weekly", "monthly")

  • start_date: 开始日期 (YYYYMMDD格式)

  • end_date: 结束日期 (YYYYMMDD格式)

3. 计算技术指标

calculate_technical_indicators(
    symbol="000001", 
    indicators=["ma", "macd", "rsi"]
)
  • symbol: 股票代码

  • indicators: 指标列表,支持 ["ma", "macd", "rsi", "boll", "kdj"]

4. 获取市场情绪

get_market_sentiment(symbol="000001")  # 个股情绪
get_market_sentiment()  # 整体市场情绪

5. 搜索股票

search_stock_info(keyword="平安银行")
  • keyword: 搜索关键词(股票名称或代码)

6. 获取新闻资讯

get_stock_news(symbol="000001", limit=10)  # 个股新闻
get_stock_news(limit=20)  # 市场新闻

数据说明

实时行情数据字段

  • 股票代码、股票名称

  • 最新价、涨跌幅、涨跌额

  • 成交量、成交额、振幅

  • 最高价、最低价、开盘价、昨收价

技术指标说明

  • MA: 移动平均线 (5日、10日、20日、60日)

  • MACD: 指数平滑移动平均线

  • RSI: 相对强弱指标 (14日)

市场情绪指标

  • 上涨/下跌股票数量和比例

  • 主力资金净流入情况

  • 北向资金流向数据

注意事项

  1. 数据来源: 数据来自AKShare API,请遵守相关使用条款

  2. 缓存机制: 内置5分钟缓存,避免频繁请求

  3. 错误处理: 包含完善的错误处理和日志记录

  4. 性能优化: 限制返回数据量,避免内存溢出

开发扩展

添加新的技术指标

calculate_technical_indicators 函数中添加新的指标计算逻辑:

# 计算布林带
if 'boll' in indicators:
    df['BOLL_MID'] = df['收盘'].rolling(window=20).mean()
    df['BOLL_STD'] = df['收盘'].rolling(window=20).std()
    df['BOLL_UPPER'] = df['BOLL_MID'] + 2 * df['BOLL_STD']
    df['BOLL_LOWER'] = df['BOLL_MID'] - 2 * df['BOLL_STD']

自定义缓存策略

修改 StockAnalyzer 类中的缓存参数:

self.cache_timeout = 300  # 缓存时间(秒)

许可证

MIT License

贡献

欢迎提交Issue和Pull Request来改进这个项目!

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    Enables querying financial data including stocks, indices, funds, and futures from Chinese, Hong Kong, and US markets. Provides real-time market information, financial indicators, news, and trading suggestions through Eastmoney and Sina data sources.
    Last updated
    20
    3
    ISC
  • A
    license
    -
    quality
    D
    maintenance
    Provides real-time A-share (Chinese stock market) data through AKShare integration, enabling access to market overviews, company information, real-time quotes, and historical price data for Shanghai and Shenzhen stock exchanges.
    Last updated
    1
    Apache 2.0
  • A
    license
    A
    quality
    D
    maintenance
    Enables querying and analysis of stock and cryptocurrency data, including market overviews, price history, news, and financial indicators, via akshare.
    Last updated
    18
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    Enables AI assistants to access comprehensive Chinese financial market data including stocks, funds, futures, and economic indicators via AKShare.
    Last updated
    5
    4
    MIT

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jwangkun/stock_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server