claudeMcpScan.ts ×4

Frontier kind: Code frontier

unlabeled · c_b124b8a4f5b5

229 tests · 18599 LOC · 67 files · introduces 0 tests · 38 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
4 ranges38 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1832 ranges18599 lines · 67 files · Browse complete extent
All tests (intent)
229 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: 38 introduced LOC across 4 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/claude/customizations/scan/claudeMcpScan.ts 38 introduced LOC · 4 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- claudeMcpScan.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { URI } from '../../../../../../base/common/uri.js';
7 > import { IFileService } from '../../../../../files/common/files.js';
8 > import { makeMcpServerCustomization, readJsonFile } from '../../../../../agentPlugins/common/pluginParsers.js';
9 > import { McpServerStatus, type McpServerCustomization, type McpServerState } from '../../../../common/state/protocol/channels-session/state.js';
10 >
11 > /**
12 > * The JSON files a Claude session reads MCP server declarations from,
13 > * in precedence order (project before user — first-seen wins).
14 > */
15 function claudeMcpFiles(workingDirectory: URI | undefined, userHome: URI): URI[] {
16 const files: URI[] = [];
22 return files;
23 }
25 > /**
26 > * Extracts the `{ name: config }` MCP server map from one parsed JSON
27 > * file. `settings.json` carries many unrelated top-level keys, so we
28 > * ONLY treat its explicit `mcpServers` block as servers. A bare
29 > * `.mcp.json` MAY instead be a flat `{ name: config }` map.
30 > */
31 function extractMcpServerMap(uri: URI, raw: unknown): Record<string, unknown> | undefined {
32 if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
40 return uri.path.endsWith('.mcp.json') ? obj : undefined;
41 }
43 > /**
44 > * Scans a Claude session's `settings.json` / `.mcp.json` files (project +
45 > * user scope) for declared MCP servers and returns them as
46 > * {@link McpServerCustomization} entries pointing at the real source file.
47 > *
48 > * Pre-materialize, the state is {@link McpServerStatus.Stopped} (declared
49 > * but not yet connected). Post-materialize, the live connection status is
50 > * enriched from the SDK's `mcpServerStatus()` by the projector.
51 > */
52 export async function scanClaudeMcpServers(
53 workingDirectory: URI | undefined,
74 return result;
75 }
77 > /**
78 > * Maps an SDK MCP connection status onto the protocol MCP state. Precise
79 > * `Error` / `AuthRequired` states (which carry extra payload) are deferred;
80 > * anything not clearly `connected` / `disabled` reports as `Starting`.
81 > */
82 > export function deriveMcpState(status: string): McpServerState {
83 switch (status) {
84 case 'connected':