In the first case (line 16) we already know that req.query.sessionId is set to something. I
n the second (line 40), it doesn't matter because if it doesn't map to a transport no further action is taken.
This commit introduces the `git branch` tool to the MCP Git server, allowing users to list branches with various filtering options.
Changes include:
- Implemented `git_branch` function in `src/git/src/mcp_server_git/server.py` to support listing local, remote, and all branches, as well as filtering by `contains` and `not_contains` SHA values.
- Added comprehensive unit tests for the `git branch` functionality in `src/git/tests/test_server.py`, covering different branch types and commit filtering scenarios.
- Updated `src/git/README.md`.
For both sse and streamableHttp, a server instance needs to be created for each transport. Otherwise, when a new client connects and its new transport is connected to the single server, the previous transport is overwritten in the server instance and can no longer communicate.
* In sse.ts
- remove global server, cleanup, and transport vars
- add transports map
- in sse GET handler,
- check for sessionId, there shouldn't be one, so comment "Reconnecting?" and do nothing if present
- if sessionId not present
- create new server and transport instance
- connect server to transport
- add transport to transports map
- in server.onclose, delete the transport from the transports map and call cleanup
- in /message POST handler
- get the sessionId from the request
- get the transport from the map by sessionId
- handle the message if the transport was found
* In streamableHttp.ts
- remove the global server and cleanup vars
- change transports var to Map
- in /mcp POST handler
- when creating a new session
- create a server instance
- in server.onclose, delete the transport from the transports map and call cleanup
- remove the calls to cleanup and server.close in the SIGINT handler, because the transport is closed and its onclose handler closes the server.
- 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
Replaced local timezone detection using tzinfo string (e.g. "CEST")
with tzlocal.get_localzone_name() to ensure a valid IANA time zone
(e.g. "Europe/Paris") is passed to ZoneInfo. This avoids runtime
errors on macOS and other systems that return non-IANA tz abbreviations.
# 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#1594