You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(mcp): align MCP client with mcp-go server protocol
Updates the MCP client transport logic to ensure compatibility with `mcp-go` servers, which expect the `mcp-session-id` in the HTTP headers rather than as a query parameter.
This commit addresses the incompatibility by:
1. Upgrading the `@modelcontextprotocol/sdk` from `^1.9.0` to `^1.12.1` to leverage the latest `StreamableHTTPClientTransport`.
2. Refactoring the connection logic in `McpHub.ts` to prioritize the `StreamableHTTPClientTransport` while maintaining the deprecated `SSEClientTransport` as a fallback for older servers.
3. Resolving a persistent TypeScript type-narrowing error by replacing the conditional `if/else if` block with a `switch` statement, improving code clarity and type safety.
These changes should ensure that Roo can correctly establish sessions with modern `mcp-go` servers while maintaining backward compatibility.
Closes#4189
// transport.stderr is only available after the process has been started. However we can't start it separately from the .connect() call because it also starts the transport. And we can't place this after the connect call since we need to capture the stderr stream before the connection is established, in order to capture errors during the connection process.
512
-
// As a workaround, we start the transport ourselves, and then monkey-patch the start method to no-op so that .connect() doesn't try to start it again.
513
-
awaittransport.start()
514
-
conststderrStream=transport.stderr
515
-
if(stderrStream){
516
-
stderrStream.on("data",async(data: Buffer)=>{
517
-
constoutput=data.toString()
518
-
// Check if output contains INFO level log
519
-
constisInfoLog=/INFO/i.test(output)
520
-
521
-
if(isInfoLog){
522
-
// Log normal informational messages
523
-
console.log(`Server "${name}" info:`,output)
524
-
}else{
525
-
// Treat as error log
526
-
console.error(`Server "${name}" stderr:`,output)
527
-
constconnection=this.findConnection(name,source)
528
-
if(connection){
529
-
this.appendErrorMessage(connection,output)
530
-
if(connection.server.status==="disconnected"){
531
-
awaitthis.notifyWebviewOfServerChanges()
512
+
// transport.stderr is only available after the process has been started. However we can't start it separately from the .connect() call because it also starts the transport. And we can't place this after the connect call since we need to capture the stderr stream before the connection is established, in order to capture errors during the connection process.
513
+
// As a workaround, we start the transport ourselves, and then monkey-patch the start method to no-op so that .connect() doesn't try to start it again.
0 commit comments