@transcend-io/mcp 2.1.0 → 2.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/README.md +18 -16
- package/dist/cli.mjs +35 -17
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +446 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{oauth-scopes-BFAI987v.mjs → oauth-scopes-B0TE4ubH.mjs} +274 -115
- package/dist/oauth-scopes-B0TE4ubH.mjs.map +1 -0
- package/package.json +17 -17
- package/dist/oauth-scopes-BFAI987v.mjs.map +0 -1
|
@@ -8,7 +8,7 @@ import { DocsCatalogMixin, getDocsTools } from "@transcend-io/mcp-server-docs";
|
|
|
8
8
|
import { DSRMixin, getDSRTools } from "@transcend-io/mcp-server-dsr";
|
|
9
9
|
import { InventoryMixin, getInventoryTools } from "@transcend-io/mcp-server-inventory";
|
|
10
10
|
import { WorkflowsMixin, getWorkflowTools } from "@transcend-io/mcp-server-workflows";
|
|
11
|
-
import { getConfigTools } from "@transcend-io/mcp-server-config";
|
|
11
|
+
import { getConfigTools, oauthScopesForConfigAllowlist } from "@transcend-io/mcp-server-config";
|
|
12
12
|
import { getConsentTools } from "@transcend-io/mcp-server-consent";
|
|
13
13
|
import { getPolicyTools } from "@transcend-io/mcp-server-policy";
|
|
14
14
|
import { getPreferenceTools } from "@transcend-io/mcp-server-preferences";
|
|
@@ -59,113 +59,6 @@ applyMixin(TranscendGraphQLClient, AssessmentsMixin);
|
|
|
59
59
|
applyMixin(TranscendGraphQLClient, WorkflowsMixin);
|
|
60
60
|
applyMixin(TranscendGraphQLClient, CustomFunctionsMixin);
|
|
61
61
|
//#endregion
|
|
62
|
-
//#region src/registry.ts
|
|
63
|
-
/**
|
|
64
|
-
* Confirmation policy for callers that drive the registry directly.
|
|
65
|
-
*
|
|
66
|
-
* Refuse, because there is no transport here to tell us a person is reachable:
|
|
67
|
-
* embedders call `executeTool` in-process, with no `elicitation/create` channel
|
|
68
|
-
* and nowhere to return an approval token to. The serving paths pick their own
|
|
69
|
-
* policy in `buildMcpServer` from the transport they are on.
|
|
70
|
-
*/
|
|
71
|
-
const EMBEDDED_GATE = { policy: ConfirmationPolicy.Refuse };
|
|
72
|
-
var ToolRegistry = class {
|
|
73
|
-
tools = /* @__PURE__ */ new Map();
|
|
74
|
-
jsonSchemaCache = /* @__PURE__ */ new Map();
|
|
75
|
-
clients;
|
|
76
|
-
logger = new SimpleLogger();
|
|
77
|
-
constructor(clients) {
|
|
78
|
-
this.clients = clients;
|
|
79
|
-
this.registerAllTools();
|
|
80
|
-
}
|
|
81
|
-
registerAllTools() {
|
|
82
|
-
this.registerToolsFromModule(getDocsTools(this.clients));
|
|
83
|
-
this.registerToolsFromModule(getDSRTools(this.clients));
|
|
84
|
-
this.registerToolsFromModule(getConsentTools(this.clients));
|
|
85
|
-
this.registerToolsFromModule(getCustomFunctionsTools(this.clients));
|
|
86
|
-
this.registerToolsFromModule(getPreferenceTools(this.clients));
|
|
87
|
-
this.registerToolsFromModule(getInventoryTools(this.clients));
|
|
88
|
-
this.registerToolsFromModule(getDiscoveryTools(this.clients));
|
|
89
|
-
this.registerToolsFromModule(getAssessmentTools(this.clients));
|
|
90
|
-
this.registerToolsFromModule(getWorkflowTools(this.clients));
|
|
91
|
-
this.registerToolsFromModule(getPolicyTools(this.clients));
|
|
92
|
-
this.registerToolsFromModule(getPrivacyCenterTools(this.clients));
|
|
93
|
-
this.registerToolsFromModule(getAdminTools(this.clients));
|
|
94
|
-
this.registerToolsFromModule(getConfigTools(this.clients));
|
|
95
|
-
}
|
|
96
|
-
registerToolsFromModule(tools) {
|
|
97
|
-
for (const tool of tools) {
|
|
98
|
-
if (!shouldRegisterTool(tool)) continue;
|
|
99
|
-
if (this.tools.has(tool.name)) {
|
|
100
|
-
this.logger.warn("Duplicate tool name - skipping", { toolName: tool.name });
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
this.tools.set(tool.name, tool);
|
|
104
|
-
this.jsonSchemaCache.set(tool.name, toolInputSchema(tool.zodSchema));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Tool descriptors as a host would see them.
|
|
109
|
-
*
|
|
110
|
-
* The serving path builds descriptors in `buildMcpServer` rather than here, so
|
|
111
|
-
* this method exists for callers embedding the registry directly. It still
|
|
112
|
-
* resolves capability variants and carries `_meta`, because a descriptor list
|
|
113
|
-
* that quietly disagreed with what the server actually serves would be worse
|
|
114
|
-
* than no method at all.
|
|
115
|
-
*/
|
|
116
|
-
getToolList(client = EMPTY_CAPABILITY_REPORT) {
|
|
117
|
-
const canApprove = canObtainApproval(EMBEDDED_GATE, client);
|
|
118
|
-
return expandToolsForClient(Array.from(this.tools.values()), client, EMBEDDED_GATE).filter((tool) => isVisibleToModel(tool)).filter((tool) => canApprove || !tool.confirmation).map((tool) => {
|
|
119
|
-
const resourceUri = tool.ui?.resource.uri;
|
|
120
|
-
return {
|
|
121
|
-
name: tool.name,
|
|
122
|
-
description: tool.description,
|
|
123
|
-
inputSchema: this.jsonSchemaCache.get(tool.name) || {
|
|
124
|
-
type: "object",
|
|
125
|
-
properties: {}
|
|
126
|
-
},
|
|
127
|
-
annotations: tool.annotations,
|
|
128
|
-
...resourceUri && { _meta: {
|
|
129
|
-
ui: { resourceUri },
|
|
130
|
-
"ui/resourceUri": resourceUri
|
|
131
|
-
} }
|
|
132
|
-
};
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
getTool(name) {
|
|
136
|
-
return this.tools.get(name);
|
|
137
|
-
}
|
|
138
|
-
async executeTool(name, args, client = EMPTY_CAPABILITY_REPORT) {
|
|
139
|
-
const registered = this.tools.get(name);
|
|
140
|
-
if (!registered) throw new Error(`Unknown tool: ${name}`);
|
|
141
|
-
const tool = withConfirmation(resolveToolVariant(registered, client), EMBEDDED_GATE);
|
|
142
|
-
const parseResult = tool.zodSchema.safeParse(args);
|
|
143
|
-
if (!parseResult.success) {
|
|
144
|
-
const issues = parseResult.error.issues.map((i) => `${i.path.join(".") || "input"}: ${i.message}`).join("; ");
|
|
145
|
-
throw new Error(`Invalid input: ${issues}`);
|
|
146
|
-
}
|
|
147
|
-
try {
|
|
148
|
-
return await tool.handler(parseResult.data);
|
|
149
|
-
} catch (error) {
|
|
150
|
-
return createErrorResult(error);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
getToolsByCategory(category) {
|
|
154
|
-
return Array.from(this.tools.values()).filter((tool) => tool.category === category);
|
|
155
|
-
}
|
|
156
|
-
getCategories() {
|
|
157
|
-
const categories = /* @__PURE__ */ new Set();
|
|
158
|
-
for (const tool of this.tools.values()) categories.add(tool.category);
|
|
159
|
-
return Array.from(categories);
|
|
160
|
-
}
|
|
161
|
-
getAllTools() {
|
|
162
|
-
return Array.from(this.tools.values());
|
|
163
|
-
}
|
|
164
|
-
getToolCount() {
|
|
165
|
-
return this.tools.size;
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
//#endregion
|
|
169
62
|
//#region ../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/lib/function.js
|
|
170
63
|
var require_function = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
171
64
|
var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
|
|
@@ -113750,7 +113643,10 @@ const WebhookHeader = import_lib.intersection([import_lib.type({
|
|
|
113750
113643
|
/** The value of the header. */
|
|
113751
113644
|
value: import_lib.string
|
|
113752
113645
|
}), import_lib.partial({
|
|
113753
|
-
/**
|
|
113646
|
+
/**
|
|
113647
|
+
* When true, the header value is write-only in inventory pull/preview and
|
|
113648
|
+
* should be supplied via `<<parameters.NAME>>` at push time.
|
|
113649
|
+
*/
|
|
113754
113650
|
isSecret: import_lib.boolean })]);
|
|
113755
113651
|
/**
|
|
113756
113652
|
* Input to define API keys that may be shared across data silos
|
|
@@ -114445,6 +114341,11 @@ const DataFlowInput = import_lib.intersection([import_lib.type({
|
|
|
114445
114341
|
*/
|
|
114446
114342
|
status: ConsentTrackerStatusCodec,
|
|
114447
114343
|
/**
|
|
114344
|
+
* Whether the data flow is marked as junk. Junk rows are hidden from triage.
|
|
114345
|
+
* Pull only writes this field when it is true.
|
|
114346
|
+
*/
|
|
114347
|
+
isJunk: import_lib.boolean,
|
|
114348
|
+
/**
|
|
114448
114349
|
* The email addresses of the employees within your company that are the go-to individuals
|
|
114449
114350
|
* for managing this data silo
|
|
114450
114351
|
*/
|
|
@@ -114480,6 +114381,11 @@ name: import_lib.string }), import_lib.partial({
|
|
|
114480
114381
|
*/
|
|
114481
114382
|
status: ConsentTrackerStatusCodec,
|
|
114482
114383
|
/**
|
|
114384
|
+
* Whether the cookie is marked as junk. Junk rows are hidden from triage.
|
|
114385
|
+
* Pull only writes this field when it is true.
|
|
114386
|
+
*/
|
|
114387
|
+
isJunk: import_lib.boolean,
|
|
114388
|
+
/**
|
|
114483
114389
|
* The email addresses of the employees within your company that are the go-to individuals
|
|
114484
114390
|
* for managing this data silo
|
|
114485
114391
|
*/
|
|
@@ -114510,6 +114416,11 @@ host: import_lib.string }), import_lib.partial({
|
|
|
114510
114416
|
/** Description of the site */
|
|
114511
114417
|
description: import_lib.string,
|
|
114512
114418
|
/**
|
|
114419
|
+
* Whether the host is included in the Airgap metadata.
|
|
114420
|
+
* Pull only writes this field when it is true.
|
|
114421
|
+
*/
|
|
114422
|
+
includeInMetadata: import_lib.boolean,
|
|
114423
|
+
/**
|
|
114513
114424
|
* The email addresses of the employees within your company that are the go-to individuals
|
|
114514
114425
|
* for managing this site
|
|
114515
114426
|
*/
|
|
@@ -114616,7 +114527,28 @@ const ConsentManagerInput = import_lib.partial({
|
|
|
114616
114527
|
consentVariants: import_lib.array(ConsentVariantInput),
|
|
114617
114528
|
consentThemes: import_lib.array(ConsentThemeInput),
|
|
114618
114529
|
/** Prefix modules on the bundle. Pull only, push ignores it (no public API to write them) */
|
|
114619
|
-
prefixModules: import_lib.array(ConsentManagerPrefixModuleInput)
|
|
114530
|
+
prefixModules: import_lib.array(ConsentManagerPrefixModuleInput),
|
|
114531
|
+
/**
|
|
114532
|
+
* Deployment webhook URL called when consent bundles are published.
|
|
114533
|
+
*
|
|
114534
|
+
* @example `webhookUrl: https://example.<<parameters.domain>>/consent-deploy`
|
|
114535
|
+
*/
|
|
114536
|
+
webhookUrl: import_lib.string,
|
|
114537
|
+
/**
|
|
114538
|
+
* Custom headers for the deployment webhook. Use `<<parameters.NAME>>` for
|
|
114539
|
+
* secret values and set `isSecret: true` so push preview does not log them.
|
|
114540
|
+
*
|
|
114541
|
+
* @example
|
|
114542
|
+
* `- name: x-transcend-token`
|
|
114543
|
+
* ` value: <<parameters.CONSENT_DEPLOY_TOKEN>>`
|
|
114544
|
+
* ` isSecret: true`
|
|
114545
|
+
*/
|
|
114546
|
+
webhookHeaders: import_lib.array(WebhookHeader),
|
|
114547
|
+
/**
|
|
114548
|
+
* When true, traffic is report-only (enforcement off).
|
|
114549
|
+
* Deploy the bundle after push for the live /cm bundle to change.
|
|
114550
|
+
*/
|
|
114551
|
+
reportOnly: import_lib.boolean
|
|
114620
114552
|
});
|
|
114621
114553
|
/** One privacy center branding asset in transcend.yml */
|
|
114622
114554
|
const PrivacyCenterBrandingAssetInput = import_lib.partial({
|
|
@@ -116919,7 +116851,9 @@ import_lib.intersection([import_lib.type({
|
|
|
116919
116851
|
/** Authentication level required for the purpose */
|
|
116920
116852
|
"auth-level": valuesOf(PreferenceStoreAuthLevel),
|
|
116921
116853
|
/** Opt-out signals that instantly opt out of this purpose */
|
|
116922
|
-
"opt-out-signals": import_lib.array(valuesOf(UserPrivacySignalEnum))
|
|
116854
|
+
"opt-out-signals": import_lib.array(valuesOf(UserPrivacySignalEnum)),
|
|
116855
|
+
/** Default consent (not pushed; use consent-manager.experiences[].optedOutPurposes) */
|
|
116856
|
+
"default-consent": valuesOf(DefaultConsentOption)
|
|
116923
116857
|
})]);
|
|
116924
116858
|
(0, import_graphql.parse)(gql`
|
|
116925
116859
|
query TranscendCliPreferenceOptionValues($first: Int!, $offset: Int!) {
|
|
@@ -117249,8 +117183,10 @@ gql`
|
|
|
117249
117183
|
consentManager {
|
|
117250
117184
|
consentManager {
|
|
117251
117185
|
id
|
|
117186
|
+
off
|
|
117252
117187
|
bundleURL
|
|
117253
117188
|
testBundleURL
|
|
117189
|
+
webhookUrl
|
|
117254
117190
|
configuration {
|
|
117255
117191
|
domains
|
|
117256
117192
|
consentPrecedence
|
|
@@ -117297,6 +117233,16 @@ gql`
|
|
|
117297
117233
|
}
|
|
117298
117234
|
}
|
|
117299
117235
|
`;
|
|
117236
|
+
gql`
|
|
117237
|
+
mutation TranscendCliUpdateConsentManagerDeploymentWebhook(
|
|
117238
|
+
$airgapBundleId: ID!
|
|
117239
|
+
$input: UpdateConsentManagerInput!
|
|
117240
|
+
) {
|
|
117241
|
+
updateConsentManager(id: $airgapBundleId, input: $input) {
|
|
117242
|
+
clientMutationId
|
|
117243
|
+
}
|
|
117244
|
+
}
|
|
117245
|
+
`;
|
|
117300
117246
|
gql`
|
|
117301
117247
|
mutation TranscendCliUpdateConsentManagerToLatest(
|
|
117302
117248
|
$airgapBundleId: ID!
|
|
@@ -117391,6 +117337,15 @@ gql`
|
|
|
117391
117337
|
}
|
|
117392
117338
|
}
|
|
117393
117339
|
`;
|
|
117340
|
+
gql`
|
|
117341
|
+
mutation TranscendCliToggleConsentManagerEnforcement(
|
|
117342
|
+
$input: ToggleConsentManagerEnforcementInput!
|
|
117343
|
+
) {
|
|
117344
|
+
toggleConsentManagerEnforcement(input: $input) {
|
|
117345
|
+
clientMutationId
|
|
117346
|
+
}
|
|
117347
|
+
}
|
|
117348
|
+
`;
|
|
117394
117349
|
gql`
|
|
117395
117350
|
mutation TranscendCliUpdateConsentManagerTheme($input: UpdateConsentManagerThemeInput!) {
|
|
117396
117351
|
updateConsentManagerTheme(input: $input) {
|
|
@@ -117656,6 +117611,32 @@ gql`
|
|
|
117656
117611
|
}
|
|
117657
117612
|
}
|
|
117658
117613
|
`;
|
|
117614
|
+
/** Deploy status of the consent manager, aligned with BundleDeployStatus in the GraphQL schema */
|
|
117615
|
+
const TranscendConsentManagerDeployState = {
|
|
117616
|
+
/** Deploy completed successfully */
|
|
117617
|
+
Deployed: "DEPLOYED",
|
|
117618
|
+
/** Deploy in progress */
|
|
117619
|
+
DeployPending: "DEPLOY_PENDING",
|
|
117620
|
+
/** Preview deploy */
|
|
117621
|
+
Preview: "PREVIEW",
|
|
117622
|
+
/** Rollback in progress */
|
|
117623
|
+
RollbackPending: "ROLLBACK_PENDING",
|
|
117624
|
+
/** Deploy failed */
|
|
117625
|
+
Error: "ERROR",
|
|
117626
|
+
/** Test deploy failed */
|
|
117627
|
+
TestError: "TEST_ERROR"
|
|
117628
|
+
};
|
|
117629
|
+
gql`
|
|
117630
|
+
query TranscendCliFetchConsentManagerDeployState {
|
|
117631
|
+
consentManager {
|
|
117632
|
+
consentManager {
|
|
117633
|
+
state
|
|
117634
|
+
deployError
|
|
117635
|
+
lastDeployedAt
|
|
117636
|
+
}
|
|
117637
|
+
}
|
|
117638
|
+
}
|
|
117639
|
+
`;
|
|
117659
117640
|
gql`
|
|
117660
117641
|
query TranscendCliConsentSites(
|
|
117661
117642
|
$input: AirgapBundleInput!
|
|
@@ -118332,6 +118313,8 @@ gql`
|
|
|
118332
118313
|
}
|
|
118333
118314
|
}
|
|
118334
118315
|
`);
|
|
118316
|
+
TranscendConsentManagerDeployState.DeployPending, TranscendConsentManagerDeployState.RollbackPending;
|
|
118317
|
+
TranscendConsentManagerDeployState.Error, TranscendConsentManagerDeployState.TestError;
|
|
118335
118318
|
gql`
|
|
118336
118319
|
query TranscendCliActions($first: Int!, $offset: Int!) {
|
|
118337
118320
|
actions(
|
|
@@ -119871,10 +119854,186 @@ const MCP_SERVER_OAUTH_SCOPES = {
|
|
|
119871
119854
|
["workflows"]: [ScopeName.ViewEmailTemplates, ScopeName.ManageEmailTemplates]
|
|
119872
119855
|
};
|
|
119873
119856
|
//#endregion
|
|
119857
|
+
//#region src/mcp-server-allowlist.ts
|
|
119858
|
+
const TRANSCEND_MCP_SERVERS_ENV = "TRANSCEND_MCP_SERVERS";
|
|
119859
|
+
/** Docs tools are not a {@link TranscendMcpServer} domain; allowlist uses this token. */
|
|
119860
|
+
const MCP_ALLOWLIST_DOCS = "docs";
|
|
119861
|
+
const VALID_MCP_SERVER_NAMES = [...Object.values(TranscendMcpServer), MCP_ALLOWLIST_DOCS];
|
|
119862
|
+
function formatValidMcpServerNames() {
|
|
119863
|
+
return VALID_MCP_SERVER_NAMES.join(", ");
|
|
119864
|
+
}
|
|
119865
|
+
/**
|
|
119866
|
+
* Comma-separated {@link TranscendMcpServer} values plus `docs`.
|
|
119867
|
+
* Returns `undefined` when unset so all domains register.
|
|
119868
|
+
*/
|
|
119869
|
+
function parseMcpServerAllowlistFromEnv() {
|
|
119870
|
+
const raw = process.env[TRANSCEND_MCP_SERVERS_ENV]?.trim();
|
|
119871
|
+
if (!raw) return void 0;
|
|
119872
|
+
const tokens = raw.split(",").map((name) => name.trim()).filter(Boolean);
|
|
119873
|
+
if (tokens.length === 0) return void 0;
|
|
119874
|
+
const unknown = [];
|
|
119875
|
+
const allowlist = /* @__PURE__ */ new Set();
|
|
119876
|
+
for (const token of tokens) {
|
|
119877
|
+
if (token === "docs") {
|
|
119878
|
+
allowlist.add(MCP_ALLOWLIST_DOCS);
|
|
119879
|
+
continue;
|
|
119880
|
+
}
|
|
119881
|
+
if (Object.values(TranscendMcpServer).includes(token)) {
|
|
119882
|
+
allowlist.add(token);
|
|
119883
|
+
continue;
|
|
119884
|
+
}
|
|
119885
|
+
unknown.push(token);
|
|
119886
|
+
}
|
|
119887
|
+
if (unknown.length > 0) throw new Error(`Unknown ${TRANSCEND_MCP_SERVERS_ENV} value(s): ${unknown.join(", ")}. Valid values: ${formatValidMcpServerNames()}.`);
|
|
119888
|
+
return allowlist;
|
|
119889
|
+
}
|
|
119890
|
+
/** Effective server allowlist: every domain plus docs when env is unset. */
|
|
119891
|
+
function resolveMcpServerAllowlist() {
|
|
119892
|
+
const parsed = parseMcpServerAllowlistFromEnv();
|
|
119893
|
+
if (parsed) return parsed;
|
|
119894
|
+
return new Set([...Object.values(TranscendMcpServer), MCP_ALLOWLIST_DOCS]);
|
|
119895
|
+
}
|
|
119896
|
+
function allowlistIncludesDocs(allowlist) {
|
|
119897
|
+
return allowlist.has(MCP_ALLOWLIST_DOCS);
|
|
119898
|
+
}
|
|
119899
|
+
function allowlistIncludesServer(allowlist, server) {
|
|
119900
|
+
return allowlist.has(server);
|
|
119901
|
+
}
|
|
119902
|
+
//#endregion
|
|
119903
|
+
//#region src/registry.ts
|
|
119904
|
+
/**
|
|
119905
|
+
* Confirmation policy for callers that drive the registry directly.
|
|
119906
|
+
*
|
|
119907
|
+
* Refuse, because there is no transport here to tell us a person is reachable:
|
|
119908
|
+
* embedders call `executeTool` in-process, with no `elicitation/create` channel
|
|
119909
|
+
* and nowhere to return an approval token to. The serving paths pick their own
|
|
119910
|
+
* policy in `buildMcpServer` from the transport they are on.
|
|
119911
|
+
*/
|
|
119912
|
+
const EMBEDDED_GATE = { policy: ConfirmationPolicy.Refuse };
|
|
119913
|
+
var ToolRegistry = class {
|
|
119914
|
+
tools = /* @__PURE__ */ new Map();
|
|
119915
|
+
jsonSchemaCache = /* @__PURE__ */ new Map();
|
|
119916
|
+
clients;
|
|
119917
|
+
logger = new SimpleLogger();
|
|
119918
|
+
constructor(clients, allowlist = resolveMcpServerAllowlist()) {
|
|
119919
|
+
this.clients = clients;
|
|
119920
|
+
this.registerAllTools(allowlist);
|
|
119921
|
+
}
|
|
119922
|
+
registerAllTools(allowlist) {
|
|
119923
|
+
const maybeRegister = (entry, tools) => {
|
|
119924
|
+
if (!allowlist.has(entry)) return;
|
|
119925
|
+
this.registerToolsFromModule(tools);
|
|
119926
|
+
};
|
|
119927
|
+
maybeRegister(MCP_ALLOWLIST_DOCS, getDocsTools(this.clients));
|
|
119928
|
+
maybeRegister(TranscendMcpServer.Dsr, getDSRTools(this.clients));
|
|
119929
|
+
maybeRegister(TranscendMcpServer.Consent, getConsentTools(this.clients));
|
|
119930
|
+
maybeRegister(TranscendMcpServer.CustomFunctions, getCustomFunctionsTools(this.clients));
|
|
119931
|
+
maybeRegister(TranscendMcpServer.Preferences, getPreferenceTools(this.clients));
|
|
119932
|
+
maybeRegister(TranscendMcpServer.Inventory, getInventoryTools(this.clients));
|
|
119933
|
+
maybeRegister(TranscendMcpServer.Discovery, getDiscoveryTools(this.clients));
|
|
119934
|
+
maybeRegister(TranscendMcpServer.Assessment, getAssessmentTools(this.clients));
|
|
119935
|
+
maybeRegister(TranscendMcpServer.Workflows, getWorkflowTools(this.clients));
|
|
119936
|
+
maybeRegister(TranscendMcpServer.Policy, getPolicyTools(this.clients));
|
|
119937
|
+
maybeRegister(TranscendMcpServer.PrivacyCenter, getPrivacyCenterTools(this.clients));
|
|
119938
|
+
maybeRegister(TranscendMcpServer.Admin, getAdminTools(this.clients));
|
|
119939
|
+
maybeRegister(TranscendMcpServer.Config, getConfigTools(this.clients));
|
|
119940
|
+
}
|
|
119941
|
+
registerToolsFromModule(tools) {
|
|
119942
|
+
for (const tool of tools) {
|
|
119943
|
+
if (!shouldRegisterTool(tool)) continue;
|
|
119944
|
+
if (this.tools.has(tool.name)) {
|
|
119945
|
+
this.logger.warn("Duplicate tool name - skipping", { toolName: tool.name });
|
|
119946
|
+
continue;
|
|
119947
|
+
}
|
|
119948
|
+
this.tools.set(tool.name, tool);
|
|
119949
|
+
this.jsonSchemaCache.set(tool.name, toolInputSchema(tool.zodSchema));
|
|
119950
|
+
}
|
|
119951
|
+
}
|
|
119952
|
+
/**
|
|
119953
|
+
* Tool descriptors as a host would see them.
|
|
119954
|
+
*
|
|
119955
|
+
* The serving path builds descriptors in `buildMcpServer` rather than here, so
|
|
119956
|
+
* this method exists for callers embedding the registry directly. It still
|
|
119957
|
+
* resolves capability variants and carries `_meta`, because a descriptor list
|
|
119958
|
+
* that quietly disagreed with what the server actually serves would be worse
|
|
119959
|
+
* than no method at all.
|
|
119960
|
+
*/
|
|
119961
|
+
getToolList(client = EMPTY_CAPABILITY_REPORT) {
|
|
119962
|
+
const canApprove = canObtainApproval(EMBEDDED_GATE, client);
|
|
119963
|
+
return expandToolsForClient(Array.from(this.tools.values()), client, EMBEDDED_GATE).filter((tool) => isVisibleToModel(tool)).filter((tool) => canApprove || !tool.confirmation).map((tool) => {
|
|
119964
|
+
const resourceUri = tool.ui?.resource.uri;
|
|
119965
|
+
return {
|
|
119966
|
+
name: tool.name,
|
|
119967
|
+
description: tool.description,
|
|
119968
|
+
inputSchema: this.jsonSchemaCache.get(tool.name) || {
|
|
119969
|
+
type: "object",
|
|
119970
|
+
properties: {}
|
|
119971
|
+
},
|
|
119972
|
+
annotations: tool.annotations,
|
|
119973
|
+
...resourceUri && { _meta: {
|
|
119974
|
+
ui: { resourceUri },
|
|
119975
|
+
"ui/resourceUri": resourceUri
|
|
119976
|
+
} }
|
|
119977
|
+
};
|
|
119978
|
+
});
|
|
119979
|
+
}
|
|
119980
|
+
getTool(name) {
|
|
119981
|
+
return this.tools.get(name);
|
|
119982
|
+
}
|
|
119983
|
+
async executeTool(name, args, client = EMPTY_CAPABILITY_REPORT) {
|
|
119984
|
+
const registered = this.tools.get(name);
|
|
119985
|
+
if (!registered) throw new Error(`Unknown tool: ${name}`);
|
|
119986
|
+
const tool = withConfirmation(resolveToolVariant(registered, client), EMBEDDED_GATE);
|
|
119987
|
+
const parseResult = tool.zodSchema.safeParse(args);
|
|
119988
|
+
if (!parseResult.success) {
|
|
119989
|
+
const issues = parseResult.error.issues.map((i) => `${i.path.join(".") || "input"}: ${i.message}`).join("; ");
|
|
119990
|
+
throw new Error(`Invalid input: ${issues}`);
|
|
119991
|
+
}
|
|
119992
|
+
try {
|
|
119993
|
+
return await tool.handler(parseResult.data);
|
|
119994
|
+
} catch (error) {
|
|
119995
|
+
return createErrorResult(error);
|
|
119996
|
+
}
|
|
119997
|
+
}
|
|
119998
|
+
getToolsByCategory(category) {
|
|
119999
|
+
return Array.from(this.tools.values()).filter((tool) => tool.category === category);
|
|
120000
|
+
}
|
|
120001
|
+
getCategories() {
|
|
120002
|
+
const categories = /* @__PURE__ */ new Set();
|
|
120003
|
+
for (const tool of this.tools.values()) categories.add(tool.category);
|
|
120004
|
+
return Array.from(categories);
|
|
120005
|
+
}
|
|
120006
|
+
getAllTools() {
|
|
120007
|
+
return Array.from(this.tools.values());
|
|
120008
|
+
}
|
|
120009
|
+
getToolCount() {
|
|
120010
|
+
return this.tools.size;
|
|
120011
|
+
}
|
|
120012
|
+
};
|
|
120013
|
+
//#endregion
|
|
119874
120014
|
//#region src/oauth-scopes.ts
|
|
119875
|
-
/**
|
|
119876
|
-
|
|
120015
|
+
/**
|
|
120016
|
+
* OAuth scopes for the unified MCP server (offline_access added by base).
|
|
120017
|
+
*
|
|
120018
|
+
* Only requests scopes for allowlisted servers. When `config` is allowlisted and
|
|
120019
|
+
* `configResources` is set, config scopes are capped to those resources. Callers
|
|
120020
|
+
* parse the env vars, so this function reads none.
|
|
120021
|
+
*/
|
|
120022
|
+
function resolveUmbrellaOAuthScopes(allowlist, configResources) {
|
|
120023
|
+
const scopeSets = [];
|
|
120024
|
+
for (const server of Object.values(TranscendMcpServer)) {
|
|
120025
|
+
if (!allowlistIncludesServer(allowlist, server)) continue;
|
|
120026
|
+
if (server === TranscendMcpServer.Config && configResources) {
|
|
120027
|
+
scopeSets.push([...oauthScopesForConfigAllowlist(configResources)]);
|
|
120028
|
+
continue;
|
|
120029
|
+
}
|
|
120030
|
+
scopeSets.push([...MCP_SERVER_OAUTH_SCOPES[server]]);
|
|
120031
|
+
}
|
|
120032
|
+
return mergeOAuthScopes(...scopeSets);
|
|
120033
|
+
}
|
|
120034
|
+
/** Every domain scope with no env input. Use `resolveUmbrellaOAuthScopes` to narrow. */
|
|
120035
|
+
const UMBRELLA_OAUTH_SCOPES = resolveUmbrellaOAuthScopes(new Set([...Object.values(TranscendMcpServer), MCP_ALLOWLIST_DOCS]), void 0);
|
|
119877
120036
|
//#endregion
|
|
119878
|
-
export {
|
|
120037
|
+
export { TRANSCEND_MCP_SERVERS_ENV as a, formatValidMcpServerNames as c, TranscendMcpServer as d, TranscendGraphQLClient as f, MCP_ALLOWLIST_DOCS as i, parseMcpServerAllowlistFromEnv as l, resolveUmbrellaOAuthScopes as n, allowlistIncludesDocs as o, ToolRegistry as r, allowlistIncludesServer as s, UMBRELLA_OAUTH_SCOPES as t, resolveMcpServerAllowlist as u };
|
|
119879
120038
|
|
|
119880
|
-
//# sourceMappingURL=oauth-scopes-
|
|
120039
|
+
//# sourceMappingURL=oauth-scopes-B0TE4ubH.mjs.map
|