Skip to content

How to add extra headers in sse client requests. #434

Open
@pritam-dey3

Description

@pritam-dey3

I am testing a mcp server and routing the requests to local mcp server through a ngrok tunnel. Now the requests through ngrok has to have this header:

{
    "ngrok-skip-browser-warning": "69420",
}

the value can be anything actually.

Normally I am doing all the fetch requests like this:

const response = await fetch(url, {
    method: 'GET', headers: new Headers({
      "ngrok-skip-browser-warning": "69420",
    }),
  });

How do I add it to my sse transport? This following method is not actually adding the header to the requests.

this.transport = new SSEClientTransport(new URL(url), {
      requestInit: {
        headers: {
          "ngrok-skip-browser-warning": "69420",
        }
      }
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions