@microsoft/agents-a365-tooling 0.1.0-preview.95 → 0.2.0-preview.3
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/dist/cjs/McpToolServerConfigurationService.d.ts +75 -7
- package/dist/cjs/McpToolServerConfigurationService.d.ts.map +1 -1
- package/dist/cjs/McpToolServerConfigurationService.js +193 -15
- package/dist/cjs/McpToolServerConfigurationService.js.map +1 -1
- package/dist/cjs/Utility.d.ts +32 -6
- package/dist/cjs/Utility.d.ts.map +1 -1
- package/dist/cjs/Utility.js +59 -19
- package/dist/cjs/Utility.js.map +1 -1
- package/dist/cjs/configuration/ToolingConfiguration.d.ts +51 -0
- package/dist/cjs/configuration/ToolingConfiguration.d.ts.map +1 -0
- package/dist/cjs/configuration/ToolingConfiguration.js +118 -0
- package/dist/cjs/configuration/ToolingConfiguration.js.map +1 -0
- package/dist/cjs/configuration/ToolingConfigurationOptions.d.ts +23 -0
- package/dist/cjs/configuration/ToolingConfigurationOptions.d.ts.map +1 -0
- package/dist/cjs/configuration/ToolingConfigurationOptions.js +5 -0
- package/dist/cjs/configuration/ToolingConfigurationOptions.js.map +1 -0
- package/dist/cjs/configuration/index.d.ts +9 -0
- package/dist/cjs/configuration/index.d.ts.map +1 -0
- package/dist/cjs/configuration/index.js +28 -0
- package/dist/cjs/configuration/index.js.map +1 -0
- package/dist/cjs/contracts.d.ts +6 -0
- package/dist/cjs/contracts.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/McpToolServerConfigurationService.d.ts +75 -7
- package/dist/esm/McpToolServerConfigurationService.d.ts.map +1 -1
- package/dist/esm/McpToolServerConfigurationService.js +194 -16
- package/dist/esm/McpToolServerConfigurationService.js.map +1 -1
- package/dist/esm/Utility.d.ts +32 -6
- package/dist/esm/Utility.d.ts.map +1 -1
- package/dist/esm/Utility.js +59 -19
- package/dist/esm/Utility.js.map +1 -1
- package/dist/esm/configuration/ToolingConfiguration.d.ts +51 -0
- package/dist/esm/configuration/ToolingConfiguration.d.ts.map +1 -0
- package/dist/esm/configuration/ToolingConfiguration.js +113 -0
- package/dist/esm/configuration/ToolingConfiguration.js.map +1 -0
- package/dist/esm/configuration/ToolingConfigurationOptions.d.ts +23 -0
- package/dist/esm/configuration/ToolingConfigurationOptions.d.ts.map +1 -0
- package/dist/esm/configuration/ToolingConfigurationOptions.js +4 -0
- package/dist/esm/configuration/ToolingConfigurationOptions.js.map +1 -0
- package/dist/esm/configuration/index.d.ts +9 -0
- package/dist/esm/configuration/index.d.ts.map +1 -0
- package/dist/esm/configuration/index.js +11 -0
- package/dist/esm/configuration/index.js.map +1 -0
- package/dist/esm/contracts.d.ts +6 -0
- package/dist/esm/contracts.d.ts.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import axios from 'axios';
|
|
6
|
-
import { OperationResult, OperationError } from '@microsoft/agents-a365-runtime';
|
|
6
|
+
import { OperationResult, OperationError, AgenticAuthenticationService, Utility as RuntimeUtility } from '@microsoft/agents-a365-runtime';
|
|
7
7
|
import { Utility } from './Utility';
|
|
8
|
+
import { defaultToolingConfigurationProvider, resolveTokenScopeForServer } from './configuration';
|
|
8
9
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
9
10
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
10
11
|
/**
|
|
@@ -14,13 +15,155 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
|
14
15
|
export class McpToolServerConfigurationService {
|
|
15
16
|
/**
|
|
16
17
|
* Construct a McpToolServerConfigurationService.
|
|
18
|
+
* @param configProvider Optional configuration provider. Defaults to defaultToolingConfigurationProvider if not specified.
|
|
17
19
|
*/
|
|
18
|
-
constructor() {
|
|
20
|
+
constructor(configProvider) {
|
|
19
21
|
this.logger = console;
|
|
22
|
+
this.configProvider = configProvider ?? defaultToolingConfigurationProvider;
|
|
20
23
|
}
|
|
21
|
-
async listToolServers(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
async listToolServers(agenticAppIdOrTurnContext, authTokenOrAuthorization, optionsOrAuthHandlerName, authTokenOrOptions, options) {
|
|
25
|
+
// Detect which signature is being used based on the type of the first parameter
|
|
26
|
+
if (typeof agenticAppIdOrTurnContext === 'string') {
|
|
27
|
+
// LEGACY PATH: listToolServers(agenticAppId, authToken, options?)
|
|
28
|
+
const agenticAppId = agenticAppIdOrTurnContext;
|
|
29
|
+
// Runtime validation for legacy signature parameters
|
|
30
|
+
if (typeof authTokenOrAuthorization !== 'string') {
|
|
31
|
+
throw new Error('authToken must be a string when using the legacy listToolServers(agenticAppId, authToken) signature');
|
|
32
|
+
}
|
|
33
|
+
const authToken = authTokenOrAuthorization;
|
|
34
|
+
const toolOptions = optionsOrAuthHandlerName;
|
|
35
|
+
const servers = await (this.isDevScenario()
|
|
36
|
+
? this.getMCPServerConfigsFromManifest()
|
|
37
|
+
: this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, undefined, toolOptions));
|
|
38
|
+
// Apply per-audience tokens on the legacy path too, using the same structural path as the
|
|
39
|
+
// new overload so V2 servers are never silently missing an Authorization header.
|
|
40
|
+
// Dev: reads from BEARER_TOKEN_<NAME> / BEARER_TOKEN env vars, supports V1 and V2.
|
|
41
|
+
// Prod: uses the shared authToken for V1 servers; throws for V2 servers (OBO requires
|
|
42
|
+
// Authorization and authHandlerName — use the TurnContext-based overload instead).
|
|
43
|
+
const acquire = this.isDevScenario()
|
|
44
|
+
? this.createDevTokenAcquirer()
|
|
45
|
+
: this.createLegacyProdTokenAcquirer(authToken);
|
|
46
|
+
return await this.attachPerAudienceTokens(servers, acquire);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// NEW PATH: listToolServers(turnContext, authorization, authHandlerName, authToken?, options?)
|
|
50
|
+
const turnContext = agenticAppIdOrTurnContext;
|
|
51
|
+
// Runtime validation for new signature parameters
|
|
52
|
+
if (typeof authTokenOrAuthorization === 'string') {
|
|
53
|
+
throw new Error('authorization must be an Authorization object when using the new listToolServers(turnContext, authorization, authHandlerName) signature');
|
|
54
|
+
}
|
|
55
|
+
if (typeof optionsOrAuthHandlerName !== 'string') {
|
|
56
|
+
throw new Error('authHandlerName must be a string when using the new listToolServers(turnContext, authorization, authHandlerName) signature');
|
|
57
|
+
}
|
|
58
|
+
const authorization = authTokenOrAuthorization;
|
|
59
|
+
const authHandlerName = optionsOrAuthHandlerName;
|
|
60
|
+
let authToken = authTokenOrOptions;
|
|
61
|
+
const toolOptions = options;
|
|
62
|
+
// Auto-generate token if not provided
|
|
63
|
+
if (!authToken) {
|
|
64
|
+
const scopes = [this.configProvider.getConfiguration().mcpPlatformAuthenticationScope];
|
|
65
|
+
authToken = await AgenticAuthenticationService.GetAgenticUserToken(authorization, authHandlerName, turnContext, scopes);
|
|
66
|
+
if (!authToken) {
|
|
67
|
+
throw new Error('Failed to obtain authentication token from token exchange');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Note: Token validation (format/expiration) is performed inside getMCPServerConfigsFromToolingGateway()
|
|
71
|
+
// to avoid duplicate validation (it's also called by the legacy path)
|
|
72
|
+
// Resolve agenticAppId from TurnContext
|
|
73
|
+
const agenticAppId = RuntimeUtility.ResolveAgentIdentity(turnContext, authToken);
|
|
74
|
+
// Discover servers: manifest in dev, gateway in prod
|
|
75
|
+
const servers = await (this.isDevScenario()
|
|
76
|
+
? this.getMCPServerConfigsFromManifest()
|
|
77
|
+
: this.getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, turnContext, toolOptions));
|
|
78
|
+
// Acquire and attach per-server tokens via the same structural path in both envs.
|
|
79
|
+
// Token source differs: env vars in dev, OBO in prod.
|
|
80
|
+
const acquire = this.isDevScenario()
|
|
81
|
+
? this.createDevTokenAcquirer()
|
|
82
|
+
: this.createOboTokenAcquirer(authorization, authHandlerName, turnContext);
|
|
83
|
+
return await this.attachPerAudienceTokens(servers, acquire);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Acquire one token per unique audience across the provided server list and attach
|
|
88
|
+
* the correct `Authorization: Bearer` header to each server's headers.
|
|
89
|
+
* V1 servers (no `audience` field, or ATG AppId) all share the same token (one exchange).
|
|
90
|
+
* V2 servers each get a token scoped to their own audience GUID.
|
|
91
|
+
* Token acquisition is delegated to `acquire`, enabling different strategies in dev
|
|
92
|
+
* (env vars via createDevTokenAcquirer) and prod (OBO via createOboTokenAcquirer)
|
|
93
|
+
* while keeping scope resolution, deduplication, and header attachment identical.
|
|
94
|
+
*/
|
|
95
|
+
async attachPerAudienceTokens(servers, acquire) {
|
|
96
|
+
// Fetch once so scope resolution and the legacy-path guard use the same value.
|
|
97
|
+
const sharedScope = this.configProvider.getConfiguration().mcpPlatformAuthenticationScope;
|
|
98
|
+
const tokenCache = new Map(); // scope → token (null = no token available)
|
|
99
|
+
const result = [];
|
|
100
|
+
for (const server of servers) {
|
|
101
|
+
const scope = resolveTokenScopeForServer(server, sharedScope);
|
|
102
|
+
if (!tokenCache.has(scope)) {
|
|
103
|
+
tokenCache.set(scope, await acquire(server, scope));
|
|
104
|
+
}
|
|
105
|
+
const token = tokenCache.get(scope);
|
|
106
|
+
result.push(token
|
|
107
|
+
? { ...server, headers: { ...server.headers, Authorization: `Bearer ${token}` } }
|
|
108
|
+
: server // no token available — dev no-op; prod acquirer would have thrown already
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Returns a TokenAcquirer that resolves tokens from environment variables (local dev only).
|
|
115
|
+
* Resolution order per server:
|
|
116
|
+
* 1. BEARER_TOKEN_<MCPSERVERNAME_UPPER> — per-server token (effective for V2 unique audiences)
|
|
117
|
+
* 2. BEARER_TOKEN — shared fallback (V1 servers share one token)
|
|
118
|
+
* Returns null when neither variable is set; no Authorization header is attached.
|
|
119
|
+
* Emits a warning when a V2 server (distinct audience) falls back to the shared BEARER_TOKEN,
|
|
120
|
+
* because that token is scoped to the shared ATG audience and will cause a 401 at the server.
|
|
121
|
+
*/
|
|
122
|
+
createDevTokenAcquirer() {
|
|
123
|
+
const sharedScope = this.configProvider.getConfiguration().mcpPlatformAuthenticationScope;
|
|
124
|
+
return (server, scope) => {
|
|
125
|
+
const serverName = server.mcpServerName ?? '';
|
|
126
|
+
const config = this.configProvider.getConfiguration();
|
|
127
|
+
const token = config.getBearerTokenForServer(serverName);
|
|
128
|
+
if (token && !config.hasPerServerBearerToken(serverName) && scope !== sharedScope) {
|
|
129
|
+
this.logger.warn(`Dev: MCP server '${serverName}' requires scope '${scope}' but only BEARER_TOKEN is set. ` +
|
|
130
|
+
`The shared token is scoped to a different audience and will likely cause a 401. ` +
|
|
131
|
+
`Set BEARER_TOKEN_${serverName.toUpperCase()} to a token acquired for the correct audience.`);
|
|
132
|
+
}
|
|
133
|
+
return Promise.resolve(token ?? null);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Returns a TokenAcquirer for the deprecated legacy (agenticAppId, authToken) overload in prod.
|
|
138
|
+
* V1 servers (ATG shared scope) receive the caller-supplied authToken directly.
|
|
139
|
+
* V2 servers (per-audience scope) throw immediately — OBO exchange requires Authorization and
|
|
140
|
+
* authHandlerName which the legacy signature does not provide; callers must migrate to the
|
|
141
|
+
* TurnContext-based overload.
|
|
142
|
+
*/
|
|
143
|
+
createLegacyProdTokenAcquirer(authToken) {
|
|
144
|
+
const sharedScope = this.configProvider.getConfiguration().mcpPlatformAuthenticationScope;
|
|
145
|
+
return (server, scope) => {
|
|
146
|
+
if (scope !== sharedScope) {
|
|
147
|
+
throw new Error(`MCP server '${server.mcpServerName}' requires a per-audience token (scope: '${scope}'). ` +
|
|
148
|
+
`Per-audience token exchange is not supported by the deprecated listToolServers(agenticAppId, authToken) overload. ` +
|
|
149
|
+
`Migrate to listToolServers(turnContext, authorization, authHandlerName) instead.`);
|
|
150
|
+
}
|
|
151
|
+
return Promise.resolve(authToken);
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Returns a TokenAcquirer that performs OBO token exchange via AgenticAuthenticationService.
|
|
156
|
+
* Throws if the exchange returns null so callers receive an explicit error rather than a
|
|
157
|
+
* silently missing Authorization header.
|
|
158
|
+
*/
|
|
159
|
+
createOboTokenAcquirer(authorization, authHandlerName, turnContext) {
|
|
160
|
+
return async (server, scope) => {
|
|
161
|
+
const token = await AgenticAuthenticationService.GetAgenticUserToken(authorization, authHandlerName, turnContext, [scope]);
|
|
162
|
+
if (!token) {
|
|
163
|
+
throw new Error(`Failed to obtain token for MCP server '${server.mcpServerName}' (scope: ${scope})`);
|
|
164
|
+
}
|
|
165
|
+
return token;
|
|
166
|
+
};
|
|
24
167
|
}
|
|
25
168
|
/**
|
|
26
169
|
* Connect to the MCP server and return tools with names prefixed by the server name.
|
|
@@ -68,7 +211,7 @@ export class McpToolServerConfigurationService {
|
|
|
68
211
|
throw new Error('User message is required but not found in turn context');
|
|
69
212
|
}
|
|
70
213
|
// Get the endpoint URL
|
|
71
|
-
const endpoint =
|
|
214
|
+
const endpoint = this.getChatHistoryEndpoint();
|
|
72
215
|
this.logger.info(`Sending chat history to endpoint: ${endpoint}`);
|
|
73
216
|
// Create the request payload
|
|
74
217
|
const request = {
|
|
@@ -111,19 +254,28 @@ export class McpToolServerConfigurationService {
|
|
|
111
254
|
*
|
|
112
255
|
* @param agenticAppId The agentic app id used by the tooling gateway to scope results.
|
|
113
256
|
* @param authToken Optional Bearer token to include in the Authorization header when calling the gateway.
|
|
257
|
+
* @param turnContext Optional TurnContext for extracting agent blueprint ID for request headers.
|
|
114
258
|
* @param options Optional tool options when calling the gateway.
|
|
115
259
|
* @throws Error when the gateway call fails or returns an unexpected payload.
|
|
116
260
|
*/
|
|
117
|
-
async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, options) {
|
|
261
|
+
async getMCPServerConfigsFromToolingGateway(agenticAppId, authToken, turnContext, options) {
|
|
118
262
|
// Validate the authentication token
|
|
119
263
|
Utility.ValidateAuthToken(authToken);
|
|
120
|
-
const configEndpoint =
|
|
264
|
+
const configEndpoint = this.getToolingGatewayUrl(agenticAppId);
|
|
121
265
|
try {
|
|
122
266
|
const response = await axios.get(configEndpoint, {
|
|
123
|
-
headers: Utility.GetToolRequestHeaders(authToken,
|
|
267
|
+
headers: Utility.GetToolRequestHeaders(authToken, turnContext, options),
|
|
124
268
|
timeout: 10000 // 10 seconds timeout
|
|
125
269
|
});
|
|
126
|
-
|
|
270
|
+
const rawServers = response.data || [];
|
|
271
|
+
return rawServers.map(s => ({
|
|
272
|
+
mcpServerName: s.mcpServerName,
|
|
273
|
+
url: s.url,
|
|
274
|
+
headers: s.headers,
|
|
275
|
+
audience: s.audience,
|
|
276
|
+
scope: s.scope,
|
|
277
|
+
publisher: s.publisher,
|
|
278
|
+
}));
|
|
127
279
|
}
|
|
128
280
|
catch (err) {
|
|
129
281
|
const error = err;
|
|
@@ -177,8 +329,11 @@ export class McpToolServerConfigurationService {
|
|
|
177
329
|
}
|
|
178
330
|
return {
|
|
179
331
|
mcpServerName: serverName,
|
|
180
|
-
url: s.url ||
|
|
181
|
-
headers: s.headers
|
|
332
|
+
url: s.url || this.buildMcpServerUrl(serverName),
|
|
333
|
+
headers: s.headers,
|
|
334
|
+
audience: s.audience,
|
|
335
|
+
scope: s.scope,
|
|
336
|
+
publisher: s.publisher,
|
|
182
337
|
};
|
|
183
338
|
});
|
|
184
339
|
}
|
|
@@ -189,13 +344,36 @@ export class McpToolServerConfigurationService {
|
|
|
189
344
|
}
|
|
190
345
|
}
|
|
191
346
|
/**
|
|
192
|
-
* Detect if the process is running in a development scenario based on
|
|
347
|
+
* Detect if the process is running in a development scenario based on configuration.
|
|
193
348
|
*
|
|
194
|
-
* @returns {boolean} True when running in a development environment.
|
|
349
|
+
* @returns {boolean} True when running in a development environment (NODE_ENV=Development).
|
|
195
350
|
*/
|
|
196
351
|
isDevScenario() {
|
|
197
|
-
|
|
198
|
-
|
|
352
|
+
return this.configProvider.getConfiguration().useToolingManifest;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Gets the base URL for MCP platform from configuration.
|
|
356
|
+
*/
|
|
357
|
+
getMcpPlatformBaseUrl() {
|
|
358
|
+
return this.configProvider.getConfiguration().mcpPlatformEndpoint;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Construct the tooling gateway URL for a given agent identity.
|
|
362
|
+
*/
|
|
363
|
+
getToolingGatewayUrl(agenticAppId) {
|
|
364
|
+
return `${this.getMcpPlatformBaseUrl()}/agents/v2/${agenticAppId}/mcpServers`;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Build the full URL for accessing a specific MCP server.
|
|
368
|
+
*/
|
|
369
|
+
buildMcpServerUrl(serverName) {
|
|
370
|
+
return `${this.getMcpPlatformBaseUrl()}/agents/servers/${serverName}/`;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Constructs the endpoint URL for sending chat history.
|
|
374
|
+
*/
|
|
375
|
+
getChatHistoryEndpoint() {
|
|
376
|
+
return `${this.getMcpPlatformBaseUrl()}/agents/real-time-threat-protection/chat-message`;
|
|
199
377
|
}
|
|
200
378
|
}
|
|
201
379
|
//# sourceMappingURL=McpToolServerConfigurationService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpToolServerConfigurationService.js","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,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tE,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAC3D,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC7C,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,IAAI,EAAE,CAAC;YAEjD,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAyB,EAAE,EAAE;gBAClD,6EAA6E;gBAC7E,MAAM,UAAU,GAAG,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,mBAAmB,CAAC;gBAC5D,IAAI,CAAC,UAAU,EAAE,CAAC;oBAChB,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;gBACpG,CAAC;gBACD,OAAO;oBACL,aAAa,EAAE,UAAU;oBACzB,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC;oBACnD,OAAO,EAAE,CAAC,CAAC,OAAO;iBACnB,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,KAAK,GAAG,GAAY,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kDAAkD,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YACxG,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,aAAa;QACnB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;QAC/C,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,aAAa,CAAC;IACrD,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"McpToolServerConfigurationService.js","sourceRoot":"","sources":["../../src/McpToolServerConfigurationService.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA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K,CAAC,kDAAkD,KAAK,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;YACxG,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,aAAa;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC,kBAAkB,CAAC;IACnE,CAAC;IAED;;OAEG;IACK,qBAAqB;QAC3B,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC,mBAAmB,CAAC;IACpE,CAAC;IAED;;OAEG;IACK,oBAAoB,CAAC,YAAoB;QAC/C,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,cAAc,YAAY,aAAa,CAAC;IAChF,CAAC;IAED;;OAEG;IACK,iBAAiB,CAAC,UAAkB;QAC1C,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,mBAAmB,UAAU,GAAG,CAAC;IACzE,CAAC;IAED;;OAEG;IACK,sBAAsB;QAC5B,OAAO,GAAG,IAAI,CAAC,qBAAqB,EAAE,kDAAkD,CAAC;IAC3F,CAAC;CACF"}
|
package/dist/esm/Utility.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { TurnContext } from '@microsoft/agents-hosting';
|
|
2
|
+
import { IConfigurationProvider } from '@microsoft/agents-a365-runtime';
|
|
2
3
|
import { ToolOptions } from './contracts';
|
|
4
|
+
import { ToolingConfiguration } from './configuration';
|
|
3
5
|
export declare class Utility {
|
|
4
6
|
static readonly HEADER_CHANNEL_ID = "x-ms-channel-id";
|
|
5
7
|
static readonly HEADER_SUBCHANNEL_ID = "x-ms-subchannel-id";
|
|
6
8
|
static readonly HEADER_USER_AGENT = "User-Agent";
|
|
9
|
+
/** Header name for sending the agent identifier to MCP platform for logging/analytics. */
|
|
10
|
+
static readonly HEADER_AGENT_ID = "x-ms-agentid";
|
|
7
11
|
/**
|
|
8
12
|
* Compose standard headers for MCP tooling requests.
|
|
9
13
|
* Includes Authorization bearer token when provided, and optionally includes channel and subchannel identifiers for routing.
|
|
@@ -14,6 +18,18 @@ export declare class Utility {
|
|
|
14
18
|
* @returns A headers record suitable for HTTP requests.
|
|
15
19
|
*/
|
|
16
20
|
static GetToolRequestHeaders(authToken?: string, turnContext?: TurnContext, options?: ToolOptions): Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Resolves the best available agent identifier for the x-ms-agentid header.
|
|
23
|
+
* Priority: TurnContext.agenticAppBlueprintId > token claims (xms_par_app_azp > appid > azp) > application name
|
|
24
|
+
*
|
|
25
|
+
* Note: This differs from RuntimeUtility.ResolveAgentIdentity() which resolves the agenticAppId
|
|
26
|
+
* for URL construction. This method resolves the identifier specifically for the x-ms-agentid header.
|
|
27
|
+
*
|
|
28
|
+
* @param authToken The authentication token to extract claims from.
|
|
29
|
+
* @param turnContext Optional TurnContext to extract agent blueprint ID from.
|
|
30
|
+
* @returns Agent ID string or undefined if not available.
|
|
31
|
+
*/
|
|
32
|
+
private static resolveAgentIdForHeader;
|
|
17
33
|
/**
|
|
18
34
|
* Validates a JWT authentication token.
|
|
19
35
|
* Checks that the token is a valid JWT and is not expired.
|
|
@@ -36,18 +52,22 @@ export declare class Utility {
|
|
|
36
52
|
*
|
|
37
53
|
* Example:
|
|
38
54
|
* Utility.GetToolingGatewayForDigitalWorker(agenticAppId)
|
|
39
|
-
* // => "https://agent365.svc.cloud.microsoft/agents/{agenticAppId}/mcpServers"
|
|
55
|
+
* // => "https://agent365.svc.cloud.microsoft/agents/v2/{agenticAppId}/mcpServers"
|
|
40
56
|
*
|
|
41
57
|
* @param agenticAppId - The unique identifier for the agent identity.
|
|
58
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
42
59
|
* @returns A fully-qualified URL pointing at the tooling gateway for the agent.
|
|
60
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService.listToolServers() instead.
|
|
43
61
|
*/
|
|
44
|
-
static GetToolingGatewayForDigitalWorker(agenticAppId: string): string;
|
|
62
|
+
static GetToolingGatewayForDigitalWorker(agenticAppId: string, configProvider?: IConfigurationProvider<ToolingConfiguration>): string;
|
|
45
63
|
/**
|
|
46
64
|
* Get the base URL used to query MCP environments.
|
|
47
65
|
*
|
|
66
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
48
67
|
* @returns The base MCP environments URL.
|
|
68
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService instead.
|
|
49
69
|
*/
|
|
50
|
-
static GetMcpBaseUrl(): string;
|
|
70
|
+
static GetMcpBaseUrl(configProvider?: IConfigurationProvider<ToolingConfiguration>): string;
|
|
51
71
|
/**
|
|
52
72
|
* Build the full URL for accessing a specific MCP server.
|
|
53
73
|
*
|
|
@@ -56,25 +76,31 @@ export declare class Utility {
|
|
|
56
76
|
* // => "https://agent365.svc.cloud.microsoft/agents/servers/MyServer/"
|
|
57
77
|
*
|
|
58
78
|
* @param serverName - The MCP server resource name.
|
|
79
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
59
80
|
* @returns The fully-qualified MCP server URL including trailing slash.
|
|
81
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService instead.
|
|
60
82
|
*/
|
|
61
|
-
static BuildMcpServerUrl(serverName: string): string;
|
|
83
|
+
static BuildMcpServerUrl(serverName: string, configProvider?: IConfigurationProvider<ToolingConfiguration>): string;
|
|
62
84
|
/**
|
|
63
|
-
* Gets the base URL for MCP platform
|
|
85
|
+
* Gets the base URL for MCP platform from configuration.
|
|
64
86
|
*
|
|
87
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
65
88
|
* @returns The base URL for MCP platform.
|
|
89
|
+
* @deprecated This method is for internal use only. Use ToolingConfiguration.mcpPlatformEndpoint instead.
|
|
66
90
|
*/
|
|
67
91
|
private static getMcpPlatformBaseUrl;
|
|
68
92
|
/**
|
|
69
93
|
* Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
|
|
70
94
|
*
|
|
95
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
71
96
|
* @returns An absolute URL that tooling components can use to send or retrieve chat messages for
|
|
72
97
|
* real-time threat protection scenarios.
|
|
73
98
|
* @remarks
|
|
74
99
|
* Call this method when constructing HTTP requests that need to access the chat-message history
|
|
75
100
|
* for real-time threat protection. The returned URL already includes the MCP platform base address
|
|
76
101
|
* and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
|
|
102
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService.sendChatHistory() instead.
|
|
77
103
|
*/
|
|
78
|
-
static GetChatHistoryEndpoint(): string;
|
|
104
|
+
static GetChatHistoryEndpoint(configProvider?: IConfigurationProvider<ToolingConfiguration>): string;
|
|
79
105
|
}
|
|
80
106
|
//# sourceMappingURL=Utility.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utility.d.ts","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"Utility.d.ts","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,OAAO,EAA6B,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAEnG,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAuC,MAAM,iBAAiB,CAAC;AAE5F,qBAAa,OAAO;IAClB,gBAAuB,iBAAiB,qBAAqB;IAC7D,gBAAuB,oBAAoB,wBAAwB;IACnE,gBAAuB,iBAAiB,gBAAgB;IACxD,0FAA0F;IAC1F,gBAAuB,eAAe,kBAAkB;IAExD;;;;;;;;OAQG;WACW,qBAAqB,CACjC,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,WAAW,EACzB,OAAO,CAAC,EAAE,WAAW,GACpB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IA+BzB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAsBtC;;;;;;OAMG;WACW,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAIpE;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqChC;;;;;;;;;;;;OAYG;WACW,iCAAiC,CAC7C,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,GAC5D,MAAM;IAIT;;;;;;OAMG;WACW,aAAa,CAAC,cAAc,CAAC,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,GAAG,MAAM;IAIlG;;;;;;;;;;;MAWE;WACY,iBAAiB,CAC7B,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,GAC5D,MAAM;IAKT;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAKpC;;;;;;;;;;;OAWG;WACW,sBAAsB,CAAC,cAAc,CAAC,EAAE,sBAAsB,CAAC,oBAAoB,CAAC,GAAG,MAAM;CAG5G"}
|
package/dist/esm/Utility.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { Utility as RuntimeUtility } from '@microsoft/agents-a365-runtime';
|
|
4
|
-
|
|
5
|
-
const MCP_PLATFORM_PROD_BASE_URL = 'https://agent365.svc.cloud.microsoft';
|
|
4
|
+
import { defaultToolingConfigurationProvider } from './configuration';
|
|
6
5
|
export class Utility {
|
|
7
6
|
/**
|
|
8
7
|
* Compose standard headers for MCP tooling requests.
|
|
@@ -17,6 +16,11 @@ export class Utility {
|
|
|
17
16
|
const headers = {};
|
|
18
17
|
if (authToken) {
|
|
19
18
|
headers['Authorization'] = `Bearer ${authToken}`;
|
|
19
|
+
// Add x-ms-agentid header with priority fallback (only when authToken present)
|
|
20
|
+
const agentId = this.resolveAgentIdForHeader(authToken, turnContext);
|
|
21
|
+
if (agentId) {
|
|
22
|
+
headers[Utility.HEADER_AGENT_ID] = agentId;
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
25
|
const channelId = turnContext?.activity?.channelId;
|
|
22
26
|
const subChannelId = turnContext?.activity?.channelIdSubChannel;
|
|
@@ -31,6 +35,33 @@ export class Utility {
|
|
|
31
35
|
}
|
|
32
36
|
return headers;
|
|
33
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the best available agent identifier for the x-ms-agentid header.
|
|
40
|
+
* Priority: TurnContext.agenticAppBlueprintId > token claims (xms_par_app_azp > appid > azp) > application name
|
|
41
|
+
*
|
|
42
|
+
* Note: This differs from RuntimeUtility.ResolveAgentIdentity() which resolves the agenticAppId
|
|
43
|
+
* for URL construction. This method resolves the identifier specifically for the x-ms-agentid header.
|
|
44
|
+
*
|
|
45
|
+
* @param authToken The authentication token to extract claims from.
|
|
46
|
+
* @param turnContext Optional TurnContext to extract agent blueprint ID from.
|
|
47
|
+
* @returns Agent ID string or undefined if not available.
|
|
48
|
+
*/
|
|
49
|
+
static resolveAgentIdForHeader(authToken, turnContext) {
|
|
50
|
+
// Priority 1: Agent Blueprint ID from TurnContext
|
|
51
|
+
// The 'from' property may include agenticAppBlueprintId when the request originates from an agentic app
|
|
52
|
+
const blueprintId = turnContext?.activity?.from?.agenticAppBlueprintId;
|
|
53
|
+
if (blueprintId) {
|
|
54
|
+
return blueprintId;
|
|
55
|
+
}
|
|
56
|
+
// Priority 2 & 3: Agent ID from token (xms_par_app_azp > appid > azp)
|
|
57
|
+
// Single decode, checks claims in priority order
|
|
58
|
+
const agentId = RuntimeUtility.getAgentIdFromToken(authToken);
|
|
59
|
+
if (agentId) {
|
|
60
|
+
return agentId;
|
|
61
|
+
}
|
|
62
|
+
// Priority 4: Application name from npm_package_name or package.json
|
|
63
|
+
return RuntimeUtility.getApplicationName();
|
|
64
|
+
}
|
|
34
65
|
/**
|
|
35
66
|
* Validates a JWT authentication token.
|
|
36
67
|
* Checks that the token is a valid JWT and is not expired.
|
|
@@ -86,22 +117,25 @@ export class Utility {
|
|
|
86
117
|
*
|
|
87
118
|
* Example:
|
|
88
119
|
* Utility.GetToolingGatewayForDigitalWorker(agenticAppId)
|
|
89
|
-
* // => "https://agent365.svc.cloud.microsoft/agents/{agenticAppId}/mcpServers"
|
|
120
|
+
* // => "https://agent365.svc.cloud.microsoft/agents/v2/{agenticAppId}/mcpServers"
|
|
90
121
|
*
|
|
91
122
|
* @param agenticAppId - The unique identifier for the agent identity.
|
|
123
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
92
124
|
* @returns A fully-qualified URL pointing at the tooling gateway for the agent.
|
|
125
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService.listToolServers() instead.
|
|
93
126
|
*/
|
|
94
|
-
static GetToolingGatewayForDigitalWorker(agenticAppId) {
|
|
95
|
-
|
|
96
|
-
return `${this.getMcpPlatformBaseUrl()}/agents/${agenticAppId}/mcpServers`;
|
|
127
|
+
static GetToolingGatewayForDigitalWorker(agenticAppId, configProvider) {
|
|
128
|
+
return `${this.getMcpPlatformBaseUrl(configProvider)}/agents/v2/${agenticAppId}/mcpServers`;
|
|
97
129
|
}
|
|
98
130
|
/**
|
|
99
131
|
* Get the base URL used to query MCP environments.
|
|
100
132
|
*
|
|
133
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
101
134
|
* @returns The base MCP environments URL.
|
|
135
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService instead.
|
|
102
136
|
*/
|
|
103
|
-
static GetMcpBaseUrl() {
|
|
104
|
-
return `${this.getMcpPlatformBaseUrl()}/agents/servers`;
|
|
137
|
+
static GetMcpBaseUrl(configProvider) {
|
|
138
|
+
return `${this.getMcpPlatformBaseUrl(configProvider)}/agents/servers`;
|
|
105
139
|
}
|
|
106
140
|
/**
|
|
107
141
|
* Build the full URL for accessing a specific MCP server.
|
|
@@ -111,38 +145,44 @@ export class Utility {
|
|
|
111
145
|
* // => "https://agent365.svc.cloud.microsoft/agents/servers/MyServer/"
|
|
112
146
|
*
|
|
113
147
|
* @param serverName - The MCP server resource name.
|
|
148
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
114
149
|
* @returns The fully-qualified MCP server URL including trailing slash.
|
|
150
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService instead.
|
|
115
151
|
*/
|
|
116
|
-
static BuildMcpServerUrl(serverName) {
|
|
117
|
-
const baseUrl = this.GetMcpBaseUrl();
|
|
118
|
-
return `${baseUrl}/${serverName}
|
|
152
|
+
static BuildMcpServerUrl(serverName, configProvider) {
|
|
153
|
+
const baseUrl = this.GetMcpBaseUrl(configProvider);
|
|
154
|
+
return `${baseUrl}/${serverName}/`;
|
|
119
155
|
}
|
|
120
156
|
/**
|
|
121
|
-
* Gets the base URL for MCP platform
|
|
157
|
+
* Gets the base URL for MCP platform from configuration.
|
|
122
158
|
*
|
|
159
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
123
160
|
* @returns The base URL for MCP platform.
|
|
161
|
+
* @deprecated This method is for internal use only. Use ToolingConfiguration.mcpPlatformEndpoint instead.
|
|
124
162
|
*/
|
|
125
|
-
static getMcpPlatformBaseUrl() {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
return MCP_PLATFORM_PROD_BASE_URL;
|
|
163
|
+
static getMcpPlatformBaseUrl(configProvider) {
|
|
164
|
+
const provider = configProvider ?? defaultToolingConfigurationProvider;
|
|
165
|
+
return provider.getConfiguration().mcpPlatformEndpoint;
|
|
130
166
|
}
|
|
131
167
|
/**
|
|
132
168
|
* Constructs the endpoint URL for sending chat history to the MCP platform for real-time threat protection.
|
|
133
169
|
*
|
|
170
|
+
* @param configProvider - Optional configuration provider. Defaults to defaultToolingConfigurationProvider.
|
|
134
171
|
* @returns An absolute URL that tooling components can use to send or retrieve chat messages for
|
|
135
172
|
* real-time threat protection scenarios.
|
|
136
173
|
* @remarks
|
|
137
174
|
* Call this method when constructing HTTP requests that need to access the chat-message history
|
|
138
175
|
* for real-time threat protection. The returned URL already includes the MCP platform base address
|
|
139
176
|
* and the fixed path segment `/agents/real-time-threat-protection/chat-message`.
|
|
177
|
+
* @deprecated This method is for internal use only. Use McpToolServerConfigurationService.sendChatHistory() instead.
|
|
140
178
|
*/
|
|
141
|
-
static GetChatHistoryEndpoint() {
|
|
142
|
-
return `${this.getMcpPlatformBaseUrl()}/agents/real-time-threat-protection/chat-message`;
|
|
179
|
+
static GetChatHistoryEndpoint(configProvider) {
|
|
180
|
+
return `${this.getMcpPlatformBaseUrl(configProvider)}/agents/real-time-threat-protection/chat-message`;
|
|
143
181
|
}
|
|
144
182
|
}
|
|
145
183
|
Utility.HEADER_CHANNEL_ID = 'x-ms-channel-id';
|
|
146
184
|
Utility.HEADER_SUBCHANNEL_ID = 'x-ms-subchannel-id';
|
|
147
185
|
Utility.HEADER_USER_AGENT = 'User-Agent';
|
|
186
|
+
/** Header name for sending the agent identifier to MCP platform for logging/analytics. */
|
|
187
|
+
Utility.HEADER_AGENT_ID = 'x-ms-agentid';
|
|
148
188
|
//# sourceMappingURL=Utility.js.map
|
package/dist/esm/Utility.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utility.js","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;
|
|
1
|
+
{"version":3,"file":"Utility.js","sourceRoot":"","sources":["../../src/Utility.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,OAAO,IAAI,cAAc,EAA0B,MA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CAAC,mBAAmB,CAAC;IACzD,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,sBAAsB,CAAC,cAA6D;QAChG,OAAO,GAAG,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,kDAAkD,CAAC;IACzG,CAAC;;AAvNsB,yBAAiB,GAAG,iBAAiB,CAAC;AACtC,4BAAoB,GAAG,oBAAoB,CAAC;AAC5C,yBAAiB,GAAG,YAAY,CAAC;AACxD,0FAA0F;AACnE,uBAAe,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { RuntimeConfiguration } from '@microsoft/agents-a365-runtime';
|
|
2
|
+
import { ToolingConfigurationOptions } from './ToolingConfigurationOptions';
|
|
3
|
+
import { MCPServerConfig } from '../contracts';
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the OAuth scope to request for a given MCP server.
|
|
6
|
+
*
|
|
7
|
+
* V2 servers carry their own audience in the `audience` field and get a per-audience token.
|
|
8
|
+
* V1 servers (no `audience`, or audience matching the shared scope's own audience in plain
|
|
9
|
+
* or api:// form) fall back to `sharedScope` — the configured mcpPlatformAuthenticationScope.
|
|
10
|
+
*
|
|
11
|
+
* @param server The MCP server config returned by the gateway or manifest.
|
|
12
|
+
* @param sharedScope The configured shared scope (mcpPlatformAuthenticationScope).
|
|
13
|
+
* Defaults to the prod ATG scope so that external callers without a custom config
|
|
14
|
+
* continue to work without passing the argument.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveTokenScopeForServer(server: MCPServerConfig, sharedScope?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Configuration for tooling package.
|
|
19
|
+
* Inherits runtime settings and adds tooling-specific settings.
|
|
20
|
+
*/
|
|
21
|
+
export declare class ToolingConfiguration extends RuntimeConfiguration {
|
|
22
|
+
protected get toolingOverrides(): ToolingConfigurationOptions;
|
|
23
|
+
constructor(overrides?: ToolingConfigurationOptions);
|
|
24
|
+
get mcpPlatformEndpoint(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to use the ToolingManifest.json file instead of gateway discovery.
|
|
27
|
+
* Returns true when NODE_ENV is set to 'development' (case-insensitive), or
|
|
28
|
+
* when explicitly overridden via configuration.
|
|
29
|
+
*/
|
|
30
|
+
get useToolingManifest(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Gets the MCP platform authentication scope.
|
|
33
|
+
* Used by AgenticAuthenticationService for token exchange.
|
|
34
|
+
* Trims whitespace to prevent token exchange failures.
|
|
35
|
+
*/
|
|
36
|
+
get mcpPlatformAuthenticationScope(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the dev-mode bearer token for an MCP server by name.
|
|
39
|
+
* Checks BEARER_TOKEN_<SERVERNAME_UPPER> first, then falls back to BEARER_TOKEN.
|
|
40
|
+
* Returns undefined when the variable is not set (no Authorization header will be attached).
|
|
41
|
+
*/
|
|
42
|
+
getBearerTokenForServer(mcpServerName: string): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Returns true when a per-server bearer token env var (BEARER_TOKEN_<SERVERNAME_UPPER>)
|
|
45
|
+
* is explicitly set for the given server, false when only the shared BEARER_TOKEN fallback
|
|
46
|
+
* would be used. Used to detect V2 servers that are silently falling back to a
|
|
47
|
+
* wrong-audience token in dev mode.
|
|
48
|
+
*/
|
|
49
|
+
hasPerServerBearerToken(mcpServerName: string): boolean;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=ToolingConfiguration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolingConfiguration.d.ts","sourceRoot":"","sources":["../../../src/configuration/ToolingConfiguration.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAM/C;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,eAAe,EACvB,WAAW,GAAE,MAA+C,GAC3D,MAAM,CAoBR;AAUD;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,oBAAoB;IAE5D,SAAS,KAAK,gBAAgB,IAAI,2BAA2B,CAE5D;gBAEW,SAAS,CAAC,EAAE,2BAA2B;IAMnD,IAAI,mBAAmB,IAAI,MAAM,CAQhC;IAED;;;;OAIG;IACH,IAAI,kBAAkB,IAAI,OAAO,CAKhC;IAED;;;;OAIG;IACH,IAAI,8BAA8B,IAAI,MAAM,CAQ3C;IAED;;;;OAIG;IACH,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKlE;;;;;OAKG;IACH,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;CAIxD"}
|