Skip to content

Conversation

@cliffhall
Copy link
Member

@cliffhall cliffhall commented May 15, 2025

Description

  • In src/everything/sse.ts and streamableHttp.ts
    • Replace console.log with console.error throughout
  • In src/everything/sse.ts
    • remove the process.exit() in the server.onclose handler so reconnections are possible
    • add SIGINT handler that does cleanup, server.close, and process.exit (same as in stdio.ts and streamableHttp.ts)

Server Details

  • Server: server-everything
  • Changes to: suppress non-json output, handle SIGINT and allow reconnections to sse server

Motivation and Context

While looking at this PR for the inspector it became obvious that we need to suppress all console.log output as per the spec, even in SSE/StreamableHttp (STDIO was already using only console.error).

Also since that PR was testing ability to reconnect, I fixed the long-annoying behavior of the SSE server of closing entirely when the client disconnects.

How Has This Been Tested?

Local testing with current Inspector, SSE, StreamableHttp, and STDIO.

Breaking Changes

Nope.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • [] New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

  - Replace console.log with console.error throughout
* In src/everything/sse.ts
  - remove the process.exit() in the server.onclose handler so reconnections are possible
@cliffhall cliffhall changed the title * In src/everything/sse.ts and streamableHttp.ts Fix server-everything output May 15, 2025
@cliffhall cliffhall requested a review from olaservo May 15, 2025 18:30
  - add SIGINT handler that does cleanup, server.close, and process.exit
@cliffhall cliffhall changed the title Fix server-everything output Fix server-everything output and disconnect behavior May 15, 2025
@olaservo olaservo merged commit 17b91c3 into modelcontextprotocol:main May 17, 2025
25 checks passed
@cliffhall cliffhall deleted the server-everything-console-logs branch May 17, 2025 16:43
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