@codingame/monaco-vscode-mcp-service-override 16.0.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/index.d.ts +2 -0
- package/index.js +20 -0
- package/package.json +50 -0
- package/vscode/src/vs/platform/mcp/common/nativeMcpDiscoveryHelper.d.ts +9 -0
- package/vscode/src/vs/platform/mcp/common/nativeMcpDiscoveryHelper.js +5 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcp.contribution.js +47 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpDiscovery.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpDiscovery.js +36 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpLanguageFeatures.js +340 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/configMcpDiscovery.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/configMcpDiscovery.js +146 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/extensionMcpDiscovery.js +108 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/mcpDiscovery.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/mcpDiscovery.js +16 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAbstract.js +134 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpDiscoveryAdapters.js +79 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpRemoteDiscovery.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/nativeMcpRemoteDiscovery.js +44 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceMcpDiscoveryAdapter.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/discovery/workspaceMcpDiscoveryAdapter.js +68 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpConfigFileUtils.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpConfigFileUtils.js +30 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpConfigPathsService.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpConfigPathsService.js +112 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.d.ts +59 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistry.js +322 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistryInputStorage.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpRegistryInputStorage.js +134 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.d.ts +77 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServer.js +383 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerConnection.js +114 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.d.ts +63 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpServerRequestHandler.js +318 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/mcpService.js +220 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocol.d.ts +374 -0
- package/vscode/src/vs/workbench/contrib/mcp/common/modelContextProtocol.js +14 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
3
|
+
import { ISecretStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/secrets/common/secrets.service";
|
|
4
|
+
import { StorageScope, StorageTarget } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage";
|
|
5
|
+
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
6
|
+
import { IResolvedValue } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolverExpression";
|
|
7
|
+
export declare class McpRegistryInputStorage extends Disposable {
|
|
8
|
+
private readonly _scope;
|
|
9
|
+
private readonly _storageService;
|
|
10
|
+
private readonly _secretStorageService;
|
|
11
|
+
private readonly _logService;
|
|
12
|
+
private static secretSequencer;
|
|
13
|
+
private readonly _secretsSealerSequencer;
|
|
14
|
+
private readonly _getEncryptionKey;
|
|
15
|
+
private _didChange;
|
|
16
|
+
private _record;
|
|
17
|
+
constructor(_scope: StorageScope, _target: StorageTarget, _storageService: IStorageService, _secretStorageService: ISecretStorageService, _logService: ILogService);
|
|
18
|
+
clearAll(): void;
|
|
19
|
+
clear(inputKey: string): Promise<void>;
|
|
20
|
+
getMap(): Promise<{
|
|
21
|
+
[x: string]: IResolvedValue;
|
|
22
|
+
}>;
|
|
23
|
+
setPlainText(values: Record<string, IResolvedValue>): Promise<void>;
|
|
24
|
+
setSecrets(values: Record<string, IResolvedValue>): Promise<void>;
|
|
25
|
+
private _sealSecrets;
|
|
26
|
+
private _unsealSecrets;
|
|
27
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Sequencer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
|
+
import { encodeBase64, VSBuffer, decodeBase64 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
5
|
+
import { Lazy } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lazy';
|
|
6
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { isEmptyObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
8
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
9
|
+
import { ISecretStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/secrets/common/secrets.service';
|
|
10
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
11
|
+
|
|
12
|
+
var McpRegistryInputStorage_1;
|
|
13
|
+
const MCP_ENCRYPTION_KEY_NAME = 'mcpEncryptionKey';
|
|
14
|
+
const MCP_ENCRYPTION_KEY_ALGORITHM = 'AES-GCM';
|
|
15
|
+
const MCP_ENCRYPTION_KEY_LEN = 256;
|
|
16
|
+
const MCP_ENCRYPTION_IV_LENGTH = 12;
|
|
17
|
+
const MCP_DATA_STORED_VERSION = 1;
|
|
18
|
+
const MCP_DATA_STORED_KEY = 'mcpInputs';
|
|
19
|
+
let McpRegistryInputStorage = class McpRegistryInputStorage extends Disposable {
|
|
20
|
+
static { McpRegistryInputStorage_1 = this; }
|
|
21
|
+
static { this.secretSequencer = ( new Sequencer()); }
|
|
22
|
+
constructor(_scope, _target, _storageService, _secretStorageService, _logService) {
|
|
23
|
+
super();
|
|
24
|
+
this._scope = _scope;
|
|
25
|
+
this._storageService = _storageService;
|
|
26
|
+
this._secretStorageService = _secretStorageService;
|
|
27
|
+
this._logService = _logService;
|
|
28
|
+
this._secretsSealerSequencer = ( new Sequencer());
|
|
29
|
+
this._getEncryptionKey = ( new Lazy(() => {
|
|
30
|
+
return McpRegistryInputStorage_1.secretSequencer.queue(async () => {
|
|
31
|
+
const existing = await this._secretStorageService.get(MCP_ENCRYPTION_KEY_NAME);
|
|
32
|
+
if (existing) {
|
|
33
|
+
try {
|
|
34
|
+
const parsed = JSON.parse(existing);
|
|
35
|
+
return await crypto.subtle.importKey('jwk', parsed, MCP_ENCRYPTION_KEY_ALGORITHM, false, ['encrypt', 'decrypt']);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const key = await crypto.subtle.generateKey({ name: MCP_ENCRYPTION_KEY_ALGORITHM, length: MCP_ENCRYPTION_KEY_LEN }, true, ['encrypt', 'decrypt']);
|
|
41
|
+
const exported = await crypto.subtle.exportKey('jwk', key);
|
|
42
|
+
await this._secretStorageService.set(MCP_ENCRYPTION_KEY_NAME, JSON.stringify(exported));
|
|
43
|
+
return key;
|
|
44
|
+
});
|
|
45
|
+
}));
|
|
46
|
+
this._didChange = false;
|
|
47
|
+
this._record = ( new Lazy(() => {
|
|
48
|
+
const stored = this._storageService.getObject(MCP_DATA_STORED_KEY, this._scope);
|
|
49
|
+
return stored?.version === MCP_DATA_STORED_VERSION ? { ...stored } : { version: MCP_DATA_STORED_VERSION, values: {} };
|
|
50
|
+
}));
|
|
51
|
+
this._register(_storageService.onWillSaveState(() => {
|
|
52
|
+
if (this._didChange) {
|
|
53
|
+
this._storageService.store(MCP_DATA_STORED_KEY, {
|
|
54
|
+
version: MCP_DATA_STORED_VERSION,
|
|
55
|
+
values: this._record.value.values,
|
|
56
|
+
secrets: this._record.value.secrets,
|
|
57
|
+
}, this._scope, _target);
|
|
58
|
+
this._didChange = false;
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
clearAll() {
|
|
63
|
+
this._record.value.values = {};
|
|
64
|
+
this._record.value.secrets = undefined;
|
|
65
|
+
this._record.value.unsealedSecrets = undefined;
|
|
66
|
+
this._didChange = true;
|
|
67
|
+
}
|
|
68
|
+
async clear(inputKey) {
|
|
69
|
+
const secrets = await this._unsealSecrets();
|
|
70
|
+
delete this._record.value.values[inputKey];
|
|
71
|
+
this._didChange = true;
|
|
72
|
+
if (secrets.hasOwnProperty(inputKey)) {
|
|
73
|
+
delete secrets[inputKey];
|
|
74
|
+
await this._sealSecrets();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async getMap() {
|
|
78
|
+
const secrets = await this._unsealSecrets();
|
|
79
|
+
return { ...this._record.value.values, ...secrets };
|
|
80
|
+
}
|
|
81
|
+
async setPlainText(values) {
|
|
82
|
+
Object.assign(this._record.value.values, values);
|
|
83
|
+
this._didChange = true;
|
|
84
|
+
}
|
|
85
|
+
async setSecrets(values) {
|
|
86
|
+
const unsealed = await this._unsealSecrets();
|
|
87
|
+
Object.assign(unsealed, values);
|
|
88
|
+
await this._sealSecrets();
|
|
89
|
+
}
|
|
90
|
+
async _sealSecrets() {
|
|
91
|
+
const key = await this._getEncryptionKey.value;
|
|
92
|
+
return this._secretsSealerSequencer.queue(async () => {
|
|
93
|
+
if (!this._record.value.unsealedSecrets || isEmptyObject(this._record.value.unsealedSecrets)) {
|
|
94
|
+
this._record.value.secrets = undefined;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const toSeal = JSON.stringify(this._record.value.unsealedSecrets);
|
|
98
|
+
const iv = crypto.getRandomValues(( new Uint8Array(MCP_ENCRYPTION_IV_LENGTH)));
|
|
99
|
+
const encrypted = await crypto.subtle.encrypt({ name: MCP_ENCRYPTION_KEY_ALGORITHM, iv: iv.buffer }, key, ( new TextEncoder()).encode(toSeal).buffer);
|
|
100
|
+
const enc = encodeBase64(VSBuffer.wrap(( new Uint8Array(encrypted))));
|
|
101
|
+
this._record.value.secrets = { iv: encodeBase64(VSBuffer.wrap(iv)), value: enc };
|
|
102
|
+
this._didChange = true;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async _unsealSecrets() {
|
|
106
|
+
if (!this._record.value.secrets) {
|
|
107
|
+
return this._record.value.unsealedSecrets ??= {};
|
|
108
|
+
}
|
|
109
|
+
if (this._record.value.unsealedSecrets) {
|
|
110
|
+
return this._record.value.unsealedSecrets;
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const key = await this._getEncryptionKey.value;
|
|
114
|
+
const iv = decodeBase64(this._record.value.secrets.iv);
|
|
115
|
+
const encrypted = decodeBase64(this._record.value.secrets.value);
|
|
116
|
+
const decrypted = await crypto.subtle.decrypt({ name: MCP_ENCRYPTION_KEY_ALGORITHM, iv: iv.buffer }, key, encrypted.buffer);
|
|
117
|
+
const unsealedSecrets = JSON.parse(( new TextDecoder()).decode(decrypted));
|
|
118
|
+
this._record.value.unsealedSecrets = unsealedSecrets;
|
|
119
|
+
return unsealedSecrets;
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
this._logService.warn('Error unsealing MCP secrets', e);
|
|
123
|
+
this._record.value.secrets = undefined;
|
|
124
|
+
}
|
|
125
|
+
return {};
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
McpRegistryInputStorage = McpRegistryInputStorage_1 = ( __decorate([
|
|
129
|
+
( __param(2, IStorageService)),
|
|
130
|
+
( __param(3, ISecretStorageService)),
|
|
131
|
+
( __param(4, ILogService))
|
|
132
|
+
], McpRegistryInputStorage));
|
|
133
|
+
|
|
134
|
+
export { McpRegistryInputStorage };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { Disposable, IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
|
|
4
|
+
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
5
|
+
import { ICommandService } from "@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service";
|
|
6
|
+
import { ILoggerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
7
|
+
import { StorageScope } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage";
|
|
8
|
+
import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
9
|
+
import { ITelemetryService } from "@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
10
|
+
import { IWorkspaceContextService } from "@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service";
|
|
11
|
+
import { IExtensionService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
12
|
+
import { IOutputService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output.service";
|
|
13
|
+
import { IMcpRegistry } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service";
|
|
14
|
+
import { McpServerRequestHandler } from "./mcpServerRequestHandler.js";
|
|
15
|
+
import { IMcpServer, IMcpServerConnection, IMcpTool, McpCollectionReference, McpConnectionState, McpDefinitionReference, McpServerDefinition, McpServerToolsState } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
16
|
+
import { MCP } from "./modelContextProtocol.js";
|
|
17
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
18
|
+
interface IServerCacheEntry {
|
|
19
|
+
readonly servers: readonly McpServerDefinition.Serialized[];
|
|
20
|
+
}
|
|
21
|
+
export declare class McpServerMetadataCache extends Disposable {
|
|
22
|
+
private didChange;
|
|
23
|
+
private readonly cache;
|
|
24
|
+
private readonly extensionServers;
|
|
25
|
+
constructor(scope: StorageScope, storageService: IStorageService);
|
|
26
|
+
reset(): void;
|
|
27
|
+
getTools(definitionId: string): readonly IValidatedMcpTool[] | undefined;
|
|
28
|
+
storeTools(definitionId: string, tools: readonly IValidatedMcpTool[]): void;
|
|
29
|
+
getServers(collectionId: string): IServerCacheEntry | undefined;
|
|
30
|
+
storeServers(collectionId: string, entry: IServerCacheEntry | undefined): void;
|
|
31
|
+
}
|
|
32
|
+
interface IValidatedMcpTool extends MCP.Tool {
|
|
33
|
+
serverToolName: string;
|
|
34
|
+
}
|
|
35
|
+
export declare class McpServer extends Disposable implements IMcpServer {
|
|
36
|
+
readonly collection: McpCollectionReference;
|
|
37
|
+
readonly definition: McpDefinitionReference;
|
|
38
|
+
private readonly _requiresExtensionActivation;
|
|
39
|
+
private readonly _toolCache;
|
|
40
|
+
private readonly _mcpRegistry;
|
|
41
|
+
private readonly _extensionService;
|
|
42
|
+
private readonly _loggerService;
|
|
43
|
+
private readonly _outputService;
|
|
44
|
+
private readonly _telemetryService;
|
|
45
|
+
private readonly _commandService;
|
|
46
|
+
private readonly _instantiationService;
|
|
47
|
+
private readonly _connectionSequencer;
|
|
48
|
+
private readonly _connection;
|
|
49
|
+
readonly connection: import("@codingame/monaco-vscode-api/vscode/vs/base/common/observable").ISettableObservable<IMcpServerConnection | undefined, void> & IDisposable;
|
|
50
|
+
readonly connectionState: IObservable<McpConnectionState>;
|
|
51
|
+
private get toolsFromCache();
|
|
52
|
+
private readonly toolsFromServerPromise;
|
|
53
|
+
private readonly toolsFromServer;
|
|
54
|
+
readonly tools: IObservable<readonly IMcpTool[]>;
|
|
55
|
+
readonly toolsState: IObservable<McpServerToolsState>;
|
|
56
|
+
private readonly _loggerId;
|
|
57
|
+
private readonly _logger;
|
|
58
|
+
get trusted(): IObservable<boolean | undefined>;
|
|
59
|
+
constructor(collection: McpCollectionReference, definition: McpDefinitionReference, explicitRoots: URI[] | undefined, _requiresExtensionActivation: boolean | undefined, _toolCache: McpServerMetadataCache, _mcpRegistry: IMcpRegistry, workspacesService: IWorkspaceContextService, _extensionService: IExtensionService, _loggerService: ILoggerService, _outputService: IOutputService, _telemetryService: ITelemetryService, _commandService: ICommandService, _instantiationService: IInstantiationService);
|
|
60
|
+
showOutput(): void;
|
|
61
|
+
start(isFromInteraction?: boolean): Promise<McpConnectionState>;
|
|
62
|
+
stop(): Promise<void>;
|
|
63
|
+
private resetLiveData;
|
|
64
|
+
private _normalizeTool;
|
|
65
|
+
private _getValidatedTools;
|
|
66
|
+
private populateLiveData;
|
|
67
|
+
callOn<R>(fn: (handler: McpServerRequestHandler) => Promise<R>, token?: CancellationToken): Promise<R>;
|
|
68
|
+
}
|
|
69
|
+
export declare class McpTool implements IMcpTool {
|
|
70
|
+
private readonly _server;
|
|
71
|
+
private readonly _definition;
|
|
72
|
+
readonly id: string;
|
|
73
|
+
get definition(): MCP.Tool;
|
|
74
|
+
constructor(_server: McpServer, idPrefix: string, _definition: IValidatedMcpTool);
|
|
75
|
+
call(params: Record<string, unknown>, token?: CancellationToken): Promise<MCP.CallToolResult>;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Sequencer, raceCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
|
+
import { parseTree, findNodeAtOffset, getNodePath } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
|
|
5
|
+
import { CancellationTokenSource, CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
6
|
+
import { Disposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { LRUCache } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
8
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
9
|
+
import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
10
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
11
|
+
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
12
|
+
import { ILoggerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
13
|
+
import { StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
14
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
15
|
+
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
16
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
17
|
+
import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
18
|
+
import { IOutputService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/output/common/output.service';
|
|
19
|
+
import { mcpActivationEvent } from '@codingame/monaco-vscode-ec21d4de-4d65-574c-8715-bb1a6bbad376-common/vscode/vs/workbench/contrib/mcp/common/mcpConfiguration';
|
|
20
|
+
import { IMcpRegistry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes.service';
|
|
21
|
+
import { McpConnectionState, McpServerToolsState, extensionMcpCollectionPrefix, McpConnectionFailedError } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes';
|
|
22
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
|
|
23
|
+
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
24
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
25
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
26
|
+
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
27
|
+
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
28
|
+
import { disposableObservableValue, observableValue, transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/base';
|
|
29
|
+
import { derived } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/derived';
|
|
30
|
+
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils';
|
|
31
|
+
import { autorunWithStore, autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/autorun';
|
|
32
|
+
import { ObservablePromise } from '@codingame/monaco-vscode-ae8a8ca1-f243-508b-9c37-c88ebbd295fa-common/vscode/vs/base/common/observableInternal/promise';
|
|
33
|
+
|
|
34
|
+
const toolInvalidCharRe = /[^a-z0-9_-]/gi;
|
|
35
|
+
let McpServerMetadataCache = class McpServerMetadataCache extends Disposable {
|
|
36
|
+
constructor(scope, storageService) {
|
|
37
|
+
super();
|
|
38
|
+
this.didChange = false;
|
|
39
|
+
this.cache = ( new LRUCache(128));
|
|
40
|
+
this.extensionServers = ( new Map());
|
|
41
|
+
const storageKey = 'mcpToolCache';
|
|
42
|
+
this._register(storageService.onWillSaveState(() => {
|
|
43
|
+
if (this.didChange) {
|
|
44
|
+
storageService.store(storageKey, {
|
|
45
|
+
extensionServers: [...this.extensionServers],
|
|
46
|
+
serverTools: this.cache.toJSON(),
|
|
47
|
+
}, scope, StorageTarget.MACHINE);
|
|
48
|
+
this.didChange = false;
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
try {
|
|
52
|
+
const cached = storageService.getObject(storageKey, scope);
|
|
53
|
+
this.extensionServers = ( new Map(cached?.extensionServers ?? []));
|
|
54
|
+
cached?.serverTools?.forEach(([k, v]) => this.cache.set(k, v));
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
reset() {
|
|
60
|
+
this.cache.clear();
|
|
61
|
+
this.extensionServers.clear();
|
|
62
|
+
this.didChange = true;
|
|
63
|
+
}
|
|
64
|
+
getTools(definitionId) {
|
|
65
|
+
return this.cache.get(definitionId)?.tools;
|
|
66
|
+
}
|
|
67
|
+
storeTools(definitionId, tools) {
|
|
68
|
+
this.cache.set(definitionId, { ...this.cache.get(definitionId), tools });
|
|
69
|
+
this.didChange = true;
|
|
70
|
+
}
|
|
71
|
+
getServers(collectionId) {
|
|
72
|
+
return this.extensionServers.get(collectionId);
|
|
73
|
+
}
|
|
74
|
+
storeServers(collectionId, entry) {
|
|
75
|
+
if (entry) {
|
|
76
|
+
this.extensionServers.set(collectionId, entry);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.extensionServers.delete(collectionId);
|
|
80
|
+
}
|
|
81
|
+
this.didChange = true;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
McpServerMetadataCache = ( __decorate([
|
|
85
|
+
( __param(1, IStorageService))
|
|
86
|
+
], McpServerMetadataCache));
|
|
87
|
+
let McpServer = class McpServer extends Disposable {
|
|
88
|
+
get toolsFromCache() {
|
|
89
|
+
return this._toolCache.getTools(this.definition.id);
|
|
90
|
+
}
|
|
91
|
+
get trusted() {
|
|
92
|
+
return this._mcpRegistry.getTrust(this.collection);
|
|
93
|
+
}
|
|
94
|
+
constructor(collection, definition, explicitRoots, _requiresExtensionActivation, _toolCache, _mcpRegistry, workspacesService, _extensionService, _loggerService, _outputService, _telemetryService, _commandService, _instantiationService) {
|
|
95
|
+
super();
|
|
96
|
+
this.collection = collection;
|
|
97
|
+
this.definition = definition;
|
|
98
|
+
this._requiresExtensionActivation = _requiresExtensionActivation;
|
|
99
|
+
this._toolCache = _toolCache;
|
|
100
|
+
this._mcpRegistry = _mcpRegistry;
|
|
101
|
+
this._extensionService = _extensionService;
|
|
102
|
+
this._loggerService = _loggerService;
|
|
103
|
+
this._outputService = _outputService;
|
|
104
|
+
this._telemetryService = _telemetryService;
|
|
105
|
+
this._commandService = _commandService;
|
|
106
|
+
this._instantiationService = _instantiationService;
|
|
107
|
+
this._connectionSequencer = ( new Sequencer());
|
|
108
|
+
this._connection = this._register(disposableObservableValue(this, undefined));
|
|
109
|
+
this.connection = this._connection;
|
|
110
|
+
this.connectionState = derived(reader => this._connection.read(reader)?.state.read(reader) ?? { state: McpConnectionState.Kind.Stopped });
|
|
111
|
+
this.toolsFromServerPromise = observableValue(this, undefined);
|
|
112
|
+
this.toolsFromServer = derived(reader => this.toolsFromServerPromise.read(reader)?.promiseResult.read(reader)?.data);
|
|
113
|
+
this.toolsState = derived(reader => {
|
|
114
|
+
const fromServer = this.toolsFromServerPromise.read(reader);
|
|
115
|
+
const connectionState = this.connectionState.read(reader);
|
|
116
|
+
const isIdle = McpConnectionState.canBeStarted(connectionState.state) && !fromServer;
|
|
117
|
+
if (isIdle) {
|
|
118
|
+
return this.toolsFromCache ? McpServerToolsState.Cached : McpServerToolsState.Unknown;
|
|
119
|
+
}
|
|
120
|
+
const fromServerResult = fromServer?.promiseResult.read(reader);
|
|
121
|
+
if (!fromServerResult) {
|
|
122
|
+
return this.toolsFromCache ? McpServerToolsState.RefreshingFromCached : McpServerToolsState.RefreshingFromUnknown;
|
|
123
|
+
}
|
|
124
|
+
return fromServerResult.error ? (this.toolsFromCache ? McpServerToolsState.Cached : McpServerToolsState.Unknown) : McpServerToolsState.Live;
|
|
125
|
+
});
|
|
126
|
+
this._loggerId = `mcpServer.${definition.id}`;
|
|
127
|
+
this._logger = this._register(_loggerService.createLogger(this._loggerId, { hidden: true, name: `MCP: ${definition.label}` }));
|
|
128
|
+
this._register(toDisposable(() => _loggerService.deregisterLogger(this._loggerId)));
|
|
129
|
+
const workspaces = explicitRoots
|
|
130
|
+
? observableValue(this, ( explicitRoots.map(uri => ({ uri, name: basename(uri) }))))
|
|
131
|
+
: observableFromEvent(this, workspacesService.onDidChangeWorkspaceFolders, () => workspacesService.getWorkspace().folders);
|
|
132
|
+
this._register(autorunWithStore(reader => {
|
|
133
|
+
const cnx = this._connection.read(reader)?.handler.read(reader);
|
|
134
|
+
if (!cnx) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
cnx.roots = ( workspaces.read(reader).map(wf => ({
|
|
138
|
+
uri: ( wf.uri.toString()),
|
|
139
|
+
name: wf.name,
|
|
140
|
+
})));
|
|
141
|
+
}));
|
|
142
|
+
this._register(autorunWithStore((reader, store) => {
|
|
143
|
+
const cnx = this._connection.read(reader)?.handler.read(reader);
|
|
144
|
+
if (cnx) {
|
|
145
|
+
this.populateLiveData(cnx, store);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
this.resetLiveData();
|
|
149
|
+
}
|
|
150
|
+
}));
|
|
151
|
+
this._register(autorun(reader => {
|
|
152
|
+
const tools = this.toolsFromServer.read(reader);
|
|
153
|
+
if (tools) {
|
|
154
|
+
this._toolCache.storeTools(definition.id, tools);
|
|
155
|
+
}
|
|
156
|
+
}));
|
|
157
|
+
const toolPrefix = this._mcpRegistry.collectionToolPrefix(this.collection);
|
|
158
|
+
this.tools = derived(reader => {
|
|
159
|
+
const serverTools = this.toolsFromServer.read(reader);
|
|
160
|
+
const definitions = serverTools ?? this.toolsFromCache ?? [];
|
|
161
|
+
const prefix = toolPrefix.read(reader);
|
|
162
|
+
return ( definitions.map(def => ( new McpTool(this, prefix, def))));
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
showOutput() {
|
|
166
|
+
this._loggerService.setVisibility(this._loggerId, true);
|
|
167
|
+
this._outputService.showChannel(this._loggerId);
|
|
168
|
+
}
|
|
169
|
+
start(isFromInteraction) {
|
|
170
|
+
return this._connectionSequencer.queue(async () => {
|
|
171
|
+
const activationEvent = mcpActivationEvent(this.collection.id.slice(extensionMcpCollectionPrefix.length));
|
|
172
|
+
if (this._requiresExtensionActivation && !this._extensionService.activationEventIsDone(activationEvent)) {
|
|
173
|
+
await this._extensionService.activateByEvent(activationEvent);
|
|
174
|
+
await Promise.all(( this._mcpRegistry.delegates
|
|
175
|
+
.map(r => r.waitForInitialProviderPromises())));
|
|
176
|
+
if (this._store.isDisposed) {
|
|
177
|
+
return { state: McpConnectionState.Kind.Stopped };
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
let connection = this._connection.get();
|
|
181
|
+
if (connection && McpConnectionState.canBeStarted(connection.state.get().state)) {
|
|
182
|
+
connection.dispose();
|
|
183
|
+
connection = undefined;
|
|
184
|
+
this._connection.set(connection, undefined);
|
|
185
|
+
}
|
|
186
|
+
if (!connection) {
|
|
187
|
+
connection = await this._mcpRegistry.resolveConnection({
|
|
188
|
+
logger: this._logger,
|
|
189
|
+
collectionRef: this.collection,
|
|
190
|
+
definitionRef: this.definition,
|
|
191
|
+
forceTrust: isFromInteraction,
|
|
192
|
+
});
|
|
193
|
+
if (!connection) {
|
|
194
|
+
return { state: McpConnectionState.Kind.Stopped };
|
|
195
|
+
}
|
|
196
|
+
if (this._store.isDisposed) {
|
|
197
|
+
connection.dispose();
|
|
198
|
+
return { state: McpConnectionState.Kind.Stopped };
|
|
199
|
+
}
|
|
200
|
+
this._connection.set(connection, undefined);
|
|
201
|
+
}
|
|
202
|
+
const start = Date.now();
|
|
203
|
+
const state = await connection.start();
|
|
204
|
+
this._telemetryService.publicLog2('mcp/serverBootState', {
|
|
205
|
+
state: McpConnectionState.toKindString(state.state),
|
|
206
|
+
time: Date.now() - start,
|
|
207
|
+
});
|
|
208
|
+
return state;
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
stop() {
|
|
212
|
+
return this._connection.get()?.stop() || Promise.resolve();
|
|
213
|
+
}
|
|
214
|
+
resetLiveData() {
|
|
215
|
+
transaction(tx => {
|
|
216
|
+
this.toolsFromServerPromise.set(undefined, tx);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
async _normalizeTool(originalTool) {
|
|
220
|
+
const tool = { ...originalTool, serverToolName: originalTool.name };
|
|
221
|
+
if (!tool.description) {
|
|
222
|
+
this._logger.warn(`Tool ${tool.name} does not have a description. Tools must be accurately described to be called`);
|
|
223
|
+
tool.description = '<empty>';
|
|
224
|
+
}
|
|
225
|
+
if (toolInvalidCharRe.test(tool.name)) {
|
|
226
|
+
this._logger.warn(`Tool ${JSON.stringify(tool.name)} is invalid. Tools names may only contain [a-z0-9_-]`);
|
|
227
|
+
tool.name = tool.name.replace(toolInvalidCharRe, '_');
|
|
228
|
+
}
|
|
229
|
+
let diagnostics = [];
|
|
230
|
+
const toolJson = JSON.stringify(tool.inputSchema);
|
|
231
|
+
try {
|
|
232
|
+
const schemaUri = ( URI.parse('https://json-schema.org/draft-07/schema'));
|
|
233
|
+
diagnostics = (await this._commandService.executeCommand('json.validate', schemaUri, toolJson)) || [];
|
|
234
|
+
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
}
|
|
237
|
+
if (!diagnostics.length) {
|
|
238
|
+
return tool;
|
|
239
|
+
}
|
|
240
|
+
const tree = parseTree(toolJson);
|
|
241
|
+
const messages = ( diagnostics.map(d => {
|
|
242
|
+
const node = findNodeAtOffset(tree, d.range[0].character);
|
|
243
|
+
const path = node && `/${getNodePath(node).join('/')}`;
|
|
244
|
+
return d.message + (path ? ` (at ${path})` : '');
|
|
245
|
+
}));
|
|
246
|
+
return { error: messages };
|
|
247
|
+
}
|
|
248
|
+
async _getValidatedTools(handler, tools) {
|
|
249
|
+
let error = '';
|
|
250
|
+
const validations = await Promise.all(( tools.map(t => this._normalizeTool(t))));
|
|
251
|
+
const validated = [];
|
|
252
|
+
for (const [i, result] of validations.entries()) {
|
|
253
|
+
if ('error' in result) {
|
|
254
|
+
error += ( localize(7661, 'Tool `{0}` has invalid JSON parameters:', tools[i].name)) + '\n';
|
|
255
|
+
for (const message of result.error) {
|
|
256
|
+
error += `\t- ${message}\n`;
|
|
257
|
+
}
|
|
258
|
+
error += `\t- Schema: ${JSON.stringify(tools[i].inputSchema)}\n\n`;
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
validated.push(result);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (error) {
|
|
265
|
+
handler.logger.warn(`${tools.length - validated.length} tools have invalid JSON schemas and will be omitted`);
|
|
266
|
+
warnInvalidTools(this._instantiationService, this.definition.label, error);
|
|
267
|
+
}
|
|
268
|
+
return validated;
|
|
269
|
+
}
|
|
270
|
+
populateLiveData(handler, store) {
|
|
271
|
+
const cts = ( new CancellationTokenSource());
|
|
272
|
+
store.add(toDisposable(() => cts.dispose(true)));
|
|
273
|
+
const updateTools = (tx) => {
|
|
274
|
+
const toolPromise = handler.capabilities.tools ? handler.listTools({}, cts.token) : Promise.resolve([]);
|
|
275
|
+
const toolPromiseSafe = toolPromise.then(async (tools) => {
|
|
276
|
+
handler.logger.info(`Discovered ${tools.length} tools`);
|
|
277
|
+
return this._getValidatedTools(handler, tools);
|
|
278
|
+
});
|
|
279
|
+
this.toolsFromServerPromise.set(( new ObservablePromise(toolPromiseSafe)), tx);
|
|
280
|
+
return [toolPromise];
|
|
281
|
+
};
|
|
282
|
+
store.add(handler.onDidChangeToolList(() => {
|
|
283
|
+
handler.logger.info('Tool list changed, refreshing tools...');
|
|
284
|
+
updateTools(undefined);
|
|
285
|
+
}));
|
|
286
|
+
let promises;
|
|
287
|
+
transaction(tx => {
|
|
288
|
+
promises = updateTools(tx);
|
|
289
|
+
});
|
|
290
|
+
Promise.all(promises).then(([tools]) => {
|
|
291
|
+
this._telemetryService.publicLog2('mcp/serverBoot', {
|
|
292
|
+
supportsLogging: !!handler.capabilities.logging,
|
|
293
|
+
supportsPrompts: !!handler.capabilities.prompts,
|
|
294
|
+
supportsResources: !!handler.capabilities.resources,
|
|
295
|
+
toolCount: tools.length,
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
async callOn(fn, token = CancellationToken.None) {
|
|
300
|
+
await this.start();
|
|
301
|
+
let ranOnce = false;
|
|
302
|
+
let d;
|
|
303
|
+
const callPromise = ( new Promise((resolve, reject) => {
|
|
304
|
+
d = autorun(reader => {
|
|
305
|
+
const connection = this._connection.read(reader);
|
|
306
|
+
if (!connection || ranOnce) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const handler = connection.handler.read(reader);
|
|
310
|
+
if (!handler) {
|
|
311
|
+
const state = connection.state.read(reader);
|
|
312
|
+
if (state.state === McpConnectionState.Kind.Error) {
|
|
313
|
+
reject(( new McpConnectionFailedError(`MCP server could not be started: ${state.message}`)));
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
else if (state.state === McpConnectionState.Kind.Stopped) {
|
|
317
|
+
reject(( new McpConnectionFailedError('MCP server has stopped')));
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
resolve(fn(handler));
|
|
325
|
+
ranOnce = true;
|
|
326
|
+
});
|
|
327
|
+
}));
|
|
328
|
+
return raceCancellationError(callPromise, token).finally(() => d.dispose());
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
McpServer = ( __decorate([
|
|
332
|
+
( __param(5, IMcpRegistry)),
|
|
333
|
+
( __param(6, IWorkspaceContextService)),
|
|
334
|
+
( __param(7, IExtensionService)),
|
|
335
|
+
( __param(8, ILoggerService)),
|
|
336
|
+
( __param(9, IOutputService)),
|
|
337
|
+
( __param(10, ITelemetryService)),
|
|
338
|
+
( __param(11, ICommandService)),
|
|
339
|
+
( __param(12, IInstantiationService))
|
|
340
|
+
], McpServer));
|
|
341
|
+
class McpTool {
|
|
342
|
+
get definition() { return this._definition; }
|
|
343
|
+
constructor(_server, idPrefix, _definition) {
|
|
344
|
+
this._server = _server;
|
|
345
|
+
this._definition = _definition;
|
|
346
|
+
this.id = (idPrefix + _definition.name).replaceAll('.', '_');
|
|
347
|
+
}
|
|
348
|
+
call(params, token) {
|
|
349
|
+
const name = this._definition.serverToolName ?? this._definition.name;
|
|
350
|
+
return this._server.callOn(h => h.callTool({ name, arguments: params }), token);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function warnInvalidTools(instaService, serverName, errorText) {
|
|
354
|
+
instaService.invokeFunction((accessor) => {
|
|
355
|
+
const notificationService = accessor.get(INotificationService);
|
|
356
|
+
const editorService = accessor.get(IEditorService);
|
|
357
|
+
notificationService.notify({
|
|
358
|
+
severity: Severity.Warning,
|
|
359
|
+
message: ( localize(
|
|
360
|
+
7662,
|
|
361
|
+
'MCP server `{0}` has tools with invalid parameters which will be omitted.',
|
|
362
|
+
serverName
|
|
363
|
+
)),
|
|
364
|
+
actions: {
|
|
365
|
+
primary: [{
|
|
366
|
+
class: undefined,
|
|
367
|
+
enabled: true,
|
|
368
|
+
id: 'mcpBadSchema.show',
|
|
369
|
+
tooltip: '',
|
|
370
|
+
label: ( localize(7663, 'Show')),
|
|
371
|
+
run: () => {
|
|
372
|
+
editorService.openEditor({
|
|
373
|
+
resource: undefined,
|
|
374
|
+
contents: errorText,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}]
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export { McpServer, McpServerMetadataCache, McpTool };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IObservable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/observable";
|
|
3
|
+
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
4
|
+
import { ILogger } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log";
|
|
5
|
+
import { IMcpHostDelegate } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpRegistryTypes";
|
|
6
|
+
import { McpServerRequestHandler } from "./mcpServerRequestHandler.js";
|
|
7
|
+
import { IMcpServerConnection, McpCollectionDefinition, McpConnectionState, McpServerDefinition, McpServerLaunch } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/mcp/common/mcpTypes";
|
|
8
|
+
export declare class McpServerConnection extends Disposable implements IMcpServerConnection {
|
|
9
|
+
private readonly _collection;
|
|
10
|
+
readonly definition: McpServerDefinition;
|
|
11
|
+
private readonly _delegate;
|
|
12
|
+
readonly launchDefinition: McpServerLaunch;
|
|
13
|
+
private readonly _logger;
|
|
14
|
+
private readonly _instantiationService;
|
|
15
|
+
private readonly _launch;
|
|
16
|
+
private readonly _state;
|
|
17
|
+
private readonly _requestHandler;
|
|
18
|
+
readonly state: IObservable<McpConnectionState>;
|
|
19
|
+
readonly handler: IObservable<McpServerRequestHandler | undefined>;
|
|
20
|
+
constructor(_collection: McpCollectionDefinition, definition: McpServerDefinition, _delegate: IMcpHostDelegate, launchDefinition: McpServerLaunch, _logger: ILogger, _instantiationService: IInstantiationService);
|
|
21
|
+
start(): Promise<McpConnectionState>;
|
|
22
|
+
private adoptLaunch;
|
|
23
|
+
stop(): Promise<void>;
|
|
24
|
+
dispose(): void;
|
|
25
|
+
private _waitForState;
|
|
26
|
+
}
|