Skip to content

Conversation

@cliffhall
Copy link
Member

@cliffhall cliffhall commented May 5, 2025

Description

Update server-everything to allow choosing the transport on the command line.

  • In src/everything/index.ts

    • refactor/extracted contents to stdio.ts
    • replaced with code that
      • Gets the single argument from the commandline as scriptName
      • switches on scriptName
      • imports the appropriate server script or outputs usage options
    • scripts run on import
  • In src/everything/stdio.ts

    • added console log "Starting default (STDIO) server..."
  • In src/everything/sse.ts

    • added console log "Starting SSE server..."
  • In src/everything/streamableHttp.ts

    • added console log "Starting Streamable HTTP server..."
  • In README.md

    • add details for launching

Server Details

  • Server: everything
  • Changes to: startup process

Motivation and Context

To allow specifying the transport to start the server with on the command line.

Valid commands

Run the default (stdio) server

npx @modelcontextprotocol/server-everything

Or specify stdio explicitly

npx @modelcontextprotocol/server-everything stdio

Run the SSE server

npx @modelcontextprotocol/server-everything sse

Run the streamable HTTP server

npx @modelcontextprotocol/server-everything streamableHttp

How Has This Been Tested?

  1. Run the startup script that npx will invoke with the args
Screenshot 2025-05-05 at 1 17 13 PM Screenshot 2025-05-05 at 1 18 04 PM Screenshot 2025-05-05 at 1 18 22 PM Screenshot 2025-05-05 at 1 18 45 PM Screenshot 2025-05-05 at 1 45 17 PM
  1. Run npm link in src/everything and then test with npx
Screenshot 2025-05-05 at 1 38 03 PM Screenshot 2025-05-05 at 1 38 33 PM Screenshot 2025-05-05 at 1 38 21 PM Screenshot 2025-05-05 at 1 38 55 PM Screenshot 2025-05-05 at 1 39 19 PM

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

cliffhall added 2 commits May 5, 2025 13:09
…mand line.

# Run the default (stdio) server
```npx @modelcontextprotocol/server-everything```

# Or specify stdio explicitly
```npx @modelcontextprotocol/server-everything stdio```

# Run the SSE server
```npx @modelcontextprotocol/server-everything sse```

# Run the streamable HTTP server
```npx @modelcontextprotocol/server-everything streamableHttp```

* In src/everything/index.ts
  - refactor/extracted contents to stdio.ts
  - replaced with code that
    - Gets the single argument from the commandline as scriptName
    - switches on scriptName
    - imports the appropriate server script or outputs usage options
  - scripts run on import

* In src/everything/stdio.ts
  - added console log "Starting default (STDIO) server..."

* In src/everything/sse.ts
  - added console log "Starting SSE server..."

* In src/everything/streamableHttp.ts
  - added console log "Starting Streamable HTTP server..."

* This fixes modelcontextprotocol#1594
@olaservo
Copy link
Member

olaservo commented May 6, 2025

Looks good, I was also able to publish this branch to a personal version of the package in npm and run all variations on my Windows machine:

PS C:\Users[redacted]> npx @olaservo/server-everything
Starting default (STDIO) server...
{"method":"notifications/message","params":{"level":"emergency","data":"Emergency-level message"},"jsonrpc":"2.0"}
PS C:\Users[redacted]> npx @olaservo/server-everything sse
Starting SSE server...
Server is running on port 3001
PS C:\Users[redacted]> npx @olaservo/server-everything streamableHttp
Starting Streamable HTTP server...
MCP Streamable HTTP Server listening on port 3001
Shutting down server...
Server shutdown complete
PS C:\Users[redacted]> npx @olaservo/server-everything stdio
Starting default (STDIO) server...

Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this, left a comment on a logging issue but works for me on the terminal so far.

cliffhall added 2 commits May 6, 2025 10:26
* In stdio.ts
  - change console.log to console.error
* In sse.ts & streamableHttp.ts
  - change console.log to console.error
Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Claude Desktop over STDIO is happy now:
image

I'm not able to test SSE in the same app so I'm not certain how console.error is actually being interpreted for that transport, but if it creates noise we can always change it.

@olaservo olaservo added enhancement New feature or request server-everything Reference implementation for the Everything MCP server - src/everything labels May 6, 2025
@cliffhall cliffhall merged commit 2645e03 into modelcontextprotocol:main May 6, 2025
25 checks passed
PazerOP referenced this pull request in PazerOP/mcp-template Jul 15, 2025
…-npx

Choose the server-everything transport on the command line
@cliffhall cliffhall deleted the choose-server-at-startup-from-npx branch July 24, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request server-everything Reference implementation for the Everything MCP server - src/everything

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to enable either stdio or SSE transports when running server-everything using npx

2 participants