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:
Bruno Postle
2026-03-27 08:44:52 +00:00
parent dae913e06a
commit f820214500
+11
View File
@@ -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()