Spaces:
Sleeping
Sleeping
Upload server.py
Browse files
server.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# server.py
|
| 2 |
+
from mcp.server.fastmcp import FastMCP
|
| 3 |
+
import argparse
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
# Obtener el puerto de la variable de entorno o usar 3000 por defecto
|
| 7 |
+
port = int(os.getenv("PORT", 3000))
|
| 8 |
+
mcp = FastMCP("OnBase", port=port)
|
| 9 |
+
|
| 10 |
+
@mcp.tool()
|
| 11 |
+
def get_document_info(id: int):
|
| 12 |
+
"""Gets document information from the client given a document ID."""
|
| 13 |
+
return {
|
| 14 |
+
"doc_id": id,
|
| 15 |
+
"doc_name": "Document Name",
|
| 16 |
+
# ... (resto de tu funci贸n)
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
print("馃殌 Starting server...")
|
| 21 |
+
print(f"Launching on Port: {port}")
|
| 22 |
+
print(f'Check "http://localhost:{port}/sse" for the server status')
|
| 23 |
+
|
| 24 |
+
# En Spaces siempre usaremos SSE
|
| 25 |
+
mcp.run("sse")
|