Skip to content

faircode-mcp fails with a raw ModuleNotFoundError traceback when the mcp extra is not installed #995

Closed

Description

@yakew7

Where: faircode/mcp_server.py build_server() (the from mcp.server.mcpserver import MCPServer import, line 524) and main(), pyproject.toml ([project.scripts]), tests/test_mcp_server.py.

Current gap: the module docstring says the server needs pip install faircode[mcp], but running the console script without the extra ends in a Python traceback ending ModuleNotFoundError: No module named 'mcp'. Every other optional extra (excel, proxy, benchmark) turns its missing import into a one-line message that names the extra. #987 now starts the server over stdio, but only with the extra present.

Repro:

$ python3 -m venv /tmp/v && /tmp/v/bin/pip install -e . && /tmp/v/bin/faircode-mcp
Traceback (most recent call last): ...
ModuleNotFoundError: No module named 'mcp'

Suggested approach: catch the ImportError in main(), print faircode-mcp needs the optional 'mcp' extra: pip install faircode[mcp] to stderr and exit 2, and test it by running the entry point in a subprocess with mcp blocked (python -c "import sys; sys.modules['mcp'] = None; ...").

Activity

  1. yakew7 commented on Oct 16, 2026

    @yakew7
    OwnerAuthor

    Fixed in c368419 (on main). Full suite green (941 passed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions