Skip to content

Reject unsupported subscription streams - #3073

Open
SamMorrowDrums wants to merge 1 commit into
mainfrom
sammorrowdrums-reject-subscription-listen
Open

Reject unsupported subscription streams#3073
SamMorrowDrums wants to merge 1 commit into
mainfrom
sammorrowdrums-reject-subscription-listen

Conversation

@SamMorrowDrums

Copy link
Copy Markdown
Collaborator

Summary

Reject subscriptions/listen requests instead of opening an idle SSE stream when the HTTP server cannot provide change notifications.

Why

The remote server exposes a static MCP catalog and does not emit change notifications. Under MCP 2026-07-28, accepting subscriptions/listen would leave clients on a stream that cannot deliver useful events.

N/A — no linked issue.

What changed

  • Detect subscriptions/listen using the required Mcp-Method header.
  • Return the spec-defined HTTP 404 and JSON-RPC -32601 response while preserving header/body mismatch validation.
  • Cover matching, missing, and mismatched method headers.

MCP impact

  • Tool schema or behavior changed

MCP transport behavior changes for subscriptions/listen; no tool schemas changed.

Prompts tested (tool changes only)

  • N/A — no tools changed.

Security / limits

  • No security or limits impact

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Not needed
  • Updated (README / docs / examples)

Use the Mcp-Method header to reject subscriptions/listen with the spec-defined 404 Method Not Found response instead of opening an idle SSE stream. Preserve SDK validation for missing or mismatched headers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 06d5dda1-4086-4996-8d18-152e45e611b0
@SamMorrowDrums
SamMorrowDrums requested a review from a team as a code owner August 14, 2026 16:09
Copilot AI balanced review requested due to automatic review settings August 14, 2026 16:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Rejects unsupported subscriptions/listen requests to prevent idle SSE streams.

Changes:

  • Adds the Mcp-Method header constant.
  • Returns HTTP 404 with JSON-RPC -32601.
  • Tests matching, missing, and mismatched headers.
Show a summary per file
File Description
pkg/http/headers/headers.go Defines the MCP method header.
pkg/http/handler.go Rejects unsupported subscription streams.
pkg/http/handler_test.go Verifies rejection and header validation.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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