From f820214500f586b84c4a90420085a4cbad92ac29 Mon Sep 17 00:00:00 2001 From: Bruno Postle Date: Fri, 27 Mar 2026 08:44:52 +0000 Subject: [PATCH] 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. --- src/ifcmcp/ifcmcp/__main__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ifcmcp/ifcmcp/__main__.py b/src/ifcmcp/ifcmcp/__main__.py index 0d8ba87f49..47419dc209 100644 --- a/src/ifcmcp/ifcmcp/__main__.py +++ b/src/ifcmcp/ifcmcp/__main__.py @@ -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()