Open
Description
FastMCP has been replaced by stuff from modelcontextprotocol/python-sdk.
Therefore I added mcp instead of FastMCP to requirements.txt.
./src/mcp_freecad/server/freecad_mcp_server.py had to be patched accordingly, in addition to adapting to a file name change of freecad_connection.py to freecad_connection_manager.py and restoring argparse options --host and --port that seem to have been available before.
--- ./src/mcp_freecad/server/freecad_mcp_server.py.orig 2025-05-16 13:01:29.955533895 -0400
+++ ./src/mcp_freecad/server/freecad_mcp_server.py 2025-05-16 18:00:58.624245709 -0400
@@ -25,8 +25,8 @@
--- FastMCP Import ---
try:
- from fastmcp import FastMCP
- from fastmcp.exceptions import FastMCPError # Use actual exception name
- from mcp.server.fastmcp import FastMCP
- from mcp.server.fastmcp.exceptions import FastMCPError # Use actual exception name
mcp_import_error = None
except ImportError as e:
mcp_import_error = str(e)
@@ -45,12 +45,12 @@
Adjust path based on actual location relative to this file
try:
# Assuming execution from workspace root or correct PYTHONPATH
- from src.mcp_freecad.client.freecad_connection import FreeCADConnection
- from src.mcp_freecad.client.freecad_connection_manager import FreeCADConnection
FREECAD_CONNECTION_AVAILABLE = True
except ImportError:
try:
# Fallback if running from within the server directory structure
-
from ...client.freecad_connection import FreeCADConnection
-
except ImportError:
from ...client.freecad_connection_manager import FreeCADConnection FREECAD_CONNECTION_AVAILABLE = True
logging.warning(
@@ -1380,6 +1380,8 @@--- Argument Parsing ---
parser = argparse.ArgumentParser(description="Advanced FreeCAD MCP Server")
parser.add_argument("--config", default=CONFIG_PATH, help="Path to configuration file") - parser.add_argument("--host", default="localhost", help="Host for the transport socket receiver")
- parser.add_argument("--port", type=int, default=9876, help="Port for the transport socket receiver")
parser.add_argument("--log-host", default="localhost", help="Host for the logging socket receiver")
parser.add_argument("--log-port", type=int, default=LOGGING_PORT, help="Port for the logging socket receiver")
parser.add_argument("--debug", action="store_true", help="Enable debug logging")
@@ -1464,7 +1466,7 @@Pass unknown arguments if necessary, depending on FastMCP's run method
try:
# Note: Check FastMCP documentation for how to pass extra args if needed
-
await mcp.run_stdio() # Or run_tcp, run_ws depending on desired transport
-
except KeyboardInterrupt:
await mcp.run("stdio") # Or run_tcp, run_ws depending on desired transport
logger.info("Server shutting down (KeyboardInterrupt)...")
except Exception as e:
Metadata
Metadata
Assignees
Labels
No labels