Skip to content

fix: constrain mcp to <2 so the MCP server still starts - #148

Open
tradewithmeai wants to merge 1 commit into
elara-labs:mainfrom
tradewithmeai:fix/pin-mcp-below-2
Open

fix: constrain mcp to <2 so the MCP server still starts#148
tradewithmeai wants to merge 1 commit into
elara-labs:mainfrom
tradewithmeai:fix/pin-mcp-below-2

Conversation

@tradewithmeai

Copy link
Copy Markdown

Fixes #147.

What broke

mcp 2.0.0 was published on 2026-07-28 and removed the decorator-based registration API. pyproject.toml required mcp>=1.0 with no upper bound, so from that moment every fresh resolve installs 2.x and ContextEngineMCP raises during construction:

>       @self._server.list_tools()
E       AttributeError: 'Server' object has no attribute 'list_tools'
src/context_engine/integration/mcp_server.py:718: AttributeError

It fails in __init__, so this isn't a degraded feature — the MCP server does not start, which is the primary way the package is used with Claude Code, Cursor and the other listed agents.

main CI went red the same day with no source change; the dependency moved underneath it:

run date commit result
CI 2026-07-28 675636d failure
CI 2026-07-13 da47cac success
CI 2026-07-13 562e609 success

The change

One line, plus a comment saying why it is there and when to remove it:

"mcp>=1.0,<2",

Why only a pin

Two call sites depend on the removed API — mcp_server.py:718 (list_tools) and :863 (call_tool). mcp 2.0's Server exposes add_request_handler, middleware, extensions and nothing matching *tool* at all, so this is a port rather than a rename.

That port is a design decision that belongs to you — move to add_request_handler, support both majors behind a shim, or require 2.x and raise the floor — so this PR only restores a working install and leaves the direction open. Happy to do the port as a follow-up if you tell me which way you want it.

Verification

Windows / Python 3.13, clean venv, pip install -e ".[dev,local]":

mcp resolved tests/test_real_life.py
before 2.0.0 2 failed, 17 passed
after 1.29.0 19 passed

The failures were all AttributeError at the same line, in every test whose setup constructs ContextEngineMCP.

mcp 2.0.0 was published on 2026-07-28 and removed the decorator-based
registration API. `pyproject.toml` required `mcp>=1.0` with no upper bound,
so every fresh resolve from that point installs 2.x and ContextEngineMCP
raises in __init__:

    @self._server.list_tools()
    AttributeError: 'Server' object has no attribute 'list_tools'
    src/context_engine/integration/mcp_server.py:718

This is not a soft degradation — the server does not start, which is the
primary way the package is used with Claude Code, Cursor and the rest.

`main` CI went red the same day with no source change: the dependency moved
underneath it (success on 562e609 and da47cac 2026-07-13, failure on 675636d
2026-07-28).

Two call sites depend on the removed API — mcp_server.py:718 (list_tools)
and :863 (call_tool). mcp 2.0's Server exposes add_request_handler /
middleware / extensions and nothing matching *tool*, so this is a port, not
a rename.

That port is a design decision for the maintainers — whether to move to
add_request_handler, support both majors behind a shim, or require 2.x and
raise the floor — so this change only restores a working install. See elara-labs#147.

Verified on Windows / Python 3.13, clean venv, `pip install -e ".[dev,local]"`:
tests/test_real_life.py goes from 2 failed / 17 passed to 19 passed once mcp
resolves to 1.29.0 under the new constraint.
@tradewithmeai

Copy link
Copy Markdown
Author

Full-suite verification on the same machine (Windows 11, Python 3.13, clean venv, pip install -e ".[dev,local]"):

mcp result
before 2.0.0 27 failed, 1047 passed, 1 skipped, 33 errors
after 1.29.0 2 failed, 1080 passed, 1 skipped, 0 errors

Every one of the 33 errors was the same AttributeError at mcp_server.py:718, raised during setup of any test whose fixture constructs ContextEngineMCP.

The 2 remaining failures are not related to this change — they reproduce identically on a clean upstream/main checkout:

  • tests/test_services.py::test_process_alive_dead_pidOSError: [WinError 87] The parameter is incorrect at services.py:60
  • tests/test_cli_smoke.py::test_servicesAssertionError: assert 1 == 0 (likely downstream of the same thing)

Both look like a Windows-only path in the liveness check rather than anything to do with mcp. Happy to raise that separately with a repro if it's useful — I didn't want to bundle it into a dependency fix.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp 2.0.0 breaks the MCP server: 'Server' object has no attribute 'list_tools' (unbounded mcp>=1.0)

1 participant