INNER CODE UNIT · Python

MCPDependencyError

Nebulock-Inc/agentic-threat-hunting-framework · athf/mcp/server.py:20

class MCPDependencyError(ImportError):
    """Raised when the optional MCP server dependencies are missing or an
    incompatible version is installed (e.g. mcp 2.0.0, which removed FastMCP).

    Subclasses ImportError so existing `except ImportError` handlers keep
    working, while giving callers a specific type to catch. The diagnostic
    message lives here so raise sites stay a one-liner (Ruff TRY003)."""

    def __init__(self, cause: BaseException) -> None:
        super().__init__(
            f"Could not import mcp.server.fastmcp.FastMCP ({cause}). This "
            "usually means either the mcp package is not installed, or an "
            "incompatible version is installed: mcp 2.0.0 removed FastMCP. "
            "Install a supported version with: pip install 'agentic-threat-hunting-framework[mcp]' "
            "(which pins mcp[cli]>=1.9.4,<2.0.0)."
        )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…