Spaces:
Runtime error
Runtime error
Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,132 +1,137 @@
|
|
| 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 querying SEC EDGAR financial data
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
# SEC Financial Report MCP Server
|
| 14 |
-
|
| 15 |
-
A FastAPI-based MCP (Model Context Protocol) Server for querying SEC EDGAR financial data.
|
| 16 |
-
|
| 17 |
-
## Features
|
| 18 |
-
|
| 19 |
-
- **Company Search**: Search companies by name and get CIK information
|
| 20 |
-
- **Company Information**: Retrieve detailed company information from SEC EDGAR
|
| 21 |
-
- **Filings Retrieval**: Get all historical filings (10-K, 10-Q, 20-F)
|
| 22 |
-
- **Financial Facts**: Access complete financial facts data
|
| 23 |
-
- **Financial Metrics**: Extract key financial metrics for specific periods (annual/quarterly)
|
| 24 |
-
- Total Revenue
|
| 25 |
-
- Net Income
|
| 26 |
-
- Earnings Per Share (EPS)
|
| 27 |
-
- Operating Expenses
|
| 28 |
-
- Operating Cash Flow
|
| 29 |
-
|
| 30 |
-
## Supported Report Types
|
| 31 |
-
|
| 32 |
-
- **10-K**: Annual reports (US companies)
|
| 33 |
-
- **10-Q**: Quarterly reports (US companies)
|
| 34 |
-
- **20-F**: Annual reports (Foreign private issuers)
|
| 35 |
-
|
| 36 |
-
## Data Standards
|
| 37 |
-
|
| 38 |
-
- US-GAAP (US Generally Accepted Accounting Principles)
|
| 39 |
-
- IFRS (International Financial Reporting Standards)
|
| 40 |
-
|
| 41 |
-
## API Documentation
|
| 42 |
-
|
| 43 |
-
Once deployed, visit `/docs` for interactive Swagger UI documentation or `/redoc` for ReDoc documentation.
|
| 44 |
-
|
| 45 |
-
## API Endpoints
|
| 46 |
-
|
| 47 |
-
### Basic Endpoints
|
| 48 |
-
- `POST /api/search_company` - Search company by name
|
| 49 |
-
- `POST /api/get_company_info` - Get company information
|
| 50 |
-
- `POST /api/get_company_filings` - Get company filings
|
| 51 |
-
- `POST /api/get_company_facts` - Get company financial facts
|
| 52 |
-
- `POST /api/get_financial_data` - Get financial data for period
|
| 53 |
-
- `GET /health` - Health check
|
| 54 |
-
|
| 55 |
-
### Advanced Endpoints (FinancialAnalyzer)
|
| 56 |
-
- `POST /api/advanced_search` - Advanced search (supports name or CIK)
|
| 57 |
-
- `POST /api/extract_financial_metrics` - Extract multi-year metrics
|
| 58 |
-
- `POST /api/get_latest_financial_data` - Get latest annual data
|
| 59 |
-
|
| 60 |
-
## Usage Example
|
| 61 |
-
|
| 62 |
-
```python
|
| 63 |
-
import requests
|
| 64 |
-
|
| 65 |
-
BASE_URL = "https://YOUR_SPACE_URL.hf.space"
|
| 66 |
-
|
| 67 |
-
#
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
response
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 querying SEC EDGAR financial data
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# SEC Financial Report MCP Server
|
| 14 |
+
|
| 15 |
+
A FastAPI-based MCP (Model Context Protocol) Server for querying SEC EDGAR financial data.
|
| 16 |
+
|
| 17 |
+
## Features
|
| 18 |
+
|
| 19 |
+
- **Company Search**: Search companies by name and get CIK information
|
| 20 |
+
- **Company Information**: Retrieve detailed company information from SEC EDGAR
|
| 21 |
+
- **Filings Retrieval**: Get all historical filings (10-K, 10-Q, 20-F)
|
| 22 |
+
- **Financial Facts**: Access complete financial facts data
|
| 23 |
+
- **Financial Metrics**: Extract key financial metrics for specific periods (annual/quarterly)
|
| 24 |
+
- Total Revenue
|
| 25 |
+
- Net Income
|
| 26 |
+
- Earnings Per Share (EPS)
|
| 27 |
+
- Operating Expenses
|
| 28 |
+
- Operating Cash Flow
|
| 29 |
+
|
| 30 |
+
## Supported Report Types
|
| 31 |
+
|
| 32 |
+
- **10-K**: Annual reports (US companies)
|
| 33 |
+
- **10-Q**: Quarterly reports (US companies)
|
| 34 |
+
- **20-F**: Annual reports (Foreign private issuers)
|
| 35 |
+
|
| 36 |
+
## Data Standards
|
| 37 |
+
|
| 38 |
+
- US-GAAP (US Generally Accepted Accounting Principles)
|
| 39 |
+
- IFRS (International Financial Reporting Standards)
|
| 40 |
+
|
| 41 |
+
## API Documentation
|
| 42 |
+
|
| 43 |
+
Once deployed, visit `/docs` for interactive Swagger UI documentation or `/redoc` for ReDoc documentation.
|
| 44 |
+
|
| 45 |
+
## API Endpoints
|
| 46 |
+
|
| 47 |
+
### Basic Endpoints
|
| 48 |
+
- `POST /api/search_company` - Search company by name
|
| 49 |
+
- `POST /api/get_company_info` - Get company information
|
| 50 |
+
- `POST /api/get_company_filings` - Get company filings
|
| 51 |
+
- `POST /api/get_company_facts` - Get company financial facts
|
| 52 |
+
- `POST /api/get_financial_data` - Get financial data for period
|
| 53 |
+
- `GET /health` - Health check
|
| 54 |
+
|
| 55 |
+
### Advanced Endpoints (FinancialAnalyzer)
|
| 56 |
+
- `POST /api/advanced_search` - Advanced search (supports name or CIK)
|
| 57 |
+
- `POST /api/extract_financial_metrics` - Extract multi-year metrics
|
| 58 |
+
- `POST /api/get_latest_financial_data` - Get latest annual data
|
| 59 |
+
|
| 60 |
+
## Usage Example
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
import requests
|
| 64 |
+
|
| 65 |
+
BASE_URL = "https://YOUR_SPACE_URL.hf.space"
|
| 66 |
+
|
| 67 |
+
# IMPORTANT: Use adequate timeout (at least 120 seconds)
|
| 68 |
+
# First request after service restart may take 30-60 seconds
|
| 69 |
+
|
| 70 |
+
# Search company
|
| 71 |
+
response = requests.post(
|
| 72 |
+
f"{BASE_URL}/api/search_company",
|
| 73 |
+
json={"company_name": "NVIDIA"},
|
| 74 |
+
timeout=120 # Important!
|
| 75 |
+
)
|
| 76 |
+
print(response.json())
|
| 77 |
+
# Output: {'cik': '0001045810', 'name': 'NVIDIA CORP', 'ticker': 'NVDA'}
|
| 78 |
+
|
| 79 |
+
# Get financial data
|
| 80 |
+
response = requests.post(
|
| 81 |
+
f"{BASE_URL}/api/get_financial_data",
|
| 82 |
+
json={"cik": "0001045810", "period": "2024"},
|
| 83 |
+
timeout=120 # Important!
|
| 84 |
+
)
|
| 85 |
+
data = response.json()
|
| 86 |
+
print(f"Revenue: ${data['total_revenue']:,.0f}")
|
| 87 |
+
print(f"Net Income: ${data['net_income']:,.0f}")
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Data Source
|
| 91 |
+
|
| 92 |
+
All data is retrieved from the US Securities and Exchange Commission (SEC) EDGAR system.
|
| 93 |
+
|
| 94 |
+
## User Agent
|
| 95 |
+
|
| 96 |
+
This service uses the following User-Agent (required by SEC API):
|
| 97 |
+
- Juntao Peng Financial Report Metrics App (jtyxabc@gmail.com)
|
| 98 |
+
|
| 99 |
+
## Service Infrastructure
|
| 100 |
+
|
| 101 |
+
### Production Configuration
|
| 102 |
+
|
| 103 |
+
- **Platform**: Hugging Face Spaces with CPU Upgrade
|
| 104 |
+
- **Always-On**: Enabled (Don't Sleep mode)
|
| 105 |
+
- **Process**: Single Uvicorn worker (optimized for HF Spaces)
|
| 106 |
+
- **Health Check**: Automatic monitoring every 30 seconds
|
| 107 |
+
- **Timeout**: 75s keep-alive for stable connections
|
| 108 |
+
- **Concurrency**: Up to 200 concurrent requests
|
| 109 |
+
|
| 110 |
+
### Performance Characteristics
|
| 111 |
+
|
| 112 |
+
- **Uptime**: 99.9% (always-on mode)
|
| 113 |
+
- **Response Time**: <200ms for cached queries, 1-3s for fresh SEC data
|
| 114 |
+
- **Rate Limit**: Follows SEC guidelines (10 requests/second max)
|
| 115 |
+
- **Data Freshness**: Real-time from SEC EDGAR
|
| 116 |
+
|
| 117 |
+
### Monitoring
|
| 118 |
+
|
| 119 |
+
**Health Check Endpoint:**
|
| 120 |
+
```bash
|
| 121 |
+
curl https://jc321-easyreportdatemcp.hf.space/health
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
Expected response:
|
| 125 |
+
```json
|
| 126 |
+
{
|
| 127 |
+
"status": "healthy",
|
| 128 |
+
"service": "SEC Financial Report MCP Server"
|
| 129 |
+
}
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
**Service Information:**
|
| 133 |
+
```bash
|
| 134 |
+
curl https://jc321-easyreportdatemcp.hf.space/
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
Returns complete API metadata including all endpoints, usage examples, and workflows.
|