Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- Dockerfile +2 -3
- mcp_server.py +2 -24
Dockerfile
CHANGED
|
@@ -15,11 +15,10 @@ COPY . .
|
|
| 15 |
# Expose port 7860 for Hugging Face Spaces
|
| 16 |
EXPOSE 7860
|
| 17 |
|
| 18 |
-
# Create startup script that runs
|
| 19 |
RUN echo '#!/bin/bash\n\
|
| 20 |
echo "Starting Tic-Tac-Toe MCP Server on port 7860..."\n\
|
| 21 |
-
echo "This is the MCP server for
|
| 22 |
-
echo "Web UI available at /rooms-ui endpoint"\n\
|
| 23 |
echo "MCP Tools: create_room, make_move, send_chat, get_room_state, list_rooms"\n\
|
| 24 |
python mcp_server.py' > start.sh && chmod +x start.sh
|
| 25 |
|
|
|
|
| 15 |
# Expose port 7860 for Hugging Face Spaces
|
| 16 |
EXPOSE 7860
|
| 17 |
|
| 18 |
+
# Create startup script that runs MCP server only (simpler approach)
|
| 19 |
RUN echo '#!/bin/bash\n\
|
| 20 |
echo "Starting Tic-Tac-Toe MCP Server on port 7860..."\n\
|
| 21 |
+
echo "This is the MCP server for LeChat integration"\n\
|
|
|
|
| 22 |
echo "MCP Tools: create_room, make_move, send_chat, get_room_state, list_rooms"\n\
|
| 23 |
python mcp_server.py' > start.sh && chmod +x start.sh
|
| 24 |
|
mcp_server.py
CHANGED
|
@@ -2,9 +2,6 @@ import os
|
|
| 2 |
import asyncio
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
from mcp.server.fastmcp import FastMCP
|
| 5 |
-
from fastapi import FastAPI
|
| 6 |
-
from fastapi.staticfiles import StaticFiles
|
| 7 |
-
from fastapi.responses import FileResponse
|
| 8 |
from app import Room, rooms, get_ai_move_for_room, get_ai_chat_for_room
|
| 9 |
|
| 10 |
load_dotenv()
|
|
@@ -415,27 +412,8 @@ async def wait_5_seconds() -> dict:
|
|
| 415 |
"message": f"Failed to wait: {str(e)}"
|
| 416 |
}
|
| 417 |
|
| 418 |
-
#
|
| 419 |
-
|
| 420 |
-
async def rooms_ui():
|
| 421 |
-
"""Serve the room-based game UI"""
|
| 422 |
-
return FileResponse("room_game.html")
|
| 423 |
-
|
| 424 |
-
@mcp.get("/room_game.js")
|
| 425 |
-
async def room_game_js():
|
| 426 |
-
"""Serve the room game JavaScript"""
|
| 427 |
-
return FileResponse("room_game.js")
|
| 428 |
-
|
| 429 |
-
@mcp.get("/")
|
| 430 |
-
async def root():
|
| 431 |
-
"""Root endpoint with server info"""
|
| 432 |
-
return {
|
| 433 |
-
"name": "Tic-Tac-Toe MCP Server",
|
| 434 |
-
"status": "running",
|
| 435 |
-
"mcp_tools": ["create_room", "make_move", "send_chat", "get_room_state", "list_rooms", "switch_room", "get_help"],
|
| 436 |
-
"web_ui": "/rooms-ui",
|
| 437 |
-
"description": "MCP server for LeChat integration with optional web UI for testing"
|
| 438 |
-
}
|
| 439 |
|
| 440 |
# --- Server Execution ---
|
| 441 |
if __name__ == "__main__":
|
|
|
|
| 2 |
import asyncio
|
| 3 |
from dotenv import load_dotenv
|
| 4 |
from mcp.server.fastmcp import FastMCP
|
|
|
|
|
|
|
|
|
|
| 5 |
from app import Room, rooms, get_ai_move_for_room, get_ai_chat_for_room
|
| 6 |
|
| 7 |
load_dotenv()
|
|
|
|
| 412 |
"message": f"Failed to wait: {str(e)}"
|
| 413 |
}
|
| 414 |
|
| 415 |
+
# Note: Web UI served separately by Flask app
|
| 416 |
+
# This MCP server focuses on MCP tools for LeChat integration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
|
| 418 |
# --- Server Execution ---
|
| 419 |
if __name__ == "__main__":
|