code-context-engine icon indicating copy to clipboard operation
code-context-engine copied to clipboard

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

Open tradewithmeai opened this issue 4 months ago • 0 comments

Summary

mcp 2.0.0 was published today and removed the decorator-based registration API. pyproject.toml requires mcp>=1.0 with no upper bound, so any fresh resolve now installs 2.0.0 and ContextEngineMCP fails to construct.

This is not a soft degradation — it raises in __init__, so the MCP server does not start at all.

Evidence

main CI has been red since earlier today. Latest runs on main:

run date commit result
CI 2026-07-28 675636d8 failure
CI 2026-07-13 da47caca success
CI 2026-07-13 562e6093 success

No source change caused this — the dependency moved underneath it. From the failing run's log:

Collecting mcp>=1.0 (from code-context-engine==0.4.25)
  Downloading mcp-2.0.0-py3-none-any.whl.metadata (7.7 kB)
...
>       @self._server.list_tools()
E       AttributeError: 'Server' object has no attribute 'list_tools'
src/context_engine/integration/mcp_server.py:718: AttributeError

Reproduced locally on Windows / Python 3.13 with a clean venv and pip install -e ".[dev,local]".

Cause

mcp.server.Server no longer exposes the decorator API. Its public surface in 2.0.0 is:

add_notification_handler, add_request_handler, cache_hints, create_initialization_options,
description, extensions, get_capabilities, get_notification_handler, get_request_handler,
icons, instructions, lifespan, middleware, name, run, server_info, server_info_stamp,
session_manager, streamable_http_app, title

There is no list_tools / call_tool — nothing matching *tool* at all.

Two call sites are affected:

  • src/context_engine/integration/mcp_server.py:718 — @self._server.list_tools()
  • src/context_engine/integration/mcp_server.py:863 — @self._server.call_tool()

Suggested fix

Two steps, and I'd suggest separating them:

  1. Immediate — unbreak installs. Constrain to mcp>=1.0,<2 in pyproject.toml. One line, restores green CI and stops new installs shipping a dead MCP server.
  2. Follow-up — port to the 2.0 API. A larger change and a design decision that's yours: whether to move to add_request_handler, support both majors behind a shim, or require 2.0 and bump the minimum.

I'll open a PR for (1) shortly. Happy to take (2) as well if you'd like it, but I didn't want to presume the direction.

Impact

Anyone running pip install code-context-engine from today gets a package whose MCP server cannot start — which is the primary way the tool is used with Claude Code, Cursor and the other listed agents. Existing installs with a resolved mcp 1.x are unaffected until they upgrade.

tradewithmeai avatar Jul 28 '26 22:07 tradewithmeai