diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6cdd9b1a7..a31f29d508 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -263,7 +263,9 @@ jobs: cd ../ifcquery && make test || ERROR=1 pip install -e ../ifcedit --no-deps cd ../ifcedit && make test || ERROR=1 - pip install mcp + # Pinned <2: mcp 2.0.0 renamed mcp.server.fastmcp.FastMCP to + # mcp.server.mcpserver.MCPServer, which ifcmcp doesn't support yet. + pip install "mcp>=1.0,<2" pip install -e ../ifcmcp --no-deps cd ../ifcmcp && make test || ERROR=1 pip install -e ../ifctester --no-deps diff --git a/src/ifcmcp/ifcmcp/server.py b/src/ifcmcp/ifcmcp/server.py index 08ba86a2cb..202333b2ac 100644 --- a/src/ifcmcp/ifcmcp/server.py +++ b/src/ifcmcp/ifcmcp/server.py @@ -9,7 +9,7 @@ from ifcmcp.core import IfcSession try: from mcp.server.fastmcp import FastMCP # type: ignore from mcp.types import ImageContent # type: ignore -except Exception: # pragma: no cover +except ImportError: # pragma: no cover FastMCP = None # type: ignore ImageContent = None # type: ignore diff --git a/src/ifcmcp/pyproject.toml b/src/ifcmcp/pyproject.toml index 295954d0c5..2463e5a5cf 100644 --- a/src/ifcmcp/pyproject.toml +++ b/src/ifcmcp/pyproject.toml @@ -18,7 +18,9 @@ classifiers = [ dependencies = ["ifcopenshell", "ifcquery", "ifcedit"] [project.optional-dependencies] -mcp = ["mcp"] +# Pinned <2: mcp 2.0.0 renamed mcp.server.fastmcp.FastMCP to +# mcp.server.mcpserver.MCPServer, which this package doesn't support yet. +mcp = ["mcp>=1.0,<2"] [project.scripts] ifcmcp = "ifcmcp.__main__:main"