Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ import datetime
|
|
| 7 |
import platform
|
| 8 |
from server import mcp # Importa tu servidor MCP existente
|
| 9 |
|
|
|
|
| 10 |
app = FastAPI(title="MCP Server Dashboard")
|
| 11 |
|
| 12 |
# Configurar templates
|
|
@@ -16,12 +17,9 @@ def get_system_info():
|
|
| 16 |
"""Obtiene informaci贸n del sistema"""
|
| 17 |
return {
|
| 18 |
"hostname": socket.gethostname(),
|
| 19 |
-
"ip": socket.gethostbyname(socket.gethostname()),
|
| 20 |
"python_version": platform.python_version(),
|
| 21 |
"system": platform.system(),
|
| 22 |
-
"memory": os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024.**3) if hasattr(os, 'sysconf') else "N/A",
|
| 23 |
"cpu_count": os.cpu_count(),
|
| 24 |
-
"uptime": datetime.datetime.now() - datetime.datetime.fromtimestamp(os.getpid()),
|
| 25 |
"current_time": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 26 |
}
|
| 27 |
|
|
@@ -46,8 +44,8 @@ async def dashboard(request: Request):
|
|
| 46 |
"title": "MCP Server Dashboard"
|
| 47 |
})
|
| 48 |
|
| 49 |
-
#
|
| 50 |
-
app.
|
| 51 |
|
| 52 |
if __name__ == "__main__":
|
| 53 |
import uvicorn
|
|
|
|
| 7 |
import platform
|
| 8 |
from server import mcp # Importa tu servidor MCP existente
|
| 9 |
|
| 10 |
+
# Crea la aplicaci贸n FastAPI
|
| 11 |
app = FastAPI(title="MCP Server Dashboard")
|
| 12 |
|
| 13 |
# Configurar templates
|
|
|
|
| 17 |
"""Obtiene informaci贸n del sistema"""
|
| 18 |
return {
|
| 19 |
"hostname": socket.gethostname(),
|
|
|
|
| 20 |
"python_version": platform.python_version(),
|
| 21 |
"system": platform.system(),
|
|
|
|
| 22 |
"cpu_count": os.cpu_count(),
|
|
|
|
| 23 |
"current_time": datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
| 24 |
}
|
| 25 |
|
|
|
|
| 44 |
"title": "MCP Server Dashboard"
|
| 45 |
})
|
| 46 |
|
| 47 |
+
# Incluye los endpoints de MCP directamente en la aplicaci贸n principal
|
| 48 |
+
app.include_router(mcp.router)
|
| 49 |
|
| 50 |
if __name__ == "__main__":
|
| 51 |
import uvicorn
|