Skip to content

Fresh install broken by mcp 2.0.0 — ImportError: cannot import name 'request_ctx' from 'mcp.server.lowlevel.server' #316

Description

@koletzilla

A fresh install of Nerve currently fails at startup with:

ImportError: cannot import name 'request_ctx' from 'mcp.server.lowlevel.server'
(/home/ubuntu/nerve/.venv/lib/python3.13/site-packages/mcp/server/lowlevel/server.py)

Root cause

The mcp Python SDK released version 2.0.0, which removed request_ctx from mcp.server.lowlevel.server. Since the dependency chain doesn't set an upper bound on mcp, dependency resolution on a fresh install now picks up the incompatible 2.x release. This affects every new install (and any nerve upgrade that reinstalls deps), regardless of whether the import originates in Nerve itself or in a transitive dependency such as claude-agent-sdk.

Steps to reproduce

  1. Fresh install per the README (installer script or manual uv pip install -e .)
  2. nerve start -f
  3. Startup fails with the ImportError above

Environment

  • Nerve: latest main
  • Python: 3.13 (uv-managed venv)
  • OS: Ubuntu
  • mcp resolved to 2.x

Workaround

Pinning the SDK back to 1.x fixes it:

source .venv/bin/activate
uv pip install 'mcp<2'
nerve restart

Note that nerve upgrade reinstalls dependencies and can pull 2.x back in, so the pin has to be reapplied after upgrades.

Suggested fix

Add an upper-bound constraint (mcp<2, or explicitly mcp>=1.x,<2) to pyproject.toml until the codebase / claude-agent-sdk is compatible with the mcp 2.0 API.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions