-
Notifications
You must be signed in to change notification settings - Fork 88
fix: disable MCP auto start and instead request on first load and new connection attempts VSCODE-704 #1132
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
fix: disable MCP auto start and instead request on first load and new connection attempts VSCODE-704 #1132
Conversation
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.
Pull Request Overview
This pull request changes the MongoDB MCP server startup behavior from auto-starting by default to requiring explicit user permission. Instead of automatically starting the MCP server on VS Code activation, the extension now shows a notification asking users to enable or disable auto-start functionality.
Key changes:
- Replaces auto-start behavior with user permission requests via notifications
- Migrates old configuration values (
ask
,enabled
,disabled
) to new values (Ask
,Auto Start Enabled
,Auto Start Disabled
) - Updates the default
mdb.mcp.readOnly
setting fromfalse
totrue
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/mcp/mcpController.ts |
Core logic changes for permission-based MCP server startup and config migration |
src/test/suite/mcp/mcpController.test.ts |
Updated tests to reflect new configuration values and behavior |
package.json |
Updated configuration schema with new enum values and defaults |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This commit flips the earlier behaviour of MongoDB MCP server auto-starting on VSCode activate. We will now popup a notification asking user to enable auto-start or disable it. If the user does not select any option or the notification auto-dimisses then we will ask for the same on every start of VSCode and every new connection attempt.
6436b35
to
6c48e71
Compare
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.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…cp-auto-start-behaviour
mdb.mcp.server could have any value stored in the user config. This commit splits the retrieval of the stored value in two interfaces. 1. To be used for migration. Retrieves the value as is stored in the user config 2. To be used for rest of the logic. Retrieves the value stored in the user config and maps it to known and identified values ('prompt','autoStartEnabled', 'autoStartDisabled')
We will now keep a track of connection managers created per client connection and on connection updates, update all the active connection managers. Additionally when a client disconnects, we will listen to close event and cleanup the connection manager from the tracked list.
…cp-auto-start-behaviour
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.
Looks okay - I have mostly stylistic comments. I tried to find it in the tests, but can't seem to - we should validate that when we call MCPController.stopServer()
all connection managers are closed and also they're removed from the clientConnectionManagers
array.
Additionally, maybe I'm missing it, but the tests for multiple connected clients don't seem to validate that they all have their own states (e.g. disconnecting client 1 doesn't disconnect the connection manager for client 2).
…cp-auto-start-behaviour
We now show popup only when user connects to a connection in VSCode and the necessary requirements to prompt are met. Additionally a few tests are modified to reflect the new reality.
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.
Pull Request Overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Looks good - final nits from me.
Description
This PR flips the earlier behaviour of MongoDB MCP server auto-starting on VS Code activation. Instead of auto-starting by default, we now show a notification, only when user actually connects to a connection in VSCode, asking users to enable or disable auto-start.
Additionally we've enabled the
readOnly
mode by default.Key Changes
New Behavior
Migration for Existing Users
We've migrated old config values to preserve explicit user preferences. In the previous logic, only "disabled" represented an intentional user action, so we preserve that choice while treating all other values as requiring user confirmation.
mdb.mcp.server
valuemdb.mcp.server
value"ask"
"prompt"
"enabled"
"prompt"
"disabled"
"autoStartDisabled"
Configuration Values
The new configuration accepts these values:
"prompt"
(default) - Show notification to request permission"autoStartEnabled"
- Automatically start MCP server on VS Code launch, no notifications"autoStartDisabled"
- Never auto-start, no notificationsScreenshots
When server is not already running
When server is already running
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes