Spaces:
Sleeping
Sleeping
Upload mcp_server_sse.py
Browse files- mcp_server_sse.py +94 -3
mcp_server_sse.py
CHANGED
|
@@ -24,7 +24,7 @@ from contextlib import contextmanager
|
|
| 24 |
app = FastAPI(
|
| 25 |
title="SEC Financial Report MCP Server",
|
| 26 |
description="Model Context Protocol Server for SEC EDGAR Financial Data",
|
| 27 |
-
version="2.2.
|
| 28 |
)
|
| 29 |
|
| 30 |
# Server startup time for monitoring
|
|
@@ -403,7 +403,7 @@ async def handle_mcp_message(request: MCPRequest):
|
|
| 403 |
},
|
| 404 |
"serverInfo": {
|
| 405 |
"name": "sec-financial-data",
|
| 406 |
-
"version": "2.2.
|
| 407 |
}
|
| 408 |
}
|
| 409 |
).dict()
|
|
@@ -623,6 +623,41 @@ async def root():
|
|
| 623 |
color: #999;
|
| 624 |
margin-top: 3px;
|
| 625 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 626 |
.test-btn {
|
| 627 |
background: linear-gradient(135deg, #667eea, #764ba2);
|
| 628 |
color: white;
|
|
@@ -729,6 +764,14 @@ async def root():
|
|
| 729 |
</div>
|
| 730 |
</div>
|
| 731 |
<div class="tool-body" id="tool1">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 732 |
<div class="param-group">
|
| 733 |
<label>Company Name *</label>
|
| 734 |
<input type="text" id="tool1-company_name" placeholder="e.g., Microsoft, Apple, Tesla">
|
|
@@ -751,6 +794,14 @@ async def root():
|
|
| 751 |
</div>
|
| 752 |
</div>
|
| 753 |
<div class="tool-body" id="tool2">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 754 |
<div class="param-group">
|
| 755 |
<label>Company Name / Ticker / CIK *</label>
|
| 756 |
<input type="text" id="tool2-company_input" placeholder="e.g., MSFT, 0000789019, Microsoft">
|
|
@@ -773,6 +824,14 @@ async def root():
|
|
| 773 |
</div>
|
| 774 |
</div>
|
| 775 |
<div class="tool-body" id="tool3">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 776 |
<div class="param-group">
|
| 777 |
<label>CIK Code *</label>
|
| 778 |
<input type="text" id="tool3-cik" placeholder="e.g., 0000789019">
|
|
@@ -795,6 +854,14 @@ async def root():
|
|
| 795 |
</div>
|
| 796 |
</div>
|
| 797 |
<div class="tool-body" id="tool4">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 798 |
<div class="param-group">
|
| 799 |
<label>CIK Code *</label>
|
| 800 |
<input type="text" id="tool4-cik" placeholder="e.g., 0000789019">
|
|
@@ -826,6 +893,14 @@ async def root():
|
|
| 826 |
</div>
|
| 827 |
</div>
|
| 828 |
<div class="tool-body" id="tool5">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 829 |
<div class="param-group">
|
| 830 |
<label>CIK Code *</label>
|
| 831 |
<input type="text" id="tool5-cik" placeholder="e.g., 0000789019">
|
|
@@ -847,6 +922,14 @@ async def root():
|
|
| 847 |
</div>
|
| 848 |
</div>
|
| 849 |
<div class="tool-body" id="tool6">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 850 |
<div class="param-group">
|
| 851 |
<label>CIK Code *</label>
|
| 852 |
<input type="text" id="tool6-cik" placeholder="e.g., 0000789019">
|
|
@@ -873,6 +956,14 @@ async def root():
|
|
| 873 |
</div>
|
| 874 |
</div>
|
| 875 |
<div class="tool-body" id="tool7">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 876 |
<div class="param-group">
|
| 877 |
<label>CIK Code *</label>
|
| 878 |
<input type="text" id="tool7-cik" placeholder="e.g., 0000789019">
|
|
@@ -1052,7 +1143,7 @@ async def health_check():
|
|
| 1052 |
return {
|
| 1053 |
"status": "healthy",
|
| 1054 |
"server": "sec-financial-data",
|
| 1055 |
-
"version": "2.2.
|
| 1056 |
"protocol": "MCP",
|
| 1057 |
"transport": "SSE",
|
| 1058 |
"tools_count": len(MCP_TOOLS),
|
|
|
|
| 24 |
app = FastAPI(
|
| 25 |
title="SEC Financial Report MCP Server",
|
| 26 |
description="Model Context Protocol Server for SEC EDGAR Financial Data",
|
| 27 |
+
version="2.2.2"
|
| 28 |
)
|
| 29 |
|
| 30 |
# Server startup time for monitoring
|
|
|
|
| 403 |
},
|
| 404 |
"serverInfo": {
|
| 405 |
"name": "sec-financial-data",
|
| 406 |
+
"version": "2.2.2"
|
| 407 |
}
|
| 408 |
}
|
| 409 |
).dict()
|
|
|
|
| 623 |
color: #999;
|
| 624 |
margin-top: 3px;
|
| 625 |
}
|
| 626 |
+
.example-box {
|
| 627 |
+
background: #f8f9fa;
|
| 628 |
+
border: 1px solid #dee2e6;
|
| 629 |
+
border-radius: 4px;
|
| 630 |
+
padding: 10px;
|
| 631 |
+
margin: 10px 0;
|
| 632 |
+
font-size: 12px;
|
| 633 |
+
}
|
| 634 |
+
.example-box .example-title {
|
| 635 |
+
font-weight: 600;
|
| 636 |
+
color: #495057;
|
| 637 |
+
margin-bottom: 5px;
|
| 638 |
+
display: flex;
|
| 639 |
+
align-items: center;
|
| 640 |
+
gap: 5px;
|
| 641 |
+
}
|
| 642 |
+
.example-box .example-title::before {
|
| 643 |
+
content: "💡";
|
| 644 |
+
font-size: 14px;
|
| 645 |
+
}
|
| 646 |
+
.example-box .example-content {
|
| 647 |
+
font-family: 'Monaco', 'Courier New', monospace;
|
| 648 |
+
color: #6c757d;
|
| 649 |
+
background: white;
|
| 650 |
+
padding: 8px;
|
| 651 |
+
border-radius: 3px;
|
| 652 |
+
border-left: 3px solid #667eea;
|
| 653 |
+
}
|
| 654 |
+
.example-item {
|
| 655 |
+
margin: 3px 0;
|
| 656 |
+
}
|
| 657 |
+
.example-label {
|
| 658 |
+
color: #667eea;
|
| 659 |
+
font-weight: 500;
|
| 660 |
+
}
|
| 661 |
.test-btn {
|
| 662 |
background: linear-gradient(135deg, #667eea, #764ba2);
|
| 663 |
color: white;
|
|
|
|
| 764 |
</div>
|
| 765 |
</div>
|
| 766 |
<div class="tool-body" id="tool1">
|
| 767 |
+
<div class="example-box">
|
| 768 |
+
<div class="example-title">Parameter Format Example</div>
|
| 769 |
+
<div class="example-content">
|
| 770 |
+
<div class="example-item"><span class="example-label">Input:</span> "Microsoft"</div>
|
| 771 |
+
<div class="example-item"><span class="example-label">Input:</span> "Apple Inc"</div>
|
| 772 |
+
<div class="example-item"><span class="example-label">Input:</span> "Tesla"</div>
|
| 773 |
+
</div>
|
| 774 |
+
</div>
|
| 775 |
<div class="param-group">
|
| 776 |
<label>Company Name *</label>
|
| 777 |
<input type="text" id="tool1-company_name" placeholder="e.g., Microsoft, Apple, Tesla">
|
|
|
|
| 794 |
</div>
|
| 795 |
</div>
|
| 796 |
<div class="tool-body" id="tool2">
|
| 797 |
+
<div class="example-box">
|
| 798 |
+
<div class="example-title">Parameter Format Example</div>
|
| 799 |
+
<div class="example-content">
|
| 800 |
+
<div class="example-item"><span class="example-label">By Ticker:</span> "MSFT"</div>
|
| 801 |
+
<div class="example-item"><span class="example-label">By CIK:</span> "0000789019"</div>
|
| 802 |
+
<div class="example-item"><span class="example-label">By Name:</span> "Microsoft Corporation"</div>
|
| 803 |
+
</div>
|
| 804 |
+
</div>
|
| 805 |
<div class="param-group">
|
| 806 |
<label>Company Name / Ticker / CIK *</label>
|
| 807 |
<input type="text" id="tool2-company_input" placeholder="e.g., MSFT, 0000789019, Microsoft">
|
|
|
|
| 824 |
</div>
|
| 825 |
</div>
|
| 826 |
<div class="tool-body" id="tool3">
|
| 827 |
+
<div class="example-box">
|
| 828 |
+
<div class="example-title">Parameter Format Example</div>
|
| 829 |
+
<div class="example-content">
|
| 830 |
+
<div class="example-item"><span class="example-label">Microsoft:</span> "0000789019"</div>
|
| 831 |
+
<div class="example-item"><span class="example-label">Apple:</span> "0000320193"</div>
|
| 832 |
+
<div class="example-item"><span class="example-label">Tesla:</span> "0001318605"</div>
|
| 833 |
+
</div>
|
| 834 |
+
</div>
|
| 835 |
<div class="param-group">
|
| 836 |
<label>CIK Code *</label>
|
| 837 |
<input type="text" id="tool3-cik" placeholder="e.g., 0000789019">
|
|
|
|
| 854 |
</div>
|
| 855 |
</div>
|
| 856 |
<div class="tool-body" id="tool4">
|
| 857 |
+
<div class="example-box">
|
| 858 |
+
<div class="example-title">Parameter Format Example</div>
|
| 859 |
+
<div class="example-content">
|
| 860 |
+
<div class="example-item"><span class="example-label">CIK:</span> "0000789019" (Microsoft)</div>
|
| 861 |
+
<div class="example-item"><span class="example-label">Form Types:</span> Select "10-K" and "10-Q" from dropdown</div>
|
| 862 |
+
<div class="example-item"><span class="example-label">Or:</span> Leave empty to get all filing types</div>
|
| 863 |
+
</div>
|
| 864 |
+
</div>
|
| 865 |
<div class="param-group">
|
| 866 |
<label>CIK Code *</label>
|
| 867 |
<input type="text" id="tool4-cik" placeholder="e.g., 0000789019">
|
|
|
|
| 893 |
</div>
|
| 894 |
</div>
|
| 895 |
<div class="tool-body" id="tool5">
|
| 896 |
+
<div class="example-box">
|
| 897 |
+
<div class="example-title">Parameter Format Example</div>
|
| 898 |
+
<div class="example-content">
|
| 899 |
+
<div class="example-item"><span class="example-label">Microsoft:</span> "0000789019"</div>
|
| 900 |
+
<div class="example-item"><span class="example-label">Apple:</span> "0000320193"</div>
|
| 901 |
+
<div class="example-item"><span class="example-label">NVIDIA:</span> "0001045810"</div>
|
| 902 |
+
</div>
|
| 903 |
+
</div>
|
| 904 |
<div class="param-group">
|
| 905 |
<label>CIK Code *</label>
|
| 906 |
<input type="text" id="tool5-cik" placeholder="e.g., 0000789019">
|
|
|
|
| 922 |
</div>
|
| 923 |
</div>
|
| 924 |
<div class="tool-body" id="tool6">
|
| 925 |
+
<div class="example-box">
|
| 926 |
+
<div class="example-title">Parameter Format Example</div>
|
| 927 |
+
<div class="example-content">
|
| 928 |
+
<div class="example-item"><span class="example-label">Annual Data:</span> CIK="0000789019", Period="2024"</div>
|
| 929 |
+
<div class="example-item"><span class="example-label">Quarterly Data:</span> CIK="0000789019", Period="2024Q3"</div>
|
| 930 |
+
<div class="example-item"><span class="example-label">Format:</span> YYYY for annual, YYYYQX for quarterly</div>
|
| 931 |
+
</div>
|
| 932 |
+
</div>
|
| 933 |
<div class="param-group">
|
| 934 |
<label>CIK Code *</label>
|
| 935 |
<input type="text" id="tool6-cik" placeholder="e.g., 0000789019">
|
|
|
|
| 956 |
</div>
|
| 957 |
</div>
|
| 958 |
<div class="tool-body" id="tool7">
|
| 959 |
+
<div class="example-box">
|
| 960 |
+
<div class="example-title">Parameter Format Example</div>
|
| 961 |
+
<div class="example-content">
|
| 962 |
+
<div class="example-item"><span class="example-label">3 Years:</span> CIK="0000789019", Years=3</div>
|
| 963 |
+
<div class="example-item"><span class="example-label">5 Years:</span> CIK="0000320193", Years=5</div>
|
| 964 |
+
<div class="example-item"><span class="example-label">Note:</span> Returns annual + quarterly data (if available)</div>
|
| 965 |
+
</div>
|
| 966 |
+
</div>
|
| 967 |
<div class="param-group">
|
| 968 |
<label>CIK Code *</label>
|
| 969 |
<input type="text" id="tool7-cik" placeholder="e.g., 0000789019">
|
|
|
|
| 1143 |
return {
|
| 1144 |
"status": "healthy",
|
| 1145 |
"server": "sec-financial-data",
|
| 1146 |
+
"version": "2.2.2",
|
| 1147 |
"protocol": "MCP",
|
| 1148 |
"transport": "SSE",
|
| 1149 |
"tools_count": len(MCP_TOOLS),
|