agu-mcp
# agu-mcp — A股行情分析 MCP Server
> 让 Claude 直接查询和分析 A 股数据!实时行情、K线、技术指标、基本面、AI选股,一站式搞定。
## ✨ 功能
| 工具 | 说明 |
|------|------|
| `get_realtime_quote` | 实时行情(价格、涨跌幅、PE/PB、市值、52周高低) |
| `get_batch_quotes` | 批量行情查询 |
| `get_kline` | K线数据(日/周/月,支持前复权) |
| `get_technical_indicators` | 技术指标(MACD/RSI/KDJ/布林带/均线系统) |
| `search_stocks` | 股票搜索(代码/名称/拼音) |
| `get_sector_performance` | 行业/概念板块涨跌排行 |
| `get_money_flow` | 资金流向(主力/散户/大单/中单/小单) |
| `get_fundamentals` | 基本面数据(ROE/毛利率/负债率/营收/利润) |
| `get_stock_news` | 新闻公告 |
| `ai_stock_screening` | 智能选股(PE、PB、技术指标、均线排列等条件) |
## 🚀 快速开始
### 安装
```bash
# 克隆项目
cd agu-mcp
npm install
npm run build
```
### 配置 Claude Code
项目自带了 `.mcp.json`,重启 Claude Code 即可自动加载。
或者在 `~/.claude/mcp.json` 中添加全局配置:
```json
{
"mcpServers": {
"agu": {
"command": "node",
"args": ["path/to/agu-mcp/dist/index.js"]
}
}
}
```
### 使用示例
```
"查一下贵州茅台的实时行情"
"分析600519的MACD和RSI指标"
"今天哪些行业板块涨得好?"
"筛选PE在10-20之间、MACD金叉的股票"
"查看宁德时代近5日的资金流向"
```
## 🏗 技术架构
```
agu-mcp/
├── src/
│ ├── index.ts # 入口 + 服务注册
│ ├── config.ts # 配置(缓存TTL、数据源)
│ ├── tools/ # 10个MCP工具实现
│ │ ├── quote.ts # 实时行情
│ │ ├── kline.ts # K线数据
│ │ ├── indicators.ts # 技术指标
│ │ ├── search.ts # 股票搜索
│ │ ├── sector.ts # 板块行情
│ │ ├── moneyflow.ts # 资金流向
│ │ ├── fundamentals.ts # 基本面
│ │ ├── news.ts # 新闻公告
│ │ ├── screening.ts # AI选股
│ │ └── formatters.ts # 输出格式化
│ ├── data/
│ │ ├── eastmoney.ts # 东方财富HTTP适配器
│ │ └── cache.ts # 内存+SQLite缓存
│ ├── analysis/
│ │ ├── indicators.ts # 技术指标计算引擎
│ │ └── screening.ts # 选股筛选引擎
│ └── utils/
│ ├── stockCode.ts # 股票代码解析
│ └── logger.ts # 日志工具
└── dist/ # 编译输出
```
## 📊 数据来源
- **东方财富 HTTP API**(免费,无需注册,无需API Key)
- **腾讯行情接口**(备用)
- 所有数据均为公开行情数据
## 💡 注意事项
- 数据源为东方财富公开接口,仅供个人学习研究使用
- 高频请求可能被限流,缓存策略已内置(实时行情5秒,K线1分钟等)
- 非交易时段返回的是最近一个交易日的数据
- **本工具不构成任何投资建议**
## 📜 License
MIT
TDQS
Scored across 10 tools
Each tool targets a distinct aspect of A-share market data: quotes, klines, indicators, search, sector, money flow, fundamentals, news, and screening. The only minor overlap between single and batch quotes is clearly differentiated by description. No ambiguity in tool selection.
Most tools follow a consistent 'get_noun' pattern (get_realtime_quote, get_kline, etc.), but 'search_stocks' and 'ai_stock_screening' deviate from the verb-noun convention. This is a minor inconsistency that does not hinder readability or predictability.
With 10 tools, the server is well-scoped for a comprehensive A-share data and analysis platform. Each tool covers a distinct data type or analysis function, and the count is within the ideal range for usability.
The tool set covers the full spectrum of stock market data needs: real-time quotes, historical klines, technical analysis, fundamental data, news, sector performance, money flow, and advanced screening. No obvious gaps for a data-focused A-share server.