JC321 commited on
Commit
7dde4c5
·
verified ·
1 Parent(s): 2e442ba

Upload 10 files

Browse files
Files changed (6) hide show
  1. CLEANUP_SUMMARY.md +1 -1
  2. DEPLOY_FIX.md +123 -0
  3. PROJECT_STRUCTURE.md +1 -1
  4. README.md +127 -127
  5. USAGE.md +4 -4
  6. mcp_server_sse.py +2 -2
CLEANUP_SUMMARY.md CHANGED
@@ -263,7 +263,7 @@ git push
263
 
264
  ### 验证部署
265
  ```bash
266
- curl https://jc321-easyreportdatemcp.hf.space/health
267
  ```
268
 
269
  ---
 
263
 
264
  ### 验证部署
265
  ```bash
266
+ curl https://jc321-easyreportsmcpserver.hf.space/health
267
  ```
268
 
269
  ---
DEPLOY_FIX.md ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🔧 部署问题修复
2
+
3
+ ## ✅ 已修复的问题
4
+
5
+ ### 1. YAML 元数据错误
6
+ **问题**: `Errors in your YAML metadata`
7
+ **原因**: `short_description` 包含括号等特殊字符
8
+ **修复**:
9
+ ```yaml
10
+ # 修复前
11
+ short_description: MCP Server for SEC EDGAR financial data (Remote access via SSE)
12
+
13
+ # 修复后
14
+ short_description: MCP Server for SEC EDGAR financial data with remote access
15
+ ```
16
+
17
+ ### 2. 构建依赖优化
18
+ **问题**: 包含不必要的 `fastmcp` 依赖
19
+ **原因**: 早期版本遗留,实际未使用
20
+ **修复**: 从 `requirements.txt` 移除 `fastmcp==0.3.0`
21
+
22
+ ---
23
+
24
+ ## 📦 优化后的依赖
25
+
26
+ ```txt
27
+ # FastAPI and Server
28
+ fastapi==0.109.0
29
+ uvicorn[standard]==0.27.0
30
+ pydantic==2.5.3
31
+
32
+ # SEC EDGAR API
33
+ sec-edgar-api==1.1.0
34
+ requests==2.31.0
35
+ ```
36
+
37
+ **优化结果**:
38
+ - ✅ 减少 1 个不必要的依赖
39
+ - ✅ 加快构建速度
40
+ - ✅ 减少潜在冲突
41
+
42
+ ---
43
+
44
+ ## 🚀 现在可以部署
45
+
46
+ ### 方法 1: Git 推送
47
+ ```bash
48
+ git add .
49
+ git commit -m "Fix YAML metadata and optimize dependencies"
50
+ git push
51
+ ```
52
+
53
+ ### 方法 2: HF Space Web 界面
54
+ 直接上传以下文件:
55
+ - ✅ `README.md` (已修复 YAML)
56
+ - ✅ `requirements.txt` (已优化)
57
+ - ✅ `Dockerfile`
58
+ - ✅ `mcp_server_sse.py`
59
+ - ✅ `edgar_client.py`
60
+ - ✅ `financial_analyzer.py`
61
+
62
+ ---
63
+
64
+ ## 🔍 验证部署
65
+
66
+ ### 1. 等待构建完成
67
+ 在 HF Space 查看 "Logs" 标签,等待出现:
68
+ ```
69
+ Running on http://0.0.0.0:7860
70
+ ```
71
+
72
+ ### 2. 访问主页
73
+ ```
74
+ https://jc321-easyreportsmcpserver.hf.space/
75
+ ```
76
+
77
+ ### 3. 健康检查
78
+ ```bash
79
+ curl https://jc321-easyreportsmcpserver.hf.space/health
80
+ ```
81
+
82
+ 预期响应:
83
+ ```json
84
+ {
85
+ "status": "healthy",
86
+ "server": "sec-financial-data",
87
+ "version": "2.0.0",
88
+ "protocol": "MCP",
89
+ "transport": "SSE",
90
+ "tools_count": 7
91
+ }
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 📋 部署文件清单
97
+
98
+ ### 必需文件(HF Space)
99
+ - [x] `README.md` - 主文档(含 YAML 元数据)
100
+ - [x] `Dockerfile` - Docker 配置
101
+ - [x] `requirements.txt` - Python 依赖
102
+ - [x] `mcp_server_sse.py` - MCP Server 主程序
103
+ - [x] `edgar_client.py` - EDGAR 客户端
104
+ - [x] `financial_analyzer.py` - 财务分析器
105
+
106
+ ### 可选文件
107
+ - [ ] `USAGE.md` - 使用指南
108
+ - [ ] `test_mcp_sse.py` - 测试脚本
109
+ - [ ] `.gitignore` - Git 忽略规则
110
+
111
+ ---
112
+
113
+ ## ⚡ 预期构建时间
114
+
115
+ - **依赖安装**: ~30-60 秒
116
+ - **镜像构建**: ~1-2 分钟
117
+ - **总时间**: ~2-3 分钟
118
+
119
+ ---
120
+
121
+ ## 🎉 修复完成
122
+
123
+ 所有已知问题已修复,项目现在可以成功部署到 HF Space!
PROJECT_STRUCTURE.md CHANGED
@@ -164,7 +164,7 @@ git push
164
 
165
  ### 3. 验证部署
166
  ```bash
167
- curl https://jc321-easyreportdatemcp.hf.space/health
168
  ```
169
 
170
  ---
 
164
 
165
  ### 3. 验证部署
166
  ```bash
167
+ curl https://jc321-easyreportsmcpserver.hf.space/health
168
  ```
169
 
170
  ---
README.md CHANGED
@@ -1,127 +1,127 @@
1
- ---
2
- title: SEC Financial Report MCP Server
3
- emoji: 📊
4
- colorFrom: blue
5
- colorTo: green
6
- sdk: docker
7
- pinned: true
8
- license: mit
9
- app_port: 7860
10
- short_description: MCP Server for SEC EDGAR financial data with remote access
11
- ---
12
-
13
- # 📊 SEC Financial Report MCP Server
14
-
15
- **Model Context Protocol Server** for SEC EDGAR financial data analysis.
16
-
17
- 🔌 **Remote Access** - Connect from Claude Desktop, Cline, or any MCP client
18
- ✨ **Natural Language** - Query financial data through conversation
19
- 📈 **Formatted Output** - Get beautiful, AI-ready responses
20
-
21
- ## 📊 Features
22
-
23
- - **Company Search**: Search companies by name, ticker, or CIK
24
- - **Company Info**: Industry, SIC code, fiscal year details
25
- - **SEC Filings**: 10-K, 10-Q, 20-F reports with dates and links
26
- - **Financial Data**: Revenue, Net Income, EPS, Cash Flow
27
- - **Multi-Year Analysis**: Comprehensive metrics extraction
28
- - **Smart Formatting**: Beautiful, AI-ready output with emoji
29
-
30
- ## 📈 Supported Data
31
-
32
- - **Report Types**: 10-K (Annual), 10-Q (Quarterly), 20-F (Foreign)
33
- - **Standards**: US-GAAP, IFRS
34
- - **Metrics**: Revenue, Net Income, EPS, Operating Expenses, Cash Flow
35
-
36
- ## 🚀 Quick Start
37
-
38
- ### 1. Add to Your MCP Client
39
-
40
- **Claude Desktop** (`%APPDATA%\Claude\claude_desktop_config.json`):
41
- ```json
42
- {
43
- "mcpServers": {
44
- "sec-financial-data": {
45
- "url": "https://jc321-easyreportdatemcp.hf.space/sse"
46
- }
47
- }
48
- }
49
- ```
50
-
51
- ### 2. Restart Claude Desktop
52
-
53
- ### 3. Start Using!
54
-
55
- "Search for Microsoft and show me their latest financial data" ✨
56
-
57
- ## 🛠️ Available Tools (7)
58
-
59
- | Tool | Description |
60
- |------|-------------|
61
- | `search_company` | Search by company name |
62
- | `get_company_info` | Get detailed company info |
63
- | `get_company_filings` | List SEC filings (10-K, 10-Q, 20-F) |
64
- | `get_financial_data` | Get data for specific period |
65
- | `extract_financial_metrics` ⭐ | Multi-year comprehensive metrics |
66
- | `get_latest_financial_data` | Most recent data available |
67
- | `advanced_search_company` | Smart search (name/ticker/CIK) |
68
-
69
- ## 💬 Usage Examples
70
-
71
- **Quick Lookup**:
72
- "Search for Tesla and show me their latest financial data"
73
-
74
- **Trend Analysis**:
75
- "Extract 5 years of financial metrics for Apple and analyze revenue growth"
76
-
77
- **Company Comparison**:
78
- "Compare NVIDIA and AMD revenue for the past 3 years"
79
-
80
- **Output Format**:
81
- ```
82
- 💰 Financial Data for 2024Q3:
83
- {
84
- "period": "2024Q3",
85
- "revenue": "$65.59B",
86
- "net_income": "$24.67B",
87
- "eps": "$3.30"
88
- }
89
- ```
90
-
91
- ## ⚙️ Technical Stack
92
-
93
- **Protocol**: Model Context Protocol 2024-11-05
94
- **Transport**: Server-Sent Events (SSE)
95
- **Framework**: FastAPI with Uvicorn
96
- **Platform**: Hugging Face Spaces
97
- **Data Source**: SEC EDGAR API
98
-
99
- ## 📜 Compliance
100
-
101
- **SEC User-Agent** (Required by SEC EDGAR API):
102
- Juntao Peng Financial Report Metrics App (jtyxabc@gmail.com)
103
-
104
- **Rate Limiting**: Follows SEC guidelines (10 requests/second max)
105
-
106
- ## 🏗️ Infrastructure
107
-
108
- - **Platform**: Hugging Face Spaces (CPU Upgrade, Always-On)
109
- - **Uptime**: 99.9% availability
110
- - **Response**: <200ms cached, 1-3s fresh data
111
- - **Concurrency**: Up to 200 concurrent requests
112
- - **Health Check**: Every 30 seconds
113
-
114
- ## 📚 Documentation
115
-
116
- - **[Usage Guide](./USAGE.md)** - Complete usage instructions
117
- - **[Test Script](./test_mcp_sse.py)** - Test all endpoints
118
-
119
- ## 🔧 Local Development
120
-
121
- ```bash
122
- # Start server
123
- python mcp_server_sse.py
124
-
125
- # Run tests
126
- python test_mcp_sse.py
127
- ```
 
1
+ ---
2
+ title: SEC Financial Report MCP Server
3
+ emoji: 📊
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: docker
7
+ pinned: true
8
+ license: mit
9
+ app_port: 7860
10
+ short_description: MCP Server for SEC EDGAR financial data with remote access
11
+ ---
12
+
13
+ # 📊 SEC Financial Report MCP Server
14
+
15
+ **Model Context Protocol Server** for SEC EDGAR financial data analysis.
16
+
17
+ 🔌 **Remote Access** - Connect from Claude Desktop, Cline, or any MCP client
18
+ ✨ **Natural Language** - Query financial data through conversation
19
+ 📈 **Formatted Output** - Get beautiful, AI-ready responses
20
+
21
+ ## 📊 Features
22
+
23
+ - **Company Search**: Search companies by name, ticker, or CIK
24
+ - **Company Info**: Industry, SIC code, fiscal year details
25
+ - **SEC Filings**: 10-K, 10-Q, 20-F reports with dates and links
26
+ - **Financial Data**: Revenue, Net Income, EPS, Cash Flow
27
+ - **Multi-Year Analysis**: Comprehensive metrics extraction
28
+ - **Smart Formatting**: Beautiful, AI-ready output with emoji
29
+
30
+ ## 📈 Supported Data
31
+
32
+ - **Report Types**: 10-K (Annual), 10-Q (Quarterly), 20-F (Foreign)
33
+ - **Standards**: US-GAAP, IFRS
34
+ - **Metrics**: Revenue, Net Income, EPS, Operating Expenses, Cash Flow
35
+
36
+ ## 🚀 Quick Start
37
+
38
+ ### 1. Add to Your MCP Client
39
+
40
+ **Claude Desktop** (`%APPDATA%\Claude\claude_desktop_config.json`):
41
+ ```json
42
+ {
43
+ "mcpServers": {
44
+ "sec-financial-data": {
45
+ "url": "https://jc321-easyreportsmcpserver.hf.space/sse"
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ ### 2. Restart Claude Desktop
52
+
53
+ ### 3. Start Using!
54
+
55
+ "Search for Microsoft and show me their latest financial data" ✨
56
+
57
+ ## 🛠️ Available Tools (7)
58
+
59
+ | Tool | Description |
60
+ |------|-------------|
61
+ | `search_company` | Search by company name |
62
+ | `get_company_info` | Get detailed company info |
63
+ | `get_company_filings` | List SEC filings (10-K, 10-Q, 20-F) |
64
+ | `get_financial_data` | Get data for specific period |
65
+ | `extract_financial_metrics` ⭐ | Multi-year comprehensive metrics |
66
+ | `get_latest_financial_data` | Most recent data available |
67
+ | `advanced_search_company` | Smart search (name/ticker/CIK) |
68
+
69
+ ## 💬 Usage Examples
70
+
71
+ **Quick Lookup**:
72
+ "Search for Tesla and show me their latest financial data"
73
+
74
+ **Trend Analysis**:
75
+ "Extract 5 years of financial metrics for Apple and analyze revenue growth"
76
+
77
+ **Company Comparison**:
78
+ "Compare NVIDIA and AMD revenue for the past 3 years"
79
+
80
+ **Output Format**:
81
+ ```
82
+ 💰 Financial Data for 2024Q3:
83
+ {
84
+ "period": "2024Q3",
85
+ "revenue": "$65.59B",
86
+ "net_income": "$24.67B",
87
+ "eps": "$3.30"
88
+ }
89
+ ```
90
+
91
+ ## ⚙️ Technical Stack
92
+
93
+ **Protocol**: Model Context Protocol 2024-11-05
94
+ **Transport**: Server-Sent Events (SSE)
95
+ **Framework**: FastAPI with Uvicorn
96
+ **Platform**: Hugging Face Spaces
97
+ **Data Source**: SEC EDGAR API
98
+
99
+ ## 📜 Compliance
100
+
101
+ **SEC User-Agent** (Required by SEC EDGAR API):
102
+ Juntao Peng Financial Report Metrics App (jtyxabc@gmail.com)
103
+
104
+ **Rate Limiting**: Follows SEC guidelines (10 requests/second max)
105
+
106
+ ## 🏗️ Infrastructure
107
+
108
+ - **Platform**: Hugging Face Spaces (CPU Upgrade, Always-On)
109
+ - **Uptime**: 99.9% availability
110
+ - **Response**: <200ms cached, 1-3s fresh data
111
+ - **Concurrency**: Up to 200 concurrent requests
112
+ - **Health Check**: Every 30 seconds
113
+
114
+ ## 📚 Documentation
115
+
116
+ - **[Usage Guide](./USAGE.md)** - Complete usage instructions
117
+ - **[Test Script](./test_mcp_sse.py)** - Test all endpoints
118
+
119
+ ## 🔧 Local Development
120
+
121
+ ```bash
122
+ # Start server
123
+ python mcp_server_sse.py
124
+
125
+ # Run tests
126
+ python test_mcp_sse.py
127
+ ```
USAGE.md CHANGED
@@ -14,7 +14,7 @@
14
  {
15
  "mcpServers": {
16
  "sec-financial-data": {
17
- "url": "https://jc321-easyreportdatemcp.hf.space/sse"
18
  }
19
  }
20
  }
@@ -194,10 +194,10 @@ git push
194
  ### 验证部署
195
  ```bash
196
  # 检查健康状态
197
- curl https://jc321-easyreportdatemcp.hf.space/health
198
 
199
  # 查看工具列表
200
- curl https://jc321-easyreportdatemcp.hf.space/tools
201
  ```
202
 
203
  ---
@@ -246,7 +246,7 @@ curl https://jc321-easyreportdatemcp.hf.space/tools
246
 
247
  ## 📞 支持
248
 
249
- **访问主页**: https://jc321-easyreportdatemcp.hf.space/
250
  **查看文档**: 主页包含完整的配置说明和示例
251
 
252
  ---
 
14
  {
15
  "mcpServers": {
16
  "sec-financial-data": {
17
+ "url": "https://jc321-easyreportsmcpserver.hf.space/sse"
18
  }
19
  }
20
  }
 
194
  ### 验证部署
195
  ```bash
196
  # 检查健康状态
197
+ curl https://jc321-easyreportsmcpserver.hf.space/health
198
 
199
  # 查看工具列表
200
+ curl https://jc321-easyreportsmcpserver.hf.space/tools
201
  ```
202
 
203
  ---
 
246
 
247
  ## 📞 支持
248
 
249
+ **访问主页**: https://jc321-easyreportsmcpserver.hf.space/
250
  **查看文档**: 主页包含完整的配置说明和示例
251
 
252
  ---
mcp_server_sse.py CHANGED
@@ -492,13 +492,13 @@ async def root():
492
  {
493
  "mcpServers": {
494
  "sec-financial-data": {
495
- "url": "https://YOUR-SPACE-URL.hf.space/sse"
496
  }
497
  }
498
  }
499
  </div>
500
 
501
- <p><strong>Replace <code>YOUR-SPACE-URL</code> with your actual Hugging Face Space URL.</strong></p>
502
 
503
  <h2>🛠️ Available Tools (7)</h2>
504
  <div class="tools">
 
492
  {
493
  "mcpServers": {
494
  "sec-financial-data": {
495
+ "url": "https://jc321-easyreportsmcpserver.hf.space/sse"
496
  }
497
  }
498
  }
499
  </div>
500
 
501
+ <p><strong>Use the URL above to connect to this MCP Server.</strong></p>
502
 
503
  <h2>🛠️ Available Tools (7)</h2>
504
  <div class="tools">