Skip to content

feat(transport): add DELETE /mcp for session termination#131

Open
getlarge wants to merge 2 commits intoplatformatic:mainfrom
getlarge:feat/session-delete
Open

feat(transport): add DELETE /mcp for session termination#131
getlarge wants to merge 2 commits intoplatformatic:mainfrom
getlarge:feat/session-delete

Conversation

@getlarge
Copy link
Copy Markdown
Contributor

@getlarge getlarge commented Apr 8, 2026

Companion to #130 — second of the two small PRs porting features I've been running on my fork in production. Same caveat: riding the momentum, happy to slow-roll if the review queue gets busy.


Adds DELETE /mcp for explicit session termination, per the MCP streamable HTTP transport spec. Clients send DELETE /mcp with an Mcp-Session-Id header; the handler force-closes active SSE streams, unsubscribes from the message broker, and deletes the session from the store.

Behavior

  • DELETE /mcp with valid Mcp-Session-Id204 No Content
  • Missing header → 400
  • Unknown session → 404
  • Route is only registered when enableSSE: true (sessions only exist in SSE mode)
  • Active SSE streams for the session are force-closed before the session is removed, so in-flight clients get a clean disconnect rather than a hung connection

Test plan

  • npm run typecheck clean
  • test/session-delete.test.ts — 6 new tests covering 204 / 400 / 404, SSE stream closure, store cleanup, and the enableSSE: false guard
  • CI green

getlarge and others added 2 commits April 8, 2026 21:45
Clients can now explicitly terminate sessions via DELETE with the
Mcp-Session-Id header, per the MCP transport spec. The handler
force-closes active SSE streams, unsubscribes from the message broker,
and deletes the session from the store. Returns 204 on success.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers:
- 204 on successful deletion
- 400 when Mcp-Session-Id header is missing
- 404 when session does not exist
- SSE stream is force-closed after DELETE
- session is removed from the store
- DELETE route is not registered when enableSSE is false

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant