mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
ifcmcp: fail early with clear message when mcp package is not installed
mcp is an optional dependency so that the embedded API (embedded.py) can be used from Pyodide without pulling in pydantic-core and the rest of the MCP protocol stack, which may not be available in all WASM environments.
This commit is contained in:
@@ -27,6 +27,17 @@ def main():
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
from mcp.server.fastmcp import FastMCP # noqa: F401
|
||||
except ImportError:
|
||||
import sys
|
||||
print(
|
||||
"error: the 'mcp' package is required to run the server.\n"
|
||||
"Install it with: pip install mcp",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
from ifcmcp.server import build_server
|
||||
|
||||
server = build_server()
|
||||
|
||||
Reference in New Issue
Block a user