Skip to content

mcp>=1.0.0 has no upper bound — resolves to incompatible mcp==2.0.0, ccc mcp crashes with ModuleNotFoundError #249

Description

@louisje

Summary

pyproject.toml declares mcp>=1.0.0 with no upper bound. On a fresh uv tool install cocoindex-code[full], the resolver picks the latest available mcp (currently 2.0.0), which no longer ships mcp.server.fastmcp (the module appears to have been restructured/renamed, e.g. into mcp.server.mcpserver). Since cocoindex_code/server.py still does from mcp.server.fastmcp import FastMCP, ccc mcp crashes on startup.

Environment

  • cocoindex-code v0.2.39 (latest at time of filing)
  • Installed via uv tool install cocoindex-code[full]
  • Resulting mcp version: 2.0.0
  • Python 3.12.9 (uv-managed)
  • Linux

Steps to reproduce

uv tool install cocoindex-code[full]
cd <any project>
ccc init
ccc mcp

Actual result

ModuleNotFoundError: No module named 'mcp.server.fastmcp'

Full traceback (trimmed to the relevant frames):

File ".../cocoindex_code/cli.py", line 1041, in mcp
    asyncio.run(_run_mcp())
File ".../cocoindex_code/cli.py", line 1028, in _run_mcp
    from .server import create_mcp_server, run_heartbeat_loop
File ".../cocoindex_code/server.py", line 17, in <module>
    from mcp.server.fastmcp import FastMCP
ModuleNotFoundError: No module named 'mcp.server.fastmcp'

This also surfaces indirectly when the MCP client (e.g. Claude Code) tries to connect to the ccc mcp server and gets -32000: Connection closed, since the subprocess dies immediately on import.

Root cause

pyproject.toml:

dependencies = [
    "mcp>=1.0.0",
    ...
]

No upper bound means any future mcp major release that changes its public API (as 2.0.0 apparently did, removing/renaming mcp.server.fastmcp) will silently break cocoindex-code for new installs, with no warning at install time.

Workaround

Force-install a compatible mcp version:

uv tool install "cocoindex-code[full]" --with 'mcp<2.0' --force

This resolves mcp==1.29.0 (which still has mcp.server.fastmcp) and ccc mcp starts correctly.

Suggested fix

Pin an upper bound on mcp in pyproject.toml, e.g. mcp>=1.0.0,<2.0.0, until the codebase is updated to support mcp 2.x's new API surface (or add explicit support for both and adjust the constraint accordingly).

Happy to provide more details if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions