-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(mcp): enhance server management with resource handling and trans… #15413
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
base: master
Are you sure you want to change the base?
Conversation
…port type support
Thank you for the contribution! I left some comments on the closed variant of this (#15233):
The second options seems cleaner to me, as env is ignored for SSE. This way, the API makes it very clear what parameters you can provide |
@@ -3,7 +3,7 @@ | |||
"version": "1.60.0", | |||
"description": "Theia - MCP Integration", | |||
"dependencies": { | |||
"@modelcontextprotocol/sdk": "1.0.1", | |||
"@modelcontextprotocol/sdk": "^1.0.1" |
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.
"@modelcontextprotocol/sdk": "^1.0.1" | |
"@modelcontextprotocol/sdk": "^1.0.1", |
This breaks the build
env: mergedEnv, | ||
}); | ||
transport.onerror = error => { | ||
console.log(`Starting server "${this.name}" with transport: ${this.transportType}`); |
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.
We log two messages before we start a server now. I think we can combine it to one covering both cases. What I mean: I would merge the content of the two messages below into the message here so that we get only one log message including all information (the URL for SSE, the command, args and env for stdio)
this.transportType = 'sse'; | ||
} else { | ||
this.transportType = 'stdio'; | ||
} | ||
console.log(this.autostart); |
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.
console.log(this.autostart); |
This was there before, but we could remove it.
Thank you for iterating on the changes! Question: Is there any publicly available MCP server supporting SSE we can use to test this? The example you provide just refers to "plugin". Comment: You moved the sseURL to an environment variable now, which does not seem like a good fit. If you use SSE, you do not need command, args, env. So I would be in favor of making this explicit. The user preferences could look like below then (mcp-preferences.ts). The interface MCPServerDescription (in mcp-server-manager.ts) could have two sub types then for the two variants. They are read from the preferences in mcp-forntend-application-contribution.ts This would make the user configuration and the handling of the two differen types of severs pretty clean I believe, WDYT?
|
This pull request includes several updates and improvements to the MCP (Model Context Protocol) integration within the Theia framework. The changes primarily focus on enhancing the MCP server management capabilities, updating dependencies, and improving error handling.
Dependency Updates:
@modelcontextprotocol/sdk
inpackage.json
to use a caret (^) to allow for minor version updates.Error Handling Improvements:
MCPCommandContribution
to useawait
withmessageService
calls for better error handling and user feedback. [1] [2] [3] [4]MCP Server Enhancements:
listResources
andreadResource
to theMCPServer
andMCPServerManager
interfaces to support resource listing and reading functionalities. [1] [2] [3] [4]MCPServer
with corresponding logic to handle different transport types (stdio
andsse
). [1] [2] [3] [4]Code Refactoring:
mcp-command-contribution.ts
by using a more concise path forMCPFrontendService
andMCPServerStatus
.MCPServer
by specifying the error type asError
and handling unknown errors gracefully.setup example
"ai-features.mcp.mcpServers": {
"plugin": {
"args": [],
"autostart": false,
"command": "plugin",
"env": {
"sseUrl": "http://127.0.0.1:13532/sse"
},
"name": "plugin"
}"