mcpRegistry.ts ×11

Frontier kind: Code frontier

unlabeled · c_c715740331c4

14 tests · 41945 LOC · 197 files · introduces 0 tests · 27 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges27 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3731 ranges41945 lines · 197 files · Browse complete extent
All tests (intent)
14 testsBrowse 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.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

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

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

src/vs/workbench/contrib/mcp/common/mcpRegistry.ts 27 introduced LOC · 11 ranges

Open complete file

213
214 private async _checkTrust(collection: McpCollectionDefinition, definition: McpServerDefinition, {
215 > trustNonceBearer, mcpRegistry.ts
216 > interaction,
217 > promptType = 'only-new',
218 > autoTrustChanges = false,
219 > errorOnUserInteraction = false,
220 > }: IMcpResolveConnectionOptions) {
221 > if (collection.scope === StorageScope.WORKSPACE && !this._workspaceTrustManagementService.isWorkspaceTrusted()) {
222 if (errorOnUserInteraction) {
223 throw new UserInteractionRequiredError('workspaceTrust');
226 }
227 }
229 > if (collection.trustBehavior === McpServerTrust.Kind.Trusted) {
230 this._logService.trace(`MCP server ${definition.id} is trusted, no trust prompt needed`);
231 return true;
232 > } else if (collection.trustBehavior === McpServerTrust.Kind.TrustedOnNonce) { mcpRegistry.ts
233 if (definition.cacheNonce === trustNonceBearer.trustedAtNonce) {
234 this._logService.trace(`MCP server ${definition.id} is unchanged, no trust prompt needed`);
276 assertNever(collection.trustBehavior);
277 }
278 > } mcpRegistry.ts
279
280 private async _promptForTrust(definition: McpServerDefinition, collection: McpCollectionDefinition, interaction: McpStartServerInteraction | undefined, trustNonceBearer: { trustedAtNonce: string | undefined }): Promise<boolean> {
486
487 public async resolveConnection(opts: IMcpResolveConnectionOptions): Promise<IMcpServerConnection | undefined> {
488 > const { collectionRef, definitionRef, interaction, logger, debug } = opts; mcpRegistry.ts
489 > let collection = this._collections.get().find(c => c.id === collectionRef.id);
490 > if (collection?.lazy) {
491 await collection.lazy.load();
492 collection = this._collections.get().find(c => c.id === collectionRef.id);
493 }
495 > const definition = collection?.serverDefinitions.get().find(s => s.id === definitionRef.id);
496 > if (!collection || !definition) {
497 throw new Error(`Collection or definition not found for ${collectionRef.id} and ${definitionRef.id}`);
498 }
500 > const delegate = this._delegates.get().find(d => d.canStart(collection, definition));
501 > if (!delegate) {
502 throw new Error('No delegate found that can handle the connection');
503 }
505 > const trusted = await this._checkTrust(collection, definition, opts);
506 > interaction?.participants.set(definition.id, { s: 'resolved' });
507 > if (!trusted) {
508 return undefined;
509 }
520 launch = await this._replaceVariablesInLaunch(delegate, definition, launch, opts.errorOnUserInteraction);
521
522 > if (definition.devMode && debug) { mcpRegistry.ts
523 launch = await this._instantiationService.invokeFunction(accessor => accessor.get(IMcpDevModeDebugging).transform(definition, launch!));
524 }
525 // If sandbox is enabled for this server, attempt to launch in sandbox
526 > launch = await this._mcpSandboxService.launchInSandboxIfEnabled(definition, launch, collection.remoteAuthority ?? undefined, collection.configTarget); mcpRegistry.ts
527 } catch (e) {
528 if (e instanceof UserInteractionRequiredError) {