-
Notifications
You must be signed in to change notification settings - Fork 373
add support for Streamable HTTP server #294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@cliffhall @jspahrsummers @pulkitsharma07 would appreciate some early feedback on this. 🙂 |
Hi @shivdeepak! Looks ok, but once the SDK version is bumped, we'll be able to test this more thoroughly. Hopefully that'll take place today. I have a PR queued up for it. |
we've got streamable http support live in https://inspect.mcp.garden for anyone that wants to try in the meantime! |
BTW, while modelcontextprotocol/typescript-sdk#305 has been merged, there are a few remaining bits such as resumability to be added to the SDK before we actually tag and publish its next release. As soon as it's good, we'll be doing a new inspector release. |
@cliffhall, @shivdeepak TypeScript SDK new version is out now |
In order to test this, I will add streamable support to the |
@cliffhall what is the everything server. do you need any support from my end? |
@@ -94,6 +95,13 @@ const createTransport = async (req: express.Request): Promise<Transport> => { | |||
|
|||
console.log("Connected to SSE transport"); | |||
return transport; | |||
} else if (transportType === "streamable-http") { | |||
const transport = new StreamableHTTPClientTransport( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To Auth feature works you should send headers to the server
const transport = new StreamableHTTPClientTransport( | |
const STREAMABLE_HTTP_HEADERS_PASSTHROUGH = ["authorization"]; | |
const headers: HeadersInit = {}; | |
for (const key of STREAMABLE_HTTP_HEADERS_PASSTHROUGH) { | |
if (req.headers[key] === undefined) { | |
continue; | |
} | |
const value = req.headers[key]; | |
headers[key] = Array.isArray(value) ? value[value.length - 1] : value; | |
} | |
const transport = new StreamableHTTPClientTransport( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shivdeepak, if you wanted to make a PR for this, it shouldn't be hard and it would help test this PR.
|
@cliffhall, thanks for the additional info. I don't mind picking this up -- I will create a PR for it soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work @shivdeepak.
I tested with
- streamableHttp using your additions to the
everything
server. - stdio using local path to GooseTeam stdio server.
- sse using the
everything
server'ssse.ts
- sse with oauth using this handy demo by @max-stytch (using
/sse
endpoint instead of the/login
in the link)

Thanks for this! I am using it and it's working pretty well for a session-less MCP Streamable HTTP Server. I ran into two potential issues, though probably just missing functionality with the new Streamable HTTP type, not any regressions.
|
Hi @ferrants Thanks for the report. In order to put this one through its paces, we've needed a server for testing, and that was the everything server in the example servers repo. Testing of these changes against it worked fine, but it has subsequently cast light on a bug in this implementation. We're working on that. |
Motivation and Context
typescript-sdk recently added support for Streamable HTTP client, and server. This PR leverages that change, and adds support for Streamable HTTP MCP Servers to inspector.
Other language bindings are also adding support for streamable HTTP. Integrating this change to the inspector will help towards those efforts by making testing and debugging easy.
Note that I am marking this PR as work in progress (WIP) because this PR cannot use the Streamable HTTP Client and Sever from
typescript-sdk
until a version bump.How Has This Been Tested?
Clone this branch, and start the inspector locally
Caveat: You will have to manually build the latest
typescript-sdk
so that Streamable HTTP Client is available.Once you have everything up and running. You should be able to see the new
Streamable HTTP
transport type.Now, on a different terminal session, clone typescript-sdk and run.
This will start a Streamable HTTP MCP Server at
http://localhost:3000/mcp
Connect to it, and you should be able to issue commands.
Here is an example
tools/list
command:Here is an example
ping
command:Breaking Changes
Currently this branch only works when
typescript-sdk
is built from the latest main. Therefore marking this PR as WIP.There shouldn't be any breaking changes once there is a version bump in
typescript-sdk
and we updatepackage.json
here.Types of changes
Checklist
Additional context