-
Notifications
You must be signed in to change notification settings - Fork 50
Streamable http support #32
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
Fixed a bug, defaulting now to the SSE transport, able to mount the same server using both SSE and HTTP: {
"mcpServers": {
"streamable-no-auth": {
"command": "node",
"args": [
"mcp-remote@next",
"http://localhost:8788/mcp"
]
},
"sse-fallback": {
"command": "npx",
"args": [
"mcp-remote@next",
"http://localhost:8788/sse"
]
}
}
} That pairs with the updates here to make it easy to serve both: geelen/mcp-remote-examples#17 export default new OAuthProvider({
apiHandlers: {
'/sse': MyMCP.serveSSE('/sse'),
'/mcp': MyMCP.serve('/mcp'),
},
defaultHandler: GitHubHandler,
authorizeEndpoint: '/authorize',
tokenEndpoint: '/token',
clientRegistrationEndpoint: '/register',
}) This is feeling a lot better now, I think it's likely ready to release on Monday but I'd still love to put in some more tests. |
note the SSE fallback doesn't work well with this example where the endpoint does support GET http method: because we expect to get 405 in case of trying SSE on a server working with streamable http |
Tested on proxying this streamable HTTP-only server, works really well! |
Ugh of course, that's annoying. You'll have to use I actually wanted to default to the new transport anyway but the Maybe instead of expecting the transport to explode with a known error, I just fire a separate POST to figure out what kind of server it is? That might... be way better, damn. |
This adds a new CLI argument, --transport, with the following values: http-first (the default), http-only, sse-first, and sse-only. Any of the -first tags attempts to connect to the URL as either an HTTP or SSE server and falls back to the other.
Update: this is testable! Use
mcp-remote@next
in your config and it should pullv0.1.0-0
. I'll continue publishing prereleases on thenext
tag to get some real world feedback until it's ready.This depends on the changes in modelcontextprotocol/typescript-sdk#351 which aren't released yet, so marking this as draft for now. It's also extremely under-tested, since there's now a lot of combinations of servers/transports/auth schemes
The new API all comes under the
--transport
CLI flag, which has 4 values:http-first
(the default),sse-first
,http-only
andsse-only
. For-first
flags, we try one type of transport then fall back to the other. That's done by looking for a405
for sse-first and a404
for http-first, then trying the other. It's not exactly airtight but it appears to work for the first few things i've tested.The tricky thing is combining this with auth, of course, where a transport can fail either because it's unauthed or it's using the wrong transport. Claude has done its best with some guidance from me, and I'd almost believe it was done if I had a good test setup to verify. Will work on that next.