Conversation
| `The workspace trust feature is currently under development in Theia. | ||
|
|
||
| If you trust the authors, code in this folder may be executed. | ||
|
|
||
| If not, some features will be disabled. Please note that not all features are yet integrated with workspace trust (e.g., debug, tasks). | ||
| Check the 'Restricted Mode' indicator in the status bar for details.` |
There was a problem hiding this comment.
| `The workspace trust feature is currently under development in Theia. | |
| If you trust the authors, code in this folder may be executed. | |
| If not, some features will be disabled. Please note that not all features are yet integrated with workspace trust (e.g., debug, tasks). | |
| Check the 'Restricted Mode' indicator in the status bar for details.` | |
| `If you trust the authors, code in this folder may be executed. | |
| If not, some features will be disabled. | |
| The workspace trust feature is currently under development in Theia; not all features are integrated with workspace trust yet. | |
| Check the 'Restricted Mode' indicator in the status bar for details.` |
| protected getWorkspaceScopedServerNames(): Set<string> { | ||
| const workspaceScopedNames = new Set<string>(); | ||
|
|
||
| const inspection = this.preferenceService.inspect<JSONObject>(MCP_SERVERS_PREF); | ||
| if (!inspection) { | ||
| return workspaceScopedNames; | ||
| } | ||
|
|
||
| if (inspection.workspaceValue) { | ||
| for (const name of Object.keys(inspection.workspaceValue)) { | ||
| workspaceScopedNames.add(name); | ||
| } | ||
| } | ||
|
|
||
| if (inspection.workspaceFolderValue) { | ||
| for (const name of Object.keys(inspection.workspaceFolderValue)) { | ||
| workspaceScopedNames.add(name); | ||
| } | ||
| } | ||
|
|
||
| return workspaceScopedNames; |
There was a problem hiding this comment.
I think it makes sense that these are the servers we'd really want to make sure don't autostart, but maybe it would make sense not to autostart any MCP servers, even though specified in user scope if workspace trust is denied? Basically, it's hard to know how the servers / LLM's using them might interact with malicious content in a workspace, so from a security perspective, it may be better to just block the autostart feature entirely? Particularly if the user can manually start any they're fully confident in.
There was a problem hiding this comment.
Thanks, that's a good point! I've updated it to block all MCP server autostart when workspace trust is denied. Users can still manually start servers they trust.
packages/ai-mcp/src/browser/mcp-frontend-application-contribution.ts
Outdated
Show resolved
Hide resolved
Resolves GH-16872 - Block workspace-scoped MCP servers with autostart in untrusted workspaces - Start blocked servers when trust is granted - Add WorkspaceRestrictionContribution API for packages to report restricted features in status bar tooltip
Co-authored-by: Colin Grant <cgrant.ext@eclipsesource.com>
colin-grant-work
left a comment
There was a problem hiding this comment.
Changes look good 👍
What it does
Resolves GH-16872
This PR integrates workspace trust into the MCP autostart logic:
Additionally, this introduces a
WorkspaceRestrictionContributionAPI, allowing packages to contribute information about restricted features to the "Restricted Mode" status bar tooltip.Remark: This might be replaced later on by a separate Restricted Mode view widget to control different functions and give better overview later on, but for now the information should be sufficient in the status bar item tooltip.
How to test
.theia/settings.jsoncontaining an mcp server definition, e.g.:{ "ai-features.mcp.mcpServers": { "Context7": { "type": "http", "serverUrl": "https://mcp.context7.com/mcp", "autostart": true }, } }Manage Workspace TrustFollow-ups
Breaking changes
Attribution
Review checklist
nlsservice (for details, please see the Internationalization/Localization section in the Coding Guidelines)Reminder for reviewers