Skip to content
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

mcp: work on --add-mcp CLI #243282

Merged
merged 3 commits into from
Mar 12, 2025
Merged

mcp: work on --add-mcp CLI #243282

merged 3 commits into from
Mar 12, 2025

Conversation

connor4312
Copy link
Member

@connor4312 connor4312 commented Mar 11, 2025

Refs #243224

@connor4312 connor4312 self-assigned this Mar 11, 2025
Comment on lines +35 to +47
// This is not right because settings are nested in .code-workspace...
const workspaceConfigService = new ConfigurationService(URI.file(workspace), this._fileService, this._policyService, this._logService);
await this.updateMcpInConfig(workspaceConfigService, configs);
workspaceConfigService.dispose();
} else {
// todo: this seems incorrect. IConfigurationService.getValue() fails if
// if we point it to mcp.json and call `sevice.getValue()` with no args
// but if we point to launch.json, it writes it there instead of the
// standalone config file. This technically works but is undesirable.
const workspaceFile = URI.joinPath(URI.file(workspace), '.vscode', 'settings.json');
const workspaceFolderConfigService = new ConfigurationService(workspaceFile, this._fileService, this._policyService, this._logService);
await this.updateMcpInConfig(workspaceFolderConfigService, configs);
workspaceFolderConfigService.dispose();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandy081 I could use some help figuring out how to do this. I would like people (or more accurately, tools that install MCP servers) to be able to do code --add-mcp ... --add-mcp-to-workspace <folder or .code-workspace>. This runs in the CLI process and works for installing in the user data dir but making our own config services here is probably not the right thing to do and it doesn't work 😛

@connor4312 connor4312 force-pushed the connor4312/mcp-cli-install branch from 7ed5bbf to 527df30 Compare March 11, 2025 23:30
@connor4312 connor4312 marked this pull request as ready for review March 11, 2025 23:37
@connor4312 connor4312 enabled auto-merge (squash) March 11, 2025 23:37
@@ -410,9 +413,12 @@ function indent(count: number): string {
function wrapText(text: string, columns: number): string[] {
const lines: string[] = [];
while (text.length) {
const index = text.length < columns ? text.length : text.lastIndexOf(' ', columns);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was a 10-year-old bug here where this would crash if the last space in the line was the first character!

@vs-code-engineering vs-code-engineering bot added this to the March 2025 milestone Mar 11, 2025
@connor4312 connor4312 merged commit 589bd5d into main Mar 12, 2025
8 checks passed
@connor4312 connor4312 deleted the connor4312/mcp-cli-install branch March 12, 2025 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants