[BUG] Server.__init__ incompatible with mcp>=1.12

Author: jagerzhangCreated Jul 29, 2026Updated Sep 8, 2026
Labelsbug

Package: fastapi-mcp version 0.4.0 Dependency: mcp>=1.12.0 Severity: Critical — prevents application startup

Description

fastapi-mcp 0.4.0 calls Server.init with description as a second positional argument:

python
# fastapi_mcp/server.py, line 144
  mcp_server: Server = Server(self.name, self.description)

  However, in mcp>=1.12.0, the Server.__init__ signature changed:

  # mcp 1.12.0+ (mcp/server/lowlevel/server.py)
  class Server:
      def __init__(
          self,
          name: str,
          version: str | None = None,           # <-- was "description" in older versions
          instructions: str | None = None,
          lifespan: ... = ...,
      ):

The second positional argument is now version instead of description. Since fastapi-mcp passes self.description (a human-readable string) as the second positional arg, it maps to version, and instructions is never set.

Worse, fastapi-mcp specifies mcp>=1.12.0 in its requirements, meaning this incompatibility is unavoidable with any supported version.

Reproduction

bash
  pip install fastapi-mcp==0.4.0 mcp>=1.12.0
  python -c "
  from fastapi import FastAPI
  from fastapi_mcp import FastApiMCP

  app = FastAPI()
  mcp = FastApiMCP(app)
  # TypeError: Server.__init__() takes 2 positional arguments but 3 were given
  "

Stack Trace

bash
  File "fastapi_mcp/server.py", line 144, in setup_server
      mcp_server: Server = Server(self.name, self.description)
  TypeError: Server.__init__() takes 2 positional arguments but 3 were given

Expected Behavior

FastApiMCP should pass description as the instructions keyword argument, or use a compatible mcp version range.

Workaround

Monkey-patch before FastApiMCP(...):

  from mcp.server.lowlevel.server import Server as _McpServer
  _original = _McpServer.__init__

  def _patched(self, name, *args, **kwargs):
      if args:
          kwargs.setdefault("instructions", args[0])
      kwargs.setdefault("version", "")
      return _original(self, name, **kwargs)

  _McpServer.__init__ = _patched

Suggested Fix

Update fastapi_mcp/server.py line 144 to:

mcp_server: Server = Server(name=self.name, instructions=self.description)

And relax the mcp version constraint or pin to a range that maintains description compatibility.