L7 : mcp_chatbot.py fails with "No module named 'mcp.server.fastmcp'"

The problem

The course was written for version 1.x of the mcp Python package. The project’s pyproject.toml doesn’t set an upper limit on that version, so uv now installs mcp 2.0, which renamed and moved things. The lesson code no longer matches the library.

You’ll see some or all of these:

Error 'Tool' object has no attribute 'inputSchema'
ModuleNotFoundError: No module named 'mcp.server.fastmcp'
Error connecting to research: Connection closed
ImportError: cannot import name 'McpError' from 'mcp.shared.exceptions'
Error connecting to fetch: Connection closed

Three different messages, one cause: mcp 2.0.

The fix

Open the terminal in the notebook and run:

cd ~/work/L7/mcp_project
uv add "mcp>=1.2,<2"

The <2 is the important part — it keeps you on the 1.x version the course expects. You should see it install mcp==1.29.0.

The fetch server is installed separately by uvx, so it needs the same limit.
Open /L7/mcp_project/server_config.json and change the fetch entry to:

"fetch": {
  "command": "uvx",
  "args": ["--with", "mcp<2", "mcp-server-fetch"]
}

Then clear the old cached copy and run again:

uv cache clean
uv run mcp_chatbot.py

Cheers !

1 Like

@lesly.zerna, seems like an update is needed.

1 Like

same as here Code fix for Error Code 400 in labs

1 Like

Hi @aravindagn thank you for reporting! I replicated and shared with the team, thanks for sharing a solution!

We’ll be updating this course during these days!

1 Like

updates are ready to deploy, let’s wait news soon!
And indeed, there has been a major update in mcp, check here.

Lesly - DLAI

1 Like

L7 now is working as expected! Thank you everyone for their reports, suggestions and patience!

Quick status: the errors you’ve been hitting (mcp.server.fastmcp import errors, McpError import errors, tool_use/tool_result mismatches) are due to a breaking update released by MCP on 2026-07-28, which changed parts of the SDK the course was originally built against. This isn’t something on your end, the environment genuinely needs a few extra steps beyond what’s shown in the videos to keep working with today’s package versions.

We’ve pushed markdown notes to this notebook with the exact commands needed to get things running again. Please check those notebooks for the updated instructions.

Happy Learning!

Lesly - DLAI

1 Like