mcpResourceFilesystem.ts ×5

Frontier kind: Code frontier

unlabeled · c_c70210436d95

7 tests · 42355 LOC · 190 files · introduces 0 tests · 32 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges32 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4213 ranges42355 lines · 190 files · Browse complete extent
All tests (intent)
7 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.

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

src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.ts 27 introduced LOC · 5 ranges

Open complete file

253
254 private async _readURI(uri: URI, token?: CancellationToken) {
255 > const cached = this._momentaryCache.get(uri); mcpResourceFilesystem.ts
256 > if (cached) {
257 cached.pool.add(token || CancellationToken.None);
258 return cached.promise;
259 }
261 > const pool = this._store.add(new CancellationTokenPool());
262 > pool.add(token || CancellationToken.None);
263 >
264 > const promise = this._readURIInner(uri, pool.token);
265 > this._momentaryCache.set(uri, { pool, promise });
266 >
267 > const disposable = this._store.add(disposableTimeout(() => {
268 this._momentaryCache.delete(uri);
269 this._store.delete(disposable);
270 this._store.delete(pool);
271 > }, MOMENTARY_CACHE_DURATION)); mcpResourceFilesystem.ts
272 >
273 > return promise;
274 > }
275
276 private async _readURIInner(uri: URI, token?: CancellationToken): Promise<IReadData> {
277 > const { resourceURI, server } = this._decodeURI(uri); mcpResourceFilesystem.ts
278 > const matchedServer = this._mcpService.servers.get().find(s => s.definition.id === server.definition.id);
279 >
280 > //check for http/https resources and use web content extractor service to fetch the contents.
281 > if (canLoadMcpNetworkResourceDirectly(resourceURI, matchedServer)) {
282 const extractURI = URI.parse(resourceURI.toString());
283 const result = (await this._webContentExtractorService.extract([extractURI], { followRedirects: false })).at(0);
290 }
291 }
293 > const res = await McpServer.callOn(server, r => r.readResource({ uri: resourceURI.toString() }, token), token);
294 > return {
295 > contents: res.contents,
296 > resourceURI,
297 > forSameURI: res.contents.filter(c => equalsUrlPath(c.uri, resourceURI))
298 > };
299 > }
300 }
301
src/vs/workbench/contrib/mcp/common/mcpTypesUtils.ts 5 introduced LOC · 3 ranges

Open complete file

106 */
107 export function canLoadMcpNetworkResourceDirectly(resource: URL, server: IMcpServer | undefined) {
108 > let isResourceRequestValid = false; mcpTypesUtils.ts
109 > if (resource.protocol === 'http:') {
110 const launch = server?.connection.get()?.launchDefinition;
111 if (launch && launch.type === McpServerTransportType.HTTP && launch.uri.authority.toLowerCase() === resource.host.toLowerCase()) {
112 isResourceRequestValid = true;
113 }
114 > } else if (resource.protocol === 'https:') { mcpTypesUtils.ts
115 isResourceRequestValid = true;
116 }
117 > return isResourceRequestValid; mcpTypesUtils.ts
118 > }
119
120 export function isTaskResult(obj: MCP.Result | MCP.CreateTaskResult): obj is MCP.CreateTaskResult {