Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,54 +0,0 @@
|
|
| 1 |
-
from fastapi import FastAPI, Request
|
| 2 |
-
from fastapi.responses import HTMLResponse
|
| 3 |
-
from server import mcp # Tu instancia de FastMCP
|
| 4 |
-
import datetime
|
| 5 |
-
import socket
|
| 6 |
-
|
| 7 |
-
app = FastAPI(title="MCP Server")
|
| 8 |
-
|
| 9 |
-
# Dashboard HTML simple
|
| 10 |
-
@app.get("/", response_class=HTMLResponse)
|
| 11 |
-
async def dashboard(request: Request):
|
| 12 |
-
html_content = f"""
|
| 13 |
-
<!DOCTYPE html>
|
| 14 |
-
<html>
|
| 15 |
-
<head>
|
| 16 |
-
<title>MCP Server</title>
|
| 17 |
-
<style>
|
| 18 |
-
body {{ font-family: Arial, sans-serif; margin: 20px; }}
|
| 19 |
-
.card {{
|
| 20 |
-
background: #f8f9fa;
|
| 21 |
-
padding: 20px;
|
| 22 |
-
border-radius: 5px;
|
| 23 |
-
margin-bottom: 20px;
|
| 24 |
-
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
|
| 25 |
-
}}
|
| 26 |
-
</style>
|
| 27 |
-
</head>
|
| 28 |
-
<body>
|
| 29 |
-
<div class="card">
|
| 30 |
-
<h1>MCP Server Status</h1>
|
| 31 |
-
<p>🟢 <strong>Running</strong></p>
|
| 32 |
-
<p>Hostname: {socket.gethostname()}</p>
|
| 33 |
-
<p>Time: {datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}</p>
|
| 34 |
-
</div>
|
| 35 |
-
|
| 36 |
-
<div class="card">
|
| 37 |
-
<h2>Available Endpoints</h2>
|
| 38 |
-
<ul>
|
| 39 |
-
<li><code>GET /get_document_info</code></li>
|
| 40 |
-
<li><code>GET /sse</code></li>
|
| 41 |
-
</ul>
|
| 42 |
-
</div>
|
| 43 |
-
</body>
|
| 44 |
-
</html>
|
| 45 |
-
"""
|
| 46 |
-
return HTMLResponse(content=html_content)
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
app.include_router(mcp.app.router) # Sin prefijo
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
if __name__ == "__main__":
|
| 53 |
-
import uvicorn
|
| 54 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|