Skip to content

MCP: "Failed to parse message: ''" warning from empty SSE priming frames #303695

@lqdflying

Description

@lqdflying

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.99.0 (or check Help → About)
  • OS Version: Windows / macOS / Linux

Steps to Reproduce:

  1. Set up a FastMCP server with streamable-http transport in stateful mode (e.g. mcp.http_app(event_store=..., stateless_http=False))
  2. Add the server to VS Code as an MCP server in settings.json
  3. Open VS Code Output panel → MCP logs

Expected: No warnings during SSE stream initialization

Actual: Repeated warnings logged:
Failed to parse message: ""

Root Cause:
The MCP Python SDK sends an empty SSE priming frame (data: \n\n) when a client opens a GET /mcp SSE stream. VS Code's SSE message parser attempts to JSON-parse every frame including empty ones, producing this warning.

Suggested Fix:
In the SSE message handler, skip empty frames before attempting JSON parsing:
if (!data || data.trim() === '') return;

Additional Context:

  • MCP server: FastMCP 3.1.x, streamable-http transport, stateful mode
  • MCP Python SDK: 1.x
  • Despite the warnings, the server functions correctly — 14 tools discovered, OAuth works normally
  • The warning does not appear in stateless mode (stateless_http=True) since GET /mcp returns 405 and no SSE stream is opened

Metadata

Metadata

Assignees

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