mcpResourceScannerService.ts ×7

Frontier kind: Joint frontier

unlabeled · c_68bd29ed302f

1 test · 16997 LOC · 69 files · introduces 1 test · 31 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges31 lines · 2 files
Tests
1 test

Contains — complete concept membership

All code (extent)
2608 ranges16997 lines · 69 files · Browse complete extent
All tests (intent)
1 testBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 31 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/mcp/common/mcpResourceScannerService.ts 21 introduced LOC · 7 ranges

Open complete file

69
70 async addMcpServers(servers: IInstallableMcpServer[], mcpResource: URI, target?: McpResourceTarget): Promise<void> {
71 > await this.withProfileMcpServers(mcpResource, target, scannedMcpServers => { mcpResourceScannerService.ts
72 > let updatedInputs = scannedMcpServers.inputs ?? [];
73 > const existingServers = scannedMcpServers.servers ?? {};
74 > for (const { name, config, inputs } of servers) {
75 > existingServers[name] = config;
76 > if (inputs) {
77 const existingInputIds = new Set(updatedInputs.map(input => input.id));
78 const newInputs = inputs.filter(input => !existingInputIds.has(input.id));
79 updatedInputs = [...updatedInputs, ...newInputs];
80 }
82 > return { servers: existingServers, inputs: updatedInputs, sandbox: scannedMcpServers.sandbox };
83 > });
84 > }
85
86 async updateSandboxConfig(updateFn: (data: IScannedMcpServers) => IScannedMcpServers, mcpResource: URI, target?: McpResourceTarget): Promise<void> {
128 }
129 if (updateFn) {
130 > scannedMcpServers = updateFn(scannedMcpServers ?? {}); mcpResourceScannerService.ts
131 >
132 > if (target === ConfigurationTarget.USER) {
133 > await this.writeScannedMcpServers(mcpResource, scannedMcpServers);
134 > } else if (target === ConfigurationTarget.WORKSPACE_FOLDER) {
135 await this.writeScannedMcpServersToWorkspaceFolder(mcpResource, scannedMcpServers);
136 } else if (target === ConfigurationTarget.WORKSPACE) {
139 assertNever(target, `Invalid Target: ${ConfigurationTargetToString(target)}`);
140 }
142 return scannedMcpServers;
143 });
145
146 private async writeScannedMcpServers(mcpResource: URI, scannedMcpServers: IScannedMcpServers): Promise<void> {
147 > if ((scannedMcpServers.servers && Object.keys(scannedMcpServers.servers).length > 0) mcpResourceScannerService.ts
148 || (scannedMcpServers.inputs && scannedMcpServers.inputs.length > 0)
149 > || scannedMcpServers.sandbox !== undefined) { mcpResourceScannerService.ts
150 > await this.fileService.writeFile(mcpResource, VSBuffer.fromString(JSON.stringify(scannedMcpServers, null, '\t')));
151 > } else {
152 await this.fileService.del(mcpResource);
153 }
155
156 private async writeScannedMcpServersToWorkspaceFolder(mcpResource: URI, scannedMcpServers: IScannedMcpServers): Promise<void> {
src/vs/platform/mcp/common/mcpManagementService.ts 10 introduced LOC · 4 ranges

Open complete file

414 }
415 } else {
416 > added.push(server); mcpManagementService.ts
417 > this.local.set(name, server);
418 > }
419 }
420
429
430 if (added.length) {
431 > this._onDidInstallMcpServers.fire(added.map(server => ({ name: server.name, local: server, mcpResource: this.mcpResource }))); mcpManagementService.ts
432 > }
433
434 } catch (error) {
477 try {
478 await this.mcpResourceScannerService.addMcpServers([server], this.mcpResource, this.target);
479 > await this.updateLocal(); mcpManagementService.ts
480 > const local = this.local.get(server.name);
481 > if (!local) {
482 throw new Error(`Failed to install MCP server: ${server.name}`);
483 }
484 > return local; mcpManagementService.ts
485 > } catch (e) {
486 this._onDidInstallMcpServers.fire([{ name: server.name, error: e, mcpResource: this.mcpResource }]);
487 throw e;