Skip to content

Conversation

@sisilet
Copy link

@sisilet sisilet commented May 27, 2025

Problem

The MCP server was failing to start with the following error:

ERROR:    Exception in ASGI application
...
TypeError: 'NoneType' object is not callable

This error occurred in both stdio and SSE transport modes, preventing the server from functioning properly.

Root Cause

The issue was caused by several compatibility problems between the codebase and MCP SDK 1.7.1:

  1. Incorrect Context import: Code was importing Context from mcp.server instead of mcp.server.fastmcp
  2. Wrong context access pattern: Using ctx.request_context.lifespan_context instead of the correct ctx.session.lifespan_context
  3. FastMCP initialization mismatch: Attempting to pass host and port parameters to run_sse_async() method instead of the FastMCP constructor

mkl-o added 2 commits May 27, 2025 21:45
…- Fixed incorrect Context import from mcp.server to mcp.server.fastmcp - Updated context access pattern from ctx.request_context.lifespan_context to ctx.session.lifespan_context - Corrected FastMCP initialization to use host/port as constructor parameters instead of run_sse_async parameters - Fixed compatibility issues with MCP SDK 1.7.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants