[BUG] Incompatible with mcp 2.0 — Server.__init__() positional arg crash

Author: mihirathale98Created Jul 28, 2026Updated Jul 28, 2026

Hi there! First off, thank you for building and maintaining fastapi-mcp — it's been a great tool for us.

Description

With the recent release of mcp==2.0.0, fastapi-mcp crashes on startup due to Server.__init__() now requiring keyword-only arguments after name.

Root Cause

In fastapi_mcp/server.py (line 181 in 0.4.0, line 144 in earlier versions), description is passed as a positional argument:

python
mcp_server: LowlevelMCPServer = LowlevelMCPServer(self.name, self.description)

In mcp<2.0, Server.__init__ accepted positional args (name, version=None, ...), so self.description silently landed on the version parameter — incorrect but non-breaking.

In mcp==2.0.0, the signature changed to Server(name, *, ...) — everything after name is keyword-only — so the positional description arg now raises:

TypeError: Server.__init__() takes 2 positional arguments but 3 were given

Steps to Reproduce

bash
pip install fastapi-mcp==0.4.0 mcp==2.0.0
python
from fastapi import FastAPI
from fastapi_mcp import FastApiMCP

app = FastAPI()
mcp = FastApiMCP(app, name="test", description="A test server")
# TypeError: Server.__init__() takes 2 positional arguments but 3 were given

Suggested Fix

Pass description as a keyword argument:

python
mcp_server: LowlevelMCPServer = LowlevelMCPServer(self.name, description=self.description)

Notes

I noticed issue #272 and several open PRs (#254, #282, #292, #294, #317) already address the underlying positional arg bug. With mcp 2.0 now released, this has escalated from a cosmetic issue (description landing on the wrong field) to a hard crash that prevents any fastapi-mcp server from starting.

Would it be possible to merge one of the existing PRs and cut a release? We're currently pinning mcp<2.0 as a workaround, and would love to be able to drop that pin.

Thank you for your time!

Environment

  • fastapi-mcp: 0.4.0 (also affects 0.3.7)
  • mcp: 2.0.0
  • Python: 3.12