Skip to content

Server crashes on startup: notification_options=None incompatible with current MCP SDK #2

@filhocf

Description

@filhocf

Bug Description

The server crashes immediately on startup with an AttributeError because notification_options=None is passed to server.get_capabilities(), but the current MCP SDK (mcp package) expects a NotificationOptions instance, not None.

Error

AttributeError: 'NoneType' object has no attribute 'tools_changed'

Full traceback:

File "servicenow_mcp/server.py", line 132, in run
    capabilities=self.server.get_capabilities(
        notification_options=None,  # type: ignore[arg-type]
        experimental_capabilities={},
    ),
File "mcp/server/lowlevel/server.py", line 217, in get_capabilities
    tools_capability = types.ToolsCapability(listChanged=notification_options.tools_changed)
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'tools_changed'

Root Cause

In src/servicenow_mcp/server.py line 132, notification_options=None is passed explicitly. The MCP SDK's get_capabilities() method dereferences this parameter without a None check (it expects NotificationOptions).

Fix

Replace None with NotificationOptions() and add the missing import:

from mcp.server.lowlevel.server import NotificationOptions
capabilities=self.server.get_capabilities(
    notification_options=NotificationOptions(),
    experimental_capabilities={},
),

Environment

  • Python 3.13
  • Latest mcp SDK (installed via uvx)
  • Linux

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