@codingame/monaco-vscode-mcp-service-override 20.1.0 → 20.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +15 -15
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/media/mcpServerAction.css +9 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/media/mcpServerEditor.css +21 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/media/mcpServersView.css +13 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpRemoteDiscovery.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpContextKeys.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistryInputStorage.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpResourceFilesystem.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpSamplingService.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.d.ts +96 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpTypesUtils.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/uriTemplate.d.ts +12 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.d.ts +5 -0
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.d.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-mcp-service-override",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - mcp service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,20 +15,20 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-2673c6e2-17c1-5710-b169-46f3d4a28696-common": "20.
|
|
19
|
-
"@codingame/monaco-vscode-4a3ac544-9a61-534c-88df-756262793ef7-common": "20.
|
|
20
|
-
"@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common": "20.
|
|
21
|
-
"@codingame/monaco-vscode-60014c9d-b815-501d-83a9-4b08725c2ec2-common": "20.
|
|
22
|
-
"@codingame/monaco-vscode-62190c26-af1c-5f7a-a364-e05a59cfb7c7-common": "20.
|
|
23
|
-
"@codingame/monaco-vscode-a654b07e-8806-5425-b124-18f03ba8e11a-common": "20.
|
|
24
|
-
"@codingame/monaco-vscode-api": "20.
|
|
25
|
-
"@codingame/monaco-vscode-b994942c-360d-5b68-8a33-77d4bde6b714-common": "20.
|
|
26
|
-
"@codingame/monaco-vscode-c2deffc4-ad68-5e63-8f95-9b89e0fc6898-common": "20.
|
|
27
|
-
"@codingame/monaco-vscode-ce7c734f-7712-563c-9335-d7acb43306af-common": "20.
|
|
28
|
-
"@codingame/monaco-vscode-cf77987b-b1b7-5359-aaf8-a259c63d9f03-common": "20.
|
|
29
|
-
"@codingame/monaco-vscode-d941ac7b-412f-57e3-b1bf-f6b0eb253b21-common": "20.
|
|
30
|
-
"@codingame/monaco-vscode-dc3fa21d-a483-5b99-a7ab-173235644a34-common": "20.
|
|
31
|
-
"@codingame/monaco-vscode-f24e325c-2ce0-5bba-8236-bfc4f53180ab-common": "20.
|
|
18
|
+
"@codingame/monaco-vscode-2673c6e2-17c1-5710-b169-46f3d4a28696-common": "20.2.0",
|
|
19
|
+
"@codingame/monaco-vscode-4a3ac544-9a61-534c-88df-756262793ef7-common": "20.2.0",
|
|
20
|
+
"@codingame/monaco-vscode-501b06ab-3f58-516b-8a1a-c29d375d3da4-common": "20.2.0",
|
|
21
|
+
"@codingame/monaco-vscode-60014c9d-b815-501d-83a9-4b08725c2ec2-common": "20.2.0",
|
|
22
|
+
"@codingame/monaco-vscode-62190c26-af1c-5f7a-a364-e05a59cfb7c7-common": "20.2.0",
|
|
23
|
+
"@codingame/monaco-vscode-a654b07e-8806-5425-b124-18f03ba8e11a-common": "20.2.0",
|
|
24
|
+
"@codingame/monaco-vscode-api": "20.2.0",
|
|
25
|
+
"@codingame/monaco-vscode-b994942c-360d-5b68-8a33-77d4bde6b714-common": "20.2.0",
|
|
26
|
+
"@codingame/monaco-vscode-c2deffc4-ad68-5e63-8f95-9b89e0fc6898-common": "20.2.0",
|
|
27
|
+
"@codingame/monaco-vscode-ce7c734f-7712-563c-9335-d7acb43306af-common": "20.2.0",
|
|
28
|
+
"@codingame/monaco-vscode-cf77987b-b1b7-5359-aaf8-a259c63d9f03-common": "20.2.0",
|
|
29
|
+
"@codingame/monaco-vscode-d941ac7b-412f-57e3-b1bf-f6b0eb253b21-common": "20.2.0",
|
|
30
|
+
"@codingame/monaco-vscode-dc3fa21d-a483-5b99-a7ab-173235644a34-common": "20.2.0",
|
|
31
|
+
"@codingame/monaco-vscode-f24e325c-2ce0-5bba-8236-bfc4f53180ab-common": "20.2.0"
|
|
32
32
|
},
|
|
33
33
|
"main": "index.js",
|
|
34
34
|
"module": "index.js",
|
|
@@ -14,6 +14,7 @@ export declare class McpLanguageFeatures extends Disposable implements IWorkbenc
|
|
|
14
14
|
private readonly _configurationResolverService;
|
|
15
15
|
private readonly _cachedMcpSection;
|
|
16
16
|
constructor(languageFeaturesService: ILanguageFeaturesService, _mcpRegistry: IMcpRegistry, _mcpWorkbenchService: IMcpWorkbenchService, _mcpService: IMcpService, _markerService: IMarkerService, _configurationResolverService: IConfigurationResolverService);
|
|
17
|
+
/** Simple mechanism to avoid extra json parsing for hints+lenses */
|
|
17
18
|
private _parseModel;
|
|
18
19
|
private _addDiagnostics;
|
|
19
20
|
private _provideCodeLenses;
|
|
@@ -1,21 +1,30 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
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
|
+
|
|
1
6
|
.mcp-hover-contents {
|
|
2
7
|
margin-top: 4px;
|
|
3
8
|
margin-bottom: 4px;
|
|
4
9
|
max-width: 250px;
|
|
5
10
|
min-width: 200px;
|
|
6
11
|
}
|
|
12
|
+
|
|
7
13
|
.mcp-hover-contents .mcp-hover-divider {
|
|
8
14
|
margin-top: 8px;
|
|
9
15
|
margin-bottom: 8px;
|
|
10
16
|
}
|
|
17
|
+
|
|
11
18
|
.mcp-hover-contents .mcp-hover-setting {
|
|
12
19
|
display: flex;
|
|
13
20
|
align-items: center;
|
|
14
21
|
margin-top: 6px;
|
|
15
22
|
}
|
|
23
|
+
|
|
16
24
|
.mcp-hover-contents .mcp-hover-setting .monaco-checkbox {
|
|
17
25
|
flex-shrink: 0;
|
|
18
26
|
}
|
|
27
|
+
|
|
19
28
|
.mcp-hover-contents .mcp-hover-setting .mcp-hover-setting-label {
|
|
20
29
|
cursor: pointer;
|
|
21
30
|
color: var(--vscode-foreground);
|
|
@@ -1,31 +1,43 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
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
|
+
|
|
1
6
|
.mcp-server-editor {
|
|
2
7
|
.configuration-content {
|
|
3
8
|
padding: 20px;
|
|
4
9
|
box-sizing: border-box;
|
|
5
10
|
}
|
|
11
|
+
|
|
6
12
|
.config-section {
|
|
7
13
|
margin-bottom: 15px;
|
|
8
14
|
display: flex;
|
|
9
15
|
align-items: flex-start;
|
|
10
16
|
}
|
|
17
|
+
|
|
11
18
|
.config-label {
|
|
12
19
|
font-weight: 600;
|
|
13
20
|
min-width: 80px;
|
|
14
21
|
margin-right: 15px;
|
|
15
22
|
}
|
|
23
|
+
|
|
16
24
|
.config-value {
|
|
17
25
|
word-break: break-all;
|
|
18
26
|
}
|
|
27
|
+
|
|
19
28
|
.no-config {
|
|
20
29
|
color: var(--vscode-descriptionForeground);
|
|
21
30
|
font-style: italic;
|
|
22
31
|
padding: 20px;
|
|
23
32
|
}
|
|
33
|
+
|
|
24
34
|
.manifest-content {
|
|
25
35
|
padding: 20px;
|
|
26
36
|
box-sizing: border-box;
|
|
37
|
+
|
|
27
38
|
.manifest-section {
|
|
28
39
|
margin-bottom: 20px;
|
|
40
|
+
|
|
29
41
|
.manifest-section-title {
|
|
30
42
|
font-size: 26px;
|
|
31
43
|
display: inline-block;
|
|
@@ -41,8 +53,11 @@
|
|
|
41
53
|
text-overflow: ellipsis;
|
|
42
54
|
}
|
|
43
55
|
}
|
|
56
|
+
|
|
44
57
|
.package-section {
|
|
58
|
+
|
|
45
59
|
margin-top: 10px;
|
|
60
|
+
|
|
46
61
|
.package-section-title {
|
|
47
62
|
margin-bottom: 5px;
|
|
48
63
|
font-size: 1.4em;
|
|
@@ -50,6 +65,7 @@
|
|
|
50
65
|
border-bottom: 1px solid var(--vscode-panelSection-border);
|
|
51
66
|
padding: 5px;
|
|
52
67
|
}
|
|
68
|
+
|
|
53
69
|
.package-details {
|
|
54
70
|
padding-left: 10px;
|
|
55
71
|
.package-detail {
|
|
@@ -59,15 +75,20 @@
|
|
|
59
75
|
align-items: start;
|
|
60
76
|
padding: 8px 0px;
|
|
61
77
|
}
|
|
78
|
+
|
|
62
79
|
.package-separator {
|
|
63
80
|
margin-top: 10px;
|
|
64
81
|
border-bottom: 1px solid var(--vscode-panelSection-border);
|
|
65
82
|
}
|
|
66
83
|
}
|
|
67
84
|
}
|
|
85
|
+
|
|
86
|
+
|
|
68
87
|
.no-manifest {
|
|
69
88
|
font-style: italic;
|
|
70
89
|
padding: 20px;
|
|
71
90
|
}
|
|
72
91
|
}
|
|
92
|
+
|
|
93
|
+
|
|
73
94
|
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
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
|
+
|
|
1
6
|
.mcp-welcome-container {
|
|
2
7
|
height: 100%;
|
|
3
8
|
width: 100%;
|
|
9
|
+
|
|
4
10
|
&.hide {
|
|
5
11
|
display: none;
|
|
6
12
|
}
|
|
13
|
+
|
|
7
14
|
.mcp-welcome-content {
|
|
8
15
|
display: flex;
|
|
9
16
|
flex-direction: column;
|
|
@@ -12,29 +19,35 @@
|
|
|
12
19
|
padding: 0px 40px;
|
|
13
20
|
text-align: center;
|
|
14
21
|
margin: 20px auto;
|
|
22
|
+
|
|
15
23
|
.mcp-welcome-icon {
|
|
16
24
|
.codicon {
|
|
17
25
|
font-size: 48px;
|
|
18
26
|
}
|
|
19
27
|
}
|
|
28
|
+
|
|
20
29
|
.mcp-welcome-title {
|
|
21
30
|
font-size: 24px;
|
|
22
31
|
margin-top: 5px;
|
|
23
32
|
font-weight: 500;
|
|
24
33
|
line-height: normal;
|
|
25
34
|
}
|
|
35
|
+
|
|
26
36
|
.mcp-welcome-description {
|
|
27
37
|
max-width: 350px;
|
|
28
38
|
padding: 0 20px;
|
|
29
39
|
margin-top: 16px;
|
|
40
|
+
|
|
30
41
|
a {
|
|
31
42
|
color: var(--vscode-textLink-foreground);
|
|
32
43
|
}
|
|
33
44
|
}
|
|
45
|
+
|
|
34
46
|
.mcp-welcome-button-container {
|
|
35
47
|
margin-top: 16px;
|
|
36
48
|
max-width: 320px;
|
|
37
49
|
width: 100%;
|
|
38
50
|
}
|
|
51
|
+
|
|
39
52
|
}
|
|
40
53
|
}
|
package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ export declare abstract class FilesystemMcpDiscovery extends Disposable {
|
|
|
25
25
|
protected _isDiscoveryEnabled(reader: IReader, discoverySource: DiscoverySource | undefined): boolean;
|
|
26
26
|
protected watchFile(file: URI, collection: WritableMcpCollectionDefinition, discoverySource: DiscoverySource | undefined, adaptFile: (contents: VSBuffer) => Promise<McpServerDefinition[] | undefined>): IDisposable;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Base class that discovers MCP servers on a filesystem, outside of the ones
|
|
30
|
+
* defined in VS Code settings.
|
|
31
|
+
*/
|
|
28
32
|
export declare abstract class NativeFilesystemMcpDiscovery extends FilesystemMcpDiscovery implements IMcpDiscovery {
|
|
29
33
|
private readonly adapters;
|
|
30
34
|
private suffix;
|
|
@@ -6,6 +6,9 @@ import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log
|
|
|
6
6
|
import { IRemoteAgentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service";
|
|
7
7
|
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
8
8
|
import { NativeFilesystemMcpDiscovery } from "./nativeMcpDiscoveryAbstract.js";
|
|
9
|
+
/**
|
|
10
|
+
* Discovers MCP servers on the remote filesystem, if any.
|
|
11
|
+
*/
|
|
9
12
|
export declare class RemoteNativeMpcDiscovery extends NativeFilesystemMcpDiscovery {
|
|
10
13
|
private readonly remoteAgent;
|
|
11
14
|
private readonly logService;
|
|
@@ -6,6 +6,13 @@ import { IMcpService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/co
|
|
|
6
6
|
export declare namespace McpContextKeys {
|
|
7
7
|
const serverCount: RawContextKey<number>;
|
|
8
8
|
const hasUnknownTools: RawContextKey<boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* A context key that indicates whether there are any servers with errors.
|
|
11
|
+
*
|
|
12
|
+
* @type {boolean}
|
|
13
|
+
* @default undefined
|
|
14
|
+
* @description This key is used to track the presence of servers with errors in the MCP context.
|
|
15
|
+
*/
|
|
9
16
|
const hasServersWithErrors: RawContextKey<boolean>;
|
|
10
17
|
const toolsCount: RawContextKey<number>;
|
|
11
18
|
}
|
|
@@ -58,6 +58,11 @@ export declare class McpRegistry extends Disposable implements IMcpRegistry {
|
|
|
58
58
|
}>;
|
|
59
59
|
private _checkTrust;
|
|
60
60
|
private _promptForTrust;
|
|
61
|
+
/**
|
|
62
|
+
* Confirms with the user which of the provided definitions should be trusted.
|
|
63
|
+
* Returns undefined if the user cancelled the flow, or the list of trusted
|
|
64
|
+
* definition IDs otherwise.
|
|
65
|
+
*/
|
|
61
66
|
protected _promptForTrustOpenDialog(definitions: {
|
|
62
67
|
definition: McpServerDefinition;
|
|
63
68
|
collection: McpCollectionDefinition;
|
|
@@ -15,12 +15,17 @@ export declare class McpRegistryInputStorage extends Disposable {
|
|
|
15
15
|
private _didChange;
|
|
16
16
|
private _record;
|
|
17
17
|
constructor(_scope: StorageScope, _target: StorageTarget, _storageService: IStorageService, _secretStorageService: ISecretStorageService, _logService: ILogService);
|
|
18
|
+
/** Deletes all collection data from storage. */
|
|
18
19
|
clearAll(): void;
|
|
20
|
+
/** Delete a single collection data from the storage. */
|
|
19
21
|
clear(inputKey: string): Promise<void>;
|
|
22
|
+
/** Gets a mapping of saved input data. */
|
|
20
23
|
getMap(): Promise<{
|
|
21
24
|
[x: string]: IResolvedValue;
|
|
22
25
|
}>;
|
|
26
|
+
/** Updates the input data mapping. */
|
|
23
27
|
setPlainText(values: Record<string, IResolvedValue>): Promise<void>;
|
|
28
|
+
/** Updates the input secrets mapping. */
|
|
24
29
|
setSecrets(values: Record<string, IResolvedValue>): Promise<void>;
|
|
25
30
|
private _sealSecrets;
|
|
26
31
|
private _unsealSecrets;
|
|
@@ -10,6 +10,7 @@ import { IWorkbenchContribution } from "@codingame/monaco-vscode-api/vscode/vs/w
|
|
|
10
10
|
export declare class McpResourceFilesystem extends Disposable implements IWorkbenchContribution, IFileSystemProviderWithFileReadWriteCapability, IFileSystemProviderWithFileAtomicReadCapability, IFileSystemProviderWithFileReadStreamCapability {
|
|
11
11
|
private readonly _instantiationService;
|
|
12
12
|
private readonly _fileService;
|
|
13
|
+
/** Defer getting the MCP service since this is a BlockRestore and no need to make it unnecessarily. */
|
|
13
14
|
private readonly _mcpServiceLazy;
|
|
14
15
|
private get _mcpService();
|
|
15
16
|
readonly onDidChangeCapabilities: Event<any>;
|
|
@@ -26,9 +26,23 @@ export declare class McpSamplingService extends Disposable implements IMcpSampli
|
|
|
26
26
|
private allowButtons;
|
|
27
27
|
private _showContextual;
|
|
28
28
|
private _notify;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the matching model for the MCP server in this context, or
|
|
31
|
+
* a reason why no model could be selected.
|
|
32
|
+
*/
|
|
29
33
|
private _getMatchingModelInner;
|
|
30
34
|
private _configKey;
|
|
31
35
|
getConfig(server: IMcpServer): IMcpServerSamplingConfiguration;
|
|
36
|
+
/**
|
|
37
|
+
* _getConfig reads the sampling config reads the `{ server: data }` mapping
|
|
38
|
+
* from the appropriate config. We read from the most specific possible
|
|
39
|
+
* config up to the default configuration location that the MCP server itself
|
|
40
|
+
* is defined in. We don't go further because then workspace-specific servers
|
|
41
|
+
* would get in the user settings which is not meaningful and could lead
|
|
42
|
+
* to confusion.
|
|
43
|
+
*
|
|
44
|
+
* todo@connor4312: generalize this for other esttings when we have them
|
|
45
|
+
*/
|
|
32
46
|
private _getConfig;
|
|
33
47
|
updateConfig(server: IMcpServer, mutate: (r: IMcpServerSamplingConfiguration) => unknown): Promise<{
|
|
34
48
|
allowedDuringChat?: boolean;
|
|
@@ -26,8 +26,11 @@ interface IToolCacheEntry {
|
|
|
26
26
|
readonly serverInstructions: string | undefined;
|
|
27
27
|
readonly trustedAtNonce: string | undefined;
|
|
28
28
|
readonly nonce: string | undefined;
|
|
29
|
+
/** Cached tools so we can show what's available before it's started */
|
|
29
30
|
readonly tools: readonly IValidatedMcpTool[];
|
|
31
|
+
/** Cached prompts */
|
|
30
32
|
readonly prompts: readonly MCP.Prompt[] | undefined;
|
|
33
|
+
/** Cached capabilities */
|
|
31
34
|
readonly capabilities: McpCapability | undefined;
|
|
32
35
|
}
|
|
33
36
|
interface IServerCacheEntry {
|
|
@@ -38,13 +41,23 @@ export declare class McpServerMetadataCache extends Disposable {
|
|
|
38
41
|
private readonly cache;
|
|
39
42
|
private readonly extensionServers;
|
|
40
43
|
constructor(scope: StorageScope, storageService: IStorageService);
|
|
44
|
+
/** Resets the cache for primitives and extension servers */
|
|
41
45
|
reset(): void;
|
|
46
|
+
/** Gets cached primitives for a server (used before a server is running) */
|
|
42
47
|
get(definitionId: string): IToolCacheEntry | undefined;
|
|
48
|
+
/** Sets cached primitives for a server */
|
|
43
49
|
store(definitionId: string, entry: Partial<IToolCacheEntry>): void;
|
|
50
|
+
/** Gets cached servers for a collection (used for extensions, before the extension activates) */
|
|
44
51
|
getServers(collectionId: string): IServerCacheEntry | undefined;
|
|
52
|
+
/** Sets cached servers for a collection */
|
|
45
53
|
storeServers(collectionId: string, entry: IServerCacheEntry | undefined): void;
|
|
46
54
|
}
|
|
47
55
|
interface IValidatedMcpTool extends MCP.Tool {
|
|
56
|
+
/**
|
|
57
|
+
* Tool name as published by the MCP server. This may
|
|
58
|
+
* be different than the one in {@link definition} due to name normalization
|
|
59
|
+
* in {@link McpServer._getValidatedTools}.
|
|
60
|
+
*/
|
|
48
61
|
serverToolName: string;
|
|
49
62
|
}
|
|
50
63
|
interface ServerMetadata {
|
|
@@ -68,6 +81,10 @@ export declare class McpServer extends Disposable implements IMcpServer {
|
|
|
68
81
|
private readonly _samplingService;
|
|
69
82
|
private readonly _elicitationService;
|
|
70
83
|
private readonly _remoteAuthorityResolverService;
|
|
84
|
+
/**
|
|
85
|
+
* Helper function to call the function on the handler once it's online. The
|
|
86
|
+
* connection started if it is not already.
|
|
87
|
+
*/
|
|
71
88
|
static callOn<R>(server: IMcpServer, fn: (handler: McpServerRequestHandler) => Promise<R>, token?: CancellationToken): Promise<R>;
|
|
72
89
|
private readonly _connectionSequencer;
|
|
73
90
|
private readonly _connection;
|
|
@@ -88,6 +105,7 @@ export declare class McpServer extends Disposable implements IMcpServer {
|
|
|
88
105
|
private readonly _loggerId;
|
|
89
106
|
private readonly _logger;
|
|
90
107
|
private _lastModeDebugged;
|
|
108
|
+
/** Count of running tool calls, used to detect if sampling is during an LM call */
|
|
91
109
|
runningToolCalls: Set<IMcpToolCallContext>;
|
|
92
110
|
constructor(collection: McpCollectionReference, definition: McpDefinitionReference, explicitRoots: URI[] | undefined, _requiresExtensionActivation: boolean | undefined, _primitiveCache: McpServerMetadataCache, toolPrefix: string, _mcpRegistry: IMcpRegistry, workspacesService: IWorkspaceContextService, _extensionService: IExtensionService, _loggerService: ILoggerService, _outputService: IOutputService, _telemetryService: ITelemetryService, _commandService: ICommandService, _instantiationService: IInstantiationService, _notificationService: INotificationService, _openerService: IOpenerService, _samplingService: IMcpSamplingService, _elicitationService: IMcpElicitationService, _remoteAuthorityResolverService: IRemoteAuthorityResolverService);
|
|
93
111
|
readDefinitions(): IObservable<{
|
|
@@ -18,6 +18,7 @@ export declare class McpServerConnection extends Disposable implements IMcpServe
|
|
|
18
18
|
readonly state: IObservable<McpConnectionState>;
|
|
19
19
|
readonly handler: IObservable<McpServerRequestHandler | undefined>;
|
|
20
20
|
constructor(_collection: McpCollectionDefinition, definition: McpServerDefinition, _delegate: IMcpHostDelegate, launchDefinition: McpServerLaunch, _logger: ILogger, _instantiationService: IInstantiationService);
|
|
21
|
+
/** @inheritdoc */
|
|
21
22
|
start(methods: IMcpClientMethods): Promise<McpConnectionState>;
|
|
22
23
|
private adoptLaunch;
|
|
23
24
|
stop(): Promise<void>;
|
|
@@ -10,10 +10,19 @@ export interface McpRoot {
|
|
|
10
10
|
name?: string;
|
|
11
11
|
}
|
|
12
12
|
export interface IMcpServerRequestHandlerOptions extends IMcpClientMethods {
|
|
13
|
+
/** MCP message transport */
|
|
13
14
|
launch: IMcpMessageTransport;
|
|
15
|
+
/** Logger instance. */
|
|
14
16
|
logger: ILogger;
|
|
17
|
+
/** Log level MCP messages is logged at */
|
|
15
18
|
requestLogLevel?: LogLevel;
|
|
16
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Request handler for communicating with an MCP server.
|
|
22
|
+
*
|
|
23
|
+
* Handles sending requests and receiving responses, with automatic
|
|
24
|
+
* handling of ping requests and typed client request methods.
|
|
25
|
+
*/
|
|
17
26
|
export declare class McpServerRequestHandler extends Disposable {
|
|
18
27
|
private _nextRequestId;
|
|
19
28
|
private readonly _pendingRequests;
|
|
@@ -36,6 +45,10 @@ export declare class McpServerRequestHandler extends Disposable {
|
|
|
36
45
|
readonly onDidChangeToolList: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
37
46
|
private readonly _onDidChangePromptList;
|
|
38
47
|
readonly onDidChangePromptList: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Connects to the MCP server and does the initialization handshake.
|
|
50
|
+
* @throws MpcResponseError if the server fails to initialize.
|
|
51
|
+
*/
|
|
39
52
|
static create(instaService: IInstantiationService, opts: IMcpServerRequestHandlerOptions, token?: CancellationToken): Promise<McpServerRequestHandler>;
|
|
40
53
|
readonly logger: ILogger;
|
|
41
54
|
private readonly _launch;
|
|
@@ -43,34 +56,117 @@ export declare class McpServerRequestHandler extends Disposable {
|
|
|
43
56
|
private readonly _createMessageRequestHandler;
|
|
44
57
|
private readonly _elicitationRequestHandler;
|
|
45
58
|
protected constructor({ launch, logger, createMessageRequestHandler, elicitationRequestHandler, requestLogLevel, }: IMcpServerRequestHandlerOptions);
|
|
59
|
+
/**
|
|
60
|
+
* Send a client request to the server and return the response.
|
|
61
|
+
*
|
|
62
|
+
* @param request The request to send
|
|
63
|
+
* @param token Cancellation token
|
|
64
|
+
* @param timeoutMs Optional timeout in milliseconds
|
|
65
|
+
* @returns A promise that resolves with the response
|
|
66
|
+
*/
|
|
46
67
|
private sendRequest;
|
|
47
68
|
private send;
|
|
69
|
+
/**
|
|
70
|
+
* Handles paginated requests by making multiple requests until all items are retrieved.
|
|
71
|
+
*
|
|
72
|
+
* @param method The method name to call
|
|
73
|
+
* @param getItems Function to extract the array of items from a result
|
|
74
|
+
* @param initialParams Initial parameters
|
|
75
|
+
* @param token Cancellation token
|
|
76
|
+
* @returns Promise with all items combined
|
|
77
|
+
*/
|
|
48
78
|
private sendRequestPaginated;
|
|
49
79
|
private sendNotification;
|
|
80
|
+
/**
|
|
81
|
+
* Handle incoming messages from the server
|
|
82
|
+
*/
|
|
50
83
|
private handleMessage;
|
|
84
|
+
/**
|
|
85
|
+
* Handle successful responses
|
|
86
|
+
*/
|
|
51
87
|
private handleResult;
|
|
88
|
+
/**
|
|
89
|
+
* Handle error responses
|
|
90
|
+
*/
|
|
52
91
|
private handleError;
|
|
92
|
+
/**
|
|
93
|
+
* Handle incoming server requests
|
|
94
|
+
*/
|
|
53
95
|
private handleServerRequest;
|
|
96
|
+
/**
|
|
97
|
+
* Handle incoming server notifications
|
|
98
|
+
*/
|
|
54
99
|
private handleServerNotification;
|
|
55
100
|
private handleCancelledNotification;
|
|
56
101
|
private handleLoggingNotification;
|
|
102
|
+
/**
|
|
103
|
+
* Send a generic response to a request
|
|
104
|
+
*/
|
|
57
105
|
private respondToRequest;
|
|
106
|
+
/**
|
|
107
|
+
* Send a response to a ping request
|
|
108
|
+
*/
|
|
58
109
|
private handlePing;
|
|
110
|
+
/**
|
|
111
|
+
* Send a response to a roots/list request
|
|
112
|
+
*/
|
|
59
113
|
private handleRootsList;
|
|
60
114
|
private cancelAllRequests;
|
|
61
115
|
dispose(): void;
|
|
116
|
+
/**
|
|
117
|
+
* Forwards log level changes to the MCP server if it supports logging
|
|
118
|
+
*/
|
|
62
119
|
private _sendLogLevelToServer;
|
|
120
|
+
/**
|
|
121
|
+
* Send an initialize request
|
|
122
|
+
*/
|
|
63
123
|
initialize(params: MCP.InitializeRequest["params"], token?: CancellationToken): Promise<MCP.InitializeResult>;
|
|
124
|
+
/**
|
|
125
|
+
* List available resources
|
|
126
|
+
*/
|
|
64
127
|
listResources(params?: MCP.ListResourcesRequest["params"], token?: CancellationToken): Promise<MCP.Resource[]>;
|
|
128
|
+
/**
|
|
129
|
+
* List available resources (iterable)
|
|
130
|
+
*/
|
|
65
131
|
listResourcesIterable(params?: MCP.ListResourcesRequest["params"], token?: CancellationToken): AsyncIterable<MCP.Resource[]>;
|
|
132
|
+
/**
|
|
133
|
+
* Read a specific resource
|
|
134
|
+
*/
|
|
66
135
|
readResource(params: MCP.ReadResourceRequest["params"], token?: CancellationToken): Promise<MCP.ReadResourceResult>;
|
|
136
|
+
/**
|
|
137
|
+
* List available resource templates
|
|
138
|
+
*/
|
|
67
139
|
listResourceTemplates(params?: MCP.ListResourceTemplatesRequest["params"], token?: CancellationToken): Promise<MCP.ResourceTemplate[]>;
|
|
140
|
+
/**
|
|
141
|
+
* Subscribe to resource updates
|
|
142
|
+
*/
|
|
68
143
|
subscribe(params: MCP.SubscribeRequest["params"], token?: CancellationToken): Promise<MCP.EmptyResult>;
|
|
144
|
+
/**
|
|
145
|
+
* Unsubscribe from resource updates
|
|
146
|
+
*/
|
|
69
147
|
unsubscribe(params: MCP.UnsubscribeRequest["params"], token?: CancellationToken): Promise<MCP.EmptyResult>;
|
|
148
|
+
/**
|
|
149
|
+
* List available prompts
|
|
150
|
+
*/
|
|
70
151
|
listPrompts(params?: MCP.ListPromptsRequest["params"], token?: CancellationToken): Promise<MCP.Prompt[]>;
|
|
152
|
+
/**
|
|
153
|
+
* Get a specific prompt
|
|
154
|
+
*/
|
|
71
155
|
getPrompt(params: MCP.GetPromptRequest["params"], token?: CancellationToken): Promise<MCP.GetPromptResult>;
|
|
156
|
+
/**
|
|
157
|
+
* List available tools
|
|
158
|
+
*/
|
|
72
159
|
listTools(params?: MCP.ListToolsRequest["params"], token?: CancellationToken): Promise<MCP.Tool[]>;
|
|
160
|
+
/**
|
|
161
|
+
* Call a specific tool
|
|
162
|
+
*/
|
|
73
163
|
callTool(params: MCP.CallToolRequest["params"] & MCP.Request["params"], token?: CancellationToken): Promise<MCP.CallToolResult>;
|
|
164
|
+
/**
|
|
165
|
+
* Set the logging level
|
|
166
|
+
*/
|
|
74
167
|
setLevel(params: MCP.SetLevelRequest["params"], token?: CancellationToken): Promise<MCP.EmptyResult>;
|
|
168
|
+
/**
|
|
169
|
+
* Find completions for an argument
|
|
170
|
+
*/
|
|
75
171
|
complete(params: MCP.CompleteRequest["params"], token?: CancellationToken): Promise<MCP.CompleteResult>;
|
|
76
172
|
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
2
|
import { IMcpServer, IMcpServerStartOpts } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
3
3
|
import { IMcpService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes.service";
|
|
4
|
+
/**
|
|
5
|
+
* Waits up to `timeout` for a server passing the filter to be discovered,
|
|
6
|
+
* and then starts it.
|
|
7
|
+
*/
|
|
4
8
|
export declare function startServerByFilter(mcpService: IMcpService, filter: (s: IMcpServer) => boolean, timeout?: number): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Starts a server (if needed) and waits for its tools to be live. Returns
|
|
11
|
+
* true/false whether this happened successfully.
|
|
12
|
+
*/
|
|
5
13
|
export declare function startServerAndWaitForLiveTools(server: IMcpServer, opts?: IMcpServerStartOpts, token?: CancellationToken): Promise<boolean>;
|
|
@@ -10,13 +10,25 @@ interface IUriTemplateComponent {
|
|
|
10
10
|
readonly operator: string;
|
|
11
11
|
readonly variables: readonly IUriTemplateVariable[];
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Represents an RFC 6570 URI Template.
|
|
15
|
+
*/
|
|
13
16
|
export declare class UriTemplate {
|
|
14
17
|
readonly template: string;
|
|
18
|
+
/**
|
|
19
|
+
* The parsed template components (expressions).
|
|
20
|
+
*/
|
|
15
21
|
readonly components: ReadonlyArray<IUriTemplateComponent | string>;
|
|
16
22
|
private constructor();
|
|
23
|
+
/**
|
|
24
|
+
* Parses a URI template string into a UriTemplate instance.
|
|
25
|
+
*/
|
|
17
26
|
static parse(template: string): UriTemplate;
|
|
18
27
|
private static _operators;
|
|
19
28
|
private static _isOperator;
|
|
29
|
+
/**
|
|
30
|
+
* Resolves the template with the given variables.
|
|
31
|
+
*/
|
|
20
32
|
resolve(variables: Record<string, unknown>): string;
|
|
21
33
|
private _expand;
|
|
22
34
|
private static _encode;
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpAccessService.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ import { IAuthenticationMcpAccessService } from "@codingame/monaco-vscode-api/vs
|
|
|
6
6
|
export interface AllowedMcpServer {
|
|
7
7
|
id: string;
|
|
8
8
|
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* If true or undefined, the extension is allowed to use the account
|
|
11
|
+
* If false, the extension is not allowed to use the account
|
|
12
|
+
* TODO: undefined shouldn't be a valid value, but it is for now
|
|
13
|
+
*/
|
|
9
14
|
allowed?: boolean;
|
|
10
15
|
lastUsed?: number;
|
|
11
16
|
trusted?: boolean;
|
package/vscode/src/vs/workbench/services/authentication/browser/authenticationMcpService.d.ts
CHANGED
|
@@ -44,6 +44,9 @@ export declare class AuthenticationMcpService extends Disposable implements IAut
|
|
|
44
44
|
removeSessionPreference(providerId: string, mcpServerId: string, scopes: string[]): void;
|
|
45
45
|
private _updateAccountAndSessionPreferences;
|
|
46
46
|
private showGetSessionPrompt;
|
|
47
|
+
/**
|
|
48
|
+
* This function should be used only when there are sessions to disambiguate.
|
|
49
|
+
*/
|
|
47
50
|
selectSession(providerId: string, mcpServerId: string, mcpServerName: string, scopes: string[], availableSessions: AuthenticationSession[]): Promise<AuthenticationSession>;
|
|
48
51
|
private completeSessionAccessRequest;
|
|
49
52
|
requestSessionAccess(providerId: string, mcpServerId: string, mcpServerName: string, scopes: string[], possibleSessions: AuthenticationSession[]): void;
|