modelcontextprotocol / modelcontextprotocol/typescript-sdk

Enforcing Content-Type header on client requests

Open
#581 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug fix proposed P2 ready for work
Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
3d 15h
Merged PRs (30d)
4

Description

Typescript server I'm testing my Java SDK client with streamable HTTP against enforces client requests to server Content-Type header value of application/json, e.g.

      const ct = req.headers["content-type"];
      if (!ct || !ct.includes("application/json")) {
        res.writeHead(415).end(JSON.stringify({
          jsonrpc: "2.0",
          error: {
            code: -32000,
            message: "Unsupported Media Type: Content-Type must be application/json"
          },
          id: null
        }));
        return;
      }

I was fine with adding it, but the spec doesn't call out that requirement. It only dictates Content-Type header rules for the server's responses.

Is this something that should be added to the spec, or removed from the TS SDK server implementation?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the streamable HTTP Content-Type requirements in the protocol spec with the TypeScript SDK server implementation. Determine whether the client-request requirement belongs in the spec or should be removed from the SDK, and consider the issue complete when the decision and resulting behavior are documented consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend-api-design
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.