MCP_Public_Server / server.py
geronimo-pericoli's picture
Update server.py
70601ba verified
raw
history blame
689 Bytes
# server.py
from mcp.server.fastmcp import FastMCP
import argparse
import os
# Obtener el puerto de la variable de entorno o usar 3000 por defecto
port = int(os.getenv("PORT", 7860))
mcp = FastMCP("OnBase", port=port)
@mcp.tool()
def get_document_info(id: int):
"""Gets document information from the client given a document ID."""
return {
"doc_id": id,
"doc_name": "Document Name",
# ... (resto de tu función)
}
if __name__ == "__main__":
print("🚀 Starting server...")
print(f"Launching on Port: {port}")
print(f'Check "http://localhost:{port}/sse" for the server status')
# En Spaces siempre usaremos SSE
mcp.run("sse")