Spaces:
Sleeping
Sleeping
File size: 5,020 Bytes
a7f3511 7dde4c5 a7f3511 7dde4c5 a7f3511 7dde4c5 a7f3511 7dde4c5 a7f3511 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# 📘 使用指南
## 🚀 快速开始
### 1. 连接到 MCP Server
#### Claude Desktop 配置
**Windows**: 编辑 `%APPDATA%\Claude\claude_desktop_config.json`
**macOS**: 编辑 `~/Library/Application Support/Claude/claude_desktop_config.json`
添加配置:
```json
{
"mcpServers": {
"sec-financial-data": {
"url": "https://jc321-easyreportsmcpserver.hf.space/sse"
}
}
}
```
重启 Claude Desktop,查看右下角 🔌 图标。
---
## 🛠️ 可用工具 (7个)
### 1. `search_company`
按公司名称搜索 → 获取 CIK、ticker、官方名称
**示例**: "Search for Microsoft"
---
### 2. `get_company_info`
获取详细公司信息 → 行业、SIC 代码、财年等
**参数**: `cik` (公司 CIK 代码)
---
### 3. `get_company_filings`
列出所有 SEC 报告 → 10-K, 10-Q, 20-F 及日期、链接
**参数**:
- `cik`: 公司 CIK 代码
- `form_types` (可选): 如 `["10-K", "10-Q"]`
---
### 4. `get_financial_data`
获取特定期间财务数据 → Revenue, Net Income, EPS, Cash Flow
**参数**:
- `cik`: 公司 CIK 代码
- `period`: 格式 "YYYY" (年度) 或 "YYYYQX" (季度)
**示例**: "Show me Apple's financial data for 2024Q3"
---
### 5. `extract_financial_metrics` ⭐ 推荐
提取多年综合指标 → 年度 + 季度数据,按时间排序
**参数**:
- `cik`: 公司 CIK 代码
- `years`: 年数 (1-10, 默认 3)
**示例**: "Extract 5 years of financial metrics for Tesla"
---
### 6. `get_latest_financial_data`
获取最新可用财务数据
**参数**: `cik` (公司 CIK 代码)
---
### 7. `advanced_search_company`
智能搜索 → 自动识别公司名称、ticker 或 CIK
**参数**: `company_input` (任意格式的公司标识)
---
## 💬 使用示例
### 场景 1: 快速查询
**输入**: "Search for Tesla and show me their latest financial data"
**AI 工作流程**:
1. 🔍 `search_company("Tesla")` → 找到 CIK
2. 🆕 `get_latest_financial_data(cik)` → 获取最新数据
3. 📊 返回格式化结果
---
### 场景 2: 趋势分析
**输入**: "Extract 3 years of financial metrics for Apple and analyze revenue growth"
**AI 工作流程**:
1. 📈 `extract_financial_metrics(cik, years=3)`
2. 📊 返回 12+ 期数据(年度 + 季度)
3. 🤖 AI 分析并解释趋势
---
### 场景 3: 公司对比
**输入**: "Compare NVIDIA and AMD revenue for the past 2 years"
**AI 工作流程**:
1. 🔍 搜索两家公司
2. 📊 提取各自数据
3. 📈 AI 对比分析
---
## 🎨 格式化输出示例
### 成功查询
```
✅ Company Found:
{
"cik": "0000789019",
"name": "MICROSOFT CORP",
"ticker": "MSFT"
}
```
### 财务数据
```
💰 Financial Data for 2024Q3:
{
"period": "2024Q3",
"revenue": "$65.59B",
"net_income": "$24.67B",
"eps": "$3.30",
"operating_cash_flow": "$34.25B",
"free_cash_flow": "$19.28B"
}
```
### 多年数据
```
📈 Financial Metrics (12 periods):
[
{
"period": "2024Q3",
"type": "quarterly",
"revenue": "$65.59B",
...
},
...
]
```
---
## 🔧 本地开发和测试
### 启动服务器
```bash
python mcp_server_sse.py
```
访问: http://localhost:7860
### 运行测试
```bash
python test_mcp_sse.py
```
### 健康检查
```bash
curl http://localhost:7860/health
```
---
## 📦 部署到 Hugging Face Space
### 方法 1: Git 推送
```bash
git add .
git commit -m "Update MCP Server"
git push
```
### 方法 2: Web 界面
直接在 HF Space 上传文件。
### 验证部署
```bash
# 检查健康状态
curl https://jc321-easyreportsmcpserver.hf.space/health
# 查看工具列表
curl https://jc321-easyreportsmcpserver.hf.space/tools
```
---
## ⚠️ 常见问题
### Q: Claude Desktop 看不到工具?
**A**:
1. 检查 JSON 配置格式
2. 确认 URL 以 `/sse` 结尾
3. 完全退出并重启 Claude Desktop
### Q: 工具调用返回错误?
**A**:
1. 检查 CIK 格式(10位数字)
2. 验证期间格式("2024" 或 "2024Q3")
3. 稍等片刻再试(SEC API 限流)
### Q: Space 冷启动慢?
**A**:
首次访问需要 30-60 秒唤醒,访问主页即可唤醒。
---
## 📊 端点参考
| 端点 | 说明 |
|------|------|
| `/` | 主页(引导页面) |
| `/sse` | SSE 连接端点(MCP 客户端使用) |
| `/message` | MCP 消息处理 |
| `/tools` | 工具列表(JSON) |
| `/health` | 健康检查 |
---
## 🎯 数据来源
**SEC EDGAR API** - 美国证券交易委员会官方数据
**遵守规则**:
- User-Agent: Juntao Peng Financial Report Metrics App (jtyxabc@gmail.com)
- 速率限制: 最多 10 请求/秒
---
## 📞 支持
**访问主页**: https://jc321-easyreportsmcpserver.hf.space/
**查看文档**: 主页包含完整的配置说明和示例
---
**享受你的 MCP Server!** 🚀
|