JC321 commited on
Commit
9de3e7b
Β·
verified Β·
1 Parent(s): 70e2a77

Delete templates

Browse files
Files changed (3) hide show
  1. templates/.gitkeep +0 -1
  2. templates/index.html +0 -453
  3. templates/test.html +0 -135
templates/.gitkeep DELETED
@@ -1 +0,0 @@
1
- # This file ensures the templates directory is included in git and Hugging Face Space deployments
 
 
templates/index.html DELETED
@@ -1,453 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>SEC Financial Data MCP Server</title>
7
- <style>
8
- body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; background: #f5f5f5; }
9
- .container { background: white; border-radius: 8px; padding: 30px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
10
- h1 { color: #2563eb; border-bottom: 3px solid #2563eb; padding-bottom: 10px; }
11
- h2 { color: #1e40af; margin-top: 30px; }
12
- h3 { color: #1e3a8a; }
13
- .endpoint { background: #e0e7ff; padding: 15px; border-radius: 5px; margin: 15px 0; font-family: monospace; }
14
- .tool { background: #f0f9ff; border-left: 4px solid #2563eb; padding: 15px; margin: 10px 0; border-radius: 4px; }
15
- .tool-header { display: flex; align-items: center; cursor: pointer; user-select: none; }
16
- .tool-header:hover { background: #e0f2fe; margin: -5px -10px; padding: 5px 10px; border-radius: 4px; }
17
- .tool-toggle { font-size: 14px; margin-right: 10px; transition: transform 0.3s; display: inline-block; }
18
- .tool-toggle.expanded { transform: rotate(90deg); }
19
- .tool-name { font-weight: bold; color: #1e40af; font-size: 18px; flex: 1; }
20
- .tool-content { display: none; margin-top: 15px; padding-top: 15px; border-top: 1px solid #e0e7ff; }
21
- .tool-content.expanded { display: block; }
22
- .test-panel { background: #f8fafc; padding: 15px; border-radius: 5px; margin-top: 15px; border: 1px solid #e2e8f0; }
23
- .test-input { width: 100%; padding: 8px; margin: 5px 0; border: 1px solid #cbd5e1; border-radius: 4px; font-family: monospace; font-size: 13px; }
24
- .test-button { background: #2563eb; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-weight: bold; margin-top: 10px; }
25
- .test-button:hover { background: #1e40af; }
26
- .test-button:disabled { background: #94a3b8; cursor: not-allowed; }
27
- .test-result { background: #1e293b; color: #e2e8f0; padding: 15px; border-radius: 5px; margin-top: 10px; white-space: pre-wrap; word-wrap: break-word; font-family: monospace; font-size: 12px; max-height: 400px; overflow-y: auto; }
28
- .test-status { padding: 8px 12px; border-radius: 4px; margin-top: 10px; font-size: 14px; }
29
- .status-loading { background: #dbeafe; color: #1e40af; }
30
- .status-success { background: #dcfce7; color: #166534; }
31
- .status-error { background: #fee2e2; color: #991b1b; }
32
- .code { background: #1e293b; color: #e2e8f0; padding: 15px; border-radius: 5px; overflow-x: auto; margin: 10px 0; }
33
- .code pre { margin: 0; }
34
- .badge { display: inline-block; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: bold; }
35
- .badge-success { background: #dcfce7; color: #166534; }
36
- .badge-info { background: #dbeafe; color: #1e40af; }
37
- .feature { display: inline-block; margin: 5px; padding: 8px 15px; background: #e0e7ff; border-radius: 5px; }
38
- table { width: 100%; border-collapse: collapse; margin: 15px 0; }
39
- th, td { padding: 12px; text-align: left; border-bottom: 1px solid #e5e7eb; }
40
- th { background: #f3f4f6; font-weight: 600; }
41
- .status { position: fixed; top: 20px; right: 20px; background: #22c55e; color: white; padding: 10px 20px; border-radius: 20px; z-index: 1000; }
42
- </style>
43
- </head>
44
- <body>
45
- <div class="status">🟒 Server Running</div>
46
- <div class="container">
47
- <h1>πŸ“Š SEC Financial Data MCP Server</h1>
48
- <p style="font-size: 18px; color: #64748b;">Access real-time SEC EDGAR financial data via Model Context Protocol</p>
49
-
50
- <h2>πŸ”— MCP Endpoint</h2>
51
- <div class="endpoint">
52
- https://jc321-easyreportsmcpserver.hf.space/mcp
53
- </div>
54
- <p><span class="badge badge-info">Protocol: MCP 2024-11-05</span> <span class="badge badge-info">Transport: HTTP</span></p>
55
- <p style="text-align: center; margin: 20px 0;">
56
- <a href="/test" style="display: inline-block; padding: 12px 24px; background: #2563eb; color: white; text-decoration: none; border-radius: 6px; font-weight: bold;">πŸ§ͺ Test MCP Server Live</a>
57
- </p>
58
-
59
- <h2>πŸ› οΈ Available Tools (7)</h2>
60
-
61
- <div class="tool">
62
- <div class="tool-header" onclick="toggleTool('tool1')">
63
- <span class="tool-toggle" id="toggle-tool1">β–Ά</span>
64
- <div class="tool-name">1. search_company</div>
65
- </div>
66
- <div class="tool-content" id="content-tool1">
67
- <p>Search for a company by name</p>
68
- <strong>Parameters:</strong>
69
- <ul>
70
- <li><code>company_name</code> (string): Company name (e.g., "Tesla", "Apple")</li>
71
- </ul>
72
- <strong>Example:</strong>
73
- <div class="code"><pre>{
74
- "company_name": "Tesla"
75
- }</pre></div>
76
- <strong>Returns:</strong> Company CIK, name, tickers, SIC code
77
-
78
- <div class="test-panel">
79
- <strong>πŸ§ͺ Test this tool:</strong>
80
- <input type="text" id="input-tool1-company_name" class="test-input" placeholder="Company name (e.g., Tesla)" value="Tesla">
81
- <button class="test-button" onclick="testTool1()">Run Test</button>
82
- <div id="status-tool1"></div>
83
- <div id="result-tool1"></div>
84
- </div>
85
- </div>
86
- </div>
87
-
88
- <div class="tool">
89
- <div class="tool-header" onclick="toggleTool('tool2')">
90
- <span class="tool-toggle" id="toggle-tool2">β–Ά</span>
91
- <div class="tool-name">2. get_company_info</div>
92
- </div>
93
- <div class="tool-content" id="content-tool2">
94
- <p>Get detailed company information</p>
95
- <strong>Parameters:</strong>
96
- <ul>
97
- <li><code>cik</code> (string): Company CIK code (10-digit format)</li>
98
- </ul>
99
- <strong>Example:</strong>
100
- <div class="code"><pre>{
101
- "cik": "0001318605"
102
- }</pre></div>
103
-
104
- <div class="test-panel">
105
- <strong>πŸ§ͺ Test this tool:</strong>
106
- <input type="text" id="input-tool2-cik" class="test-input" placeholder="CIK (e.g., 0001318605)" value="0001318605">
107
- <button class="test-button" onclick="testTool2()">Run Test</button>
108
- <div id="status-tool2"></div>
109
- <div id="result-tool2"></div>
110
- </div>
111
- </div>
112
- </div>
113
-
114
- <div class="tool">
115
- <div class="tool-header" onclick="toggleTool('tool3')">
116
- <span class="tool-toggle" id="toggle-tool3">β–Ά</span>
117
- <div class="tool-name">3. get_company_filings</div>
118
- </div>
119
- <div class="tool-content" id="content-tool3">
120
- <p>Get list of SEC filings (10-K, 10-Q, etc.)</p>
121
- <strong>Parameters:</strong>
122
- <ul>
123
- <li><code>cik</code> (string): Company CIK code</li>
124
- <li><code>form_types</code> (array, optional): Filter by form types</li>
125
- </ul>
126
- <strong>Example:</strong>
127
- <div class="code"><pre>{
128
- "cik": "0001318605",
129
- "form_types": ["10-K", "10-Q"]
130
- }</pre></div>
131
-
132
- <div class="test-panel">
133
- <strong>πŸ§ͺ Test this tool:</strong>
134
- <input type="text" id="input-tool3-cik" class="test-input" placeholder="CIK" value="0001318605">
135
- <input type="text" id="input-tool3-form_types" class="test-input" placeholder="Form types (JSON array, e.g., [\"10-K\",\"10-Q\"])" value='["10-K","10-Q"]'>
136
- <button class="test-button" onclick="testTool3()">Run Test</button>
137
- <div id="status-tool3"></div>
138
- <div id="result-tool3"></div>
139
- </div>
140
- </div>
141
- </div>
142
-
143
- <div class="tool">
144
- <div class="tool-header" onclick="toggleTool('tool4')">
145
- <span class="tool-toggle" id="toggle-tool4">β–Ά</span>
146
- <div class="tool-name">4. get_financial_data</div>
147
- </div>
148
- <div class="tool-content" id="content-tool4">
149
- <p>Get financial data for a specific period</p>
150
- <strong>Parameters:</strong>
151
- <ul>
152
- <li><code>cik</code> (string): Company CIK code</li>
153
- <li><code>period</code> (string): Period format "YYYY" or "YYYYQX"</li>
154
- </ul>
155
- <strong>Examples:</strong>
156
- <div class="code"><pre>// Annual data
157
- {
158
- "cik": "0001318605",
159
- "period": "2024"
160
- }
161
-
162
- // Quarterly data
163
- {
164
- "cik": "0001318605",
165
- "period": "2024Q3"
166
- }</pre></div>
167
-
168
- <div class="test-panel">
169
- <strong>πŸ§ͺ Test this tool:</strong>
170
- <input type="text" id="input-tool4-cik" class="test-input" placeholder="CIK" value="0001318605">
171
- <input type="text" id="input-tool4-period" class="test-input" placeholder="Period (e.g., 2024 or 2024Q3)" value="2024">
172
- <button class="test-button" onclick="testTool4()">Run Test</button>
173
- <div id="status-tool4"></div>
174
- <div id="result-tool4"></div>
175
- </div>
176
- </div>
177
- </div>
178
-
179
- <div class="tool">
180
- <div class="tool-header" onclick="toggleTool('tool5')">
181
- <span class="tool-toggle" id="toggle-tool5">β–Ά</span>
182
- <div class="tool-name">5. extract_financial_metrics ⭐</div>
183
- </div>
184
- <div class="tool-content" id="content-tool5">
185
- <p>Extract comprehensive financial metrics for multiple years (annual + quarterly)</p>
186
- <strong>Parameters:</strong>
187
- <ul>
188
- <li><code>cik</code> (string): Company CIK code</li>
189
- <li><code>years</code> (integer): Number of years (1-10, default: 3)</li>
190
- </ul>
191
- <strong>Example:</strong>
192
- <div class="code"><pre>{
193
- "cik": "0001318605",
194
- "years": 3
195
- }</pre></div>
196
- <strong>Returns:</strong> Multi-year data sorted newest first (FY β†’ Q4 β†’ Q3 β†’ Q2 β†’ Q1)
197
-
198
- <div class="test-panel">
199
- <strong>πŸ§ͺ Test this tool:</strong>
200
- <input type="text" id="input-tool5-cik" class="test-input" placeholder="CIK" value="0001318605">
201
- <input type="number" id="input-tool5-years" class="test-input" placeholder="Years (1-10)" value="3" min="1" max="10">
202
- <button class="test-button" onclick="testTool5()">Run Test</button>
203
- <div id="status-tool5"></div>
204
- <div id="result-tool5"></div>
205
- </div>
206
- </div>
207
- </div>
208
-
209
- <div class="tool">
210
- <div class="tool-header" onclick="toggleTool('tool6')">
211
- <span class="tool-toggle" id="toggle-tool6">β–Ά</span>
212
- <div class="tool-name">6. get_latest_financial_data</div>
213
- </div>
214
- <div class="tool-content" id="content-tool6">
215
- <p>Get the most recent financial data available</p>
216
- <strong>Parameters:</strong>
217
- <ul>
218
- <li><code>cik</code> (string): Company CIK code</li>
219
- </ul>
220
- <strong>Example:</strong>
221
- <div class="code"><pre>{
222
- "cik": "0001318605"
223
- }</pre></div>
224
-
225
- <div class="test-panel">
226
- <strong>πŸ§ͺ Test this tool:</strong>
227
- <input type="text" id="input-tool6-cik" class="test-input" placeholder="CIK" value="0001318605">
228
- <button class="test-button" onclick="testTool6()">Run Test</button>
229
- <div id="status-tool6"></div>
230
- <div id="result-tool6"></div>
231
- </div>
232
- </div>
233
- </div>
234
-
235
- <div class="tool">
236
- <div class="tool-header" onclick="toggleTool('tool7')">
237
- <span class="tool-toggle" id="toggle-tool7">β–Ά</span>
238
- <div class="tool-name">7. advanced_search_company</div>
239
- </div>
240
- <div class="tool-content" id="content-tool7">
241
- <p>Advanced search supporting both company name and CIK code</p>
242
- <strong>Parameters:</strong>
243
- <ul>
244
- <li><code>company_input</code> (string): Company name, ticker, or CIK</li>
245
- </ul>
246
- <strong>Examples:</strong>
247
- <div class="code"><pre>// By company name
248
- {
249
- "company_input": "Tesla"
250
- }
251
-
252
- // By CIK
253
- {
254
- "company_input": "0001318605"
255
- }</pre></div>
256
-
257
- <div class="test-panel">
258
- <strong>πŸ§ͺ Test this tool:</strong>
259
- <input type="text" id="input-tool7-company_input" class="test-input" placeholder="Company name or CIK" value="Tesla">
260
- <button class="test-button" onclick="testTool7()">Run Test</button>
261
- <div id="status-tool7"></div>
262
- <div id="result-tool7"></div>
263
- </div>
264
- </div>
265
- </div>
266
-
267
- <h2>πŸ“ How to Use</h2>
268
-
269
- <h3>Option 1: Claude Desktop (Recommended)</h3>
270
- <p>Add to your <code>claude_desktop_config.json</code>:</p>
271
- <div class="code"><pre>{
272
- "mcpServers": {
273
- "sec-financial-data": {
274
- "url": "https://jc321-easyreportsmcpserver.hf.space/mcp",
275
- "transport": "http"
276
- }
277
- }
278
- }</pre></div>
279
- <p><strong>Then ask Claude:</strong></p>
280
- <ul>
281
- <li>"Search for Tesla's financial information"</li>
282
- <li>"Get Apple's latest financial data"</li>
283
- <li>"Show me Microsoft's revenue trends for the last 3 years"</li>
284
- </ul>
285
-
286
- <h3>Option 2: Direct API Call</h3>
287
- <p><strong>List Available Tools:</strong></p>
288
- <div class="code"><pre>curl -X POST https://jc321-easyreportsmcpserver.hf.space/mcp \
289
- -H "Content-Type: application/json" \
290
- -d '{
291
- "jsonrpc": "2.0",
292
- "method": "tools/list",
293
- "id": 1
294
- }'</pre></div>
295
-
296
- <p><strong>Search Company (Tesla):</strong></p>
297
- <div class="code"><pre>curl -X POST https://jc321-easyreportsmcpserver.hf.space/mcp \
298
- -H "Content-Type: application/json" \
299
- -d '{
300
- "jsonrpc": "2.0",
301
- "method": "tools/call",
302
- "params": {
303
- "name": "search_company",
304
- "arguments": {"company_name": "Tesla"}
305
- },
306
- "id": 2
307
- }'</pre></div>
308
-
309
- <p><strong>Get 3-Year Financial Trends:</strong></p>
310
- <div class="code"><pre>curl -X POST https://jc321-easyreportsmcpserver.hf.space/mcp \
311
- -H "Content-Type: application/json" \
312
- -d '{
313
- "jsonrpc": "2.0",
314
- "method": "tools/call",
315
- "params": {
316
- "name": "extract_financial_metrics",
317
- "arguments": {"cik": "0001318605", "years": 3}
318
- },
319
- "id": 3
320
- }'</pre></div>
321
-
322
- <h2>πŸ”‘ Key Features</h2>
323
- <div class="feature">βœ… Pure JSON responses</div>
324
- <div class="feature">βœ… Chronological ordering</div>
325
- <div class="feature">βœ… Comprehensive metrics</div>
326
- <div class="feature">βœ… Real-time SEC EDGAR data</div>
327
- <div class="feature">βœ… 7 powerful tools</div>
328
-
329
- <h2>πŸ“Š Response Example</h2>
330
- <div class="code"><pre>{
331
- "jsonrpc": "2.0",
332
- "id": 2,
333
- "result": {
334
- "content": [{
335
- "type": "text",
336
- "text": "{\"cik\":\"0001318605\",\"name\":\"TESLA, INC.\",\"tickers\":[\"TSLA\"]}"
337
- }]
338
- }
339
- }</pre></div>
340
-
341
- <h2>ℹ️ About</h2>
342
- <table>
343
- <tr><th>Version</th><td>1.0.0 (FastMCP)</td></tr>
344
- <tr><th>Protocol</th><td>Model Context Protocol (MCP) 2024-11-05</td></tr>
345
- <tr><th>Transport</th><td>HTTP (Stateless)</td></tr>
346
- <tr><th>Data Source</th><td>SEC EDGAR Database</td></tr>
347
- <tr><th>Framework</th><td>Anthropic FastMCP SDK</td></tr>
348
- <tr><th>Maintained by</th><td>Juntao Peng (jtyxabc@gmail.com)</td></tr>
349
- </table>
350
-
351
- <p style="text-align: center; color: #64748b; margin-top: 40px;">
352
- <strong>Status:</strong> <span class="badge badge-success">Online</span> |
353
- <strong>Uptime:</strong> Always-On
354
- </p>
355
- </div>
356
-
357
- <script>
358
- // Toggle tool content
359
- function toggleTool(toolId) {
360
- const content = document.getElementById('content-' + toolId);
361
- const toggle = document.getElementById('toggle-' + toolId);
362
-
363
- if (content.classList.contains('expanded')) {
364
- content.classList.remove('expanded');
365
- toggle.classList.remove('expanded');
366
- } else {
367
- content.classList.add('expanded');
368
- toggle.classList.add('expanded');
369
- }
370
- }
371
-
372
- // Common function to call MCP API
373
- async function callMCP(toolName, arguments, statusId, resultId) {
374
- const statusDiv = document.getElementById(statusId);
375
- const resultDiv = document.getElementById(resultId);
376
- const button = event.target;
377
-
378
- statusDiv.innerHTML = '<div class="test-status status-loading">⏳ Sending request...</div>';
379
- resultDiv.innerHTML = '';
380
- button.disabled = true;
381
-
382
- try {
383
- const response = await fetch('/mcp', {
384
- method: 'POST',
385
- headers: { 'Content-Type': 'application/json' },
386
- body: JSON.stringify({
387
- jsonrpc: '2.0',
388
- method: 'tools/call',
389
- params: {
390
- name: toolName,
391
- arguments: arguments
392
- },
393
- id: Date.now()
394
- })
395
- });
396
-
397
- const data = await response.json();
398
- statusDiv.innerHTML = '<div class="test-status status-success">βœ… Success!</div>';
399
- resultDiv.innerHTML = '<div class="test-result">' + JSON.stringify(data, null, 2) + '</div>';
400
- } catch (error) {
401
- statusDiv.innerHTML = '<div class="test-status status-error">❌ Error: ' + error.message + '</div>';
402
- resultDiv.innerHTML = '<div class="test-result">' + JSON.stringify({error: error.toString()}, null, 2) + '</div>';
403
- } finally {
404
- button.disabled = false;
405
- }
406
- }
407
-
408
- // Tool-specific test functions
409
- function testTool1() {
410
- const companyName = document.getElementById('input-tool1-company_name').value;
411
- callMCP('search_company', { company_name: companyName }, 'status-tool1', 'result-tool1');
412
- }
413
-
414
- function testTool2() {
415
- const cik = document.getElementById('input-tool2-cik').value;
416
- callMCP('get_company_info', { cik: cik }, 'status-tool2', 'result-tool2');
417
- }
418
-
419
- function testTool3() {
420
- const cik = document.getElementById('input-tool3-cik').value;
421
- const formTypesStr = document.getElementById('input-tool3-form_types').value;
422
- try {
423
- const formTypes = formTypesStr ? JSON.parse(formTypesStr) : null;
424
- callMCP('get_company_filings', { cik: cik, form_types: formTypes }, 'status-tool3', 'result-tool3');
425
- } catch (e) {
426
- document.getElementById('status-tool3').innerHTML = '<div class="test-status status-error">❌ Invalid JSON for form_types</div>';
427
- }
428
- }
429
-
430
- function testTool4() {
431
- const cik = document.getElementById('input-tool4-cik').value;
432
- const period = document.getElementById('input-tool4-period').value;
433
- callMCP('get_financial_data', { cik: cik, period: period }, 'status-tool4', 'result-tool4');
434
- }
435
-
436
- function testTool5() {
437
- const cik = document.getElementById('input-tool5-cik').value;
438
- const years = parseInt(document.getElementById('input-tool5-years').value);
439
- callMCP('extract_financial_metrics', { cik: cik, years: years }, 'status-tool5', 'result-tool5');
440
- }
441
-
442
- function testTool6() {
443
- const cik = document.getElementById('input-tool6-cik').value;
444
- callMCP('get_latest_financial_data', { cik: cik }, 'status-tool6', 'result-tool6');
445
- }
446
-
447
- function testTool7() {
448
- const companyInput = document.getElementById('input-tool7-company_input').value;
449
- callMCP('advanced_search_company', { company_input: companyInput }, 'status-tool7', 'result-tool7');
450
- }
451
- </script>
452
- </body>
453
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/test.html DELETED
@@ -1,135 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>MCP Server Test</title>
5
- <style>
6
- body { font-family: monospace; padding: 20px; max-width: 1000px; margin: 0 auto; }
7
- button { padding: 10px 20px; margin: 5px; cursor: pointer; background: #2563eb; color: white; border: none; border-radius: 5px; }
8
- button:hover { background: #1e40af; }
9
- .result { background: #1e293b; color: #e2e8f0; padding: 15px; margin: 10px 0; border-radius: 5px; white-space: pre-wrap; word-wrap: break-word; }
10
- .status { padding: 10px; margin: 10px 0; border-radius: 5px; }
11
- .success { background: #dcfce7; color: #166534; }
12
- .error { background: #fee2e2; color: #991b1b; }
13
- </style>
14
- </head>
15
- <body>
16
- <h1>πŸ§ͺ MCP Server Live Test</h1>
17
- <p>Test the MCP server at: <code>https://jc321-easyreportsmcpserver.hf.space/mcp</code></p>
18
-
19
- <div>
20
- <button onclick="testToolsList()">πŸ“‹ Test: List Tools</button>
21
- <button onclick="testSearchCompany()">πŸ” Test: Search Tesla</button>
22
- <button onclick="testFinancialMetrics()">πŸ“Š Test: Get Financial Metrics</button>
23
- </div>
24
-
25
- <div id="status"></div>
26
- <div id="result"></div>
27
-
28
- <script>
29
- const endpoint = '/mcp'; // Use relative path for same-origin requests
30
-
31
- function showStatus(msg, isError) {
32
- document.getElementById('status').innerHTML =
33
- `<div class="status ${isError ? 'error' : 'success'}">${msg}</div>`;
34
- }
35
-
36
- function showResult(data) {
37
- document.getElementById('result').innerHTML =
38
- `<div class="result">${JSON.stringify(data, null, 2)}</div>`;
39
- }
40
-
41
- async function testToolsList() {
42
- showStatus('⏳ Sending request to list tools...');
43
- try {
44
- const response = await fetch(endpoint, {
45
- method: 'POST',
46
- headers: { 'Content-Type': 'application/json' },
47
- body: JSON.stringify({
48
- jsonrpc: '2.0',
49
- method: 'tools/list',
50
- id: 1
51
- })
52
- });
53
-
54
- const text = await response.text();
55
- showStatus('βœ… Response received!', false);
56
-
57
- // Try to parse as JSON or show raw text
58
- try {
59
- const json = JSON.parse(text);
60
- showResult(json);
61
- } catch {
62
- showResult({ raw_response: text });
63
- }
64
- } catch (error) {
65
- showStatus('❌ Error: ' + error.message, true);
66
- showResult({ error: error.toString() });
67
- }
68
- }
69
-
70
- async function testSearchCompany() {
71
- showStatus('⏳ Searching for Tesla...');
72
- try {
73
- const response = await fetch(endpoint, {
74
- method: 'POST',
75
- headers: { 'Content-Type': 'application/json' },
76
- body: JSON.stringify({
77
- jsonrpc: '2.0',
78
- method: 'tools/call',
79
- params: {
80
- name: 'search_company',
81
- arguments: { company_name: 'Tesla' }
82
- },
83
- id: 2
84
- })
85
- });
86
-
87
- const text = await response.text();
88
- showStatus('βœ… Response received!', false);
89
-
90
- try {
91
- const json = JSON.parse(text);
92
- showResult(json);
93
- } catch {
94
- showResult({ raw_response: text });
95
- }
96
- } catch (error) {
97
- showStatus('❌ Error: ' + error.message, true);
98
- showResult({ error: error.toString() });
99
- }
100
- }
101
-
102
- async function testFinancialMetrics() {
103
- showStatus('⏳ Getting Tesla financial metrics (3 years)...');
104
- try {
105
- const response = await fetch(endpoint, {
106
- method: 'POST',
107
- headers: { 'Content-Type': 'application/json' },
108
- body: JSON.stringify({
109
- jsonrpc: '2.0',
110
- method: 'tools/call',
111
- params: {
112
- name: 'extract_financial_metrics',
113
- arguments: { cik: '0001318605', years: 3 }
114
- },
115
- id: 3
116
- })
117
- });
118
-
119
- const text = await response.text();
120
- showStatus('βœ… Response received!', false);
121
-
122
- try {
123
- const json = JSON.parse(text);
124
- showResult(json);
125
- } catch {
126
- showResult({ raw_response: text });
127
- }
128
- } catch (error) {
129
- showStatus('❌ Error: ' + error.message, true);
130
- showResult({ error: error.toString() });
131
- }
132
- }
133
- </script>
134
- </body>
135
- </html>