trigger.dev 0.0.0-v3-prerelease-20250108142426 → 0.0.0-v4-prerelease-20250917185130
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 +28 -1
- package/dist/esm/apiClient.d.ts +158 -74
- package/dist/esm/apiClient.js +341 -76
- package/dist/esm/apiClient.js.map +1 -1
- package/dist/esm/build/buildWorker.d.ts +10 -6
- package/dist/esm/build/buildWorker.js +22 -38
- package/dist/esm/build/buildWorker.js.map +1 -1
- package/dist/esm/build/bundle.d.ts +18 -1
- package/dist/esm/build/bundle.js +142 -52
- package/dist/esm/build/bundle.js.map +1 -1
- package/dist/esm/build/entryPoints.d.ts +12 -0
- package/dist/esm/build/entryPoints.js +127 -0
- package/dist/esm/build/entryPoints.js.map +1 -0
- package/dist/esm/build/extensions.js +17 -0
- package/dist/esm/build/extensions.js.map +1 -1
- package/dist/esm/build/externals.js +184 -2
- package/dist/esm/build/externals.js.map +1 -1
- package/dist/esm/build/packageModules.d.ts +15 -5
- package/dist/esm/build/packageModules.js +154 -36
- package/dist/esm/build/packageModules.js.map +1 -1
- package/dist/esm/cli/common.d.ts +1 -1
- package/dist/esm/cli/common.js +38 -45
- package/dist/esm/cli/common.js.map +1 -1
- package/dist/esm/cli/index.js +19 -3
- package/dist/esm/cli/index.js.map +1 -1
- package/dist/esm/commands/analyze.d.ts +23 -0
- package/dist/esm/commands/analyze.js +122 -0
- package/dist/esm/commands/analyze.js.map +1 -0
- package/dist/esm/commands/deploy.d.ts +5 -2
- package/dist/esm/commands/deploy.js +271 -160
- package/dist/esm/commands/deploy.js.map +1 -1
- package/dist/esm/commands/dev.d.ts +36 -6
- package/dist/esm/commands/dev.js +71 -2
- package/dist/esm/commands/dev.js.map +1 -1
- package/dist/esm/commands/env.d.ts +2 -0
- package/dist/esm/commands/env.js +298 -0
- package/dist/esm/commands/env.js.map +1 -0
- package/dist/esm/commands/init.d.ts +9 -1
- package/dist/esm/commands/init.js +132 -65
- package/dist/esm/commands/init.js.map +1 -1
- package/dist/esm/commands/install-mcp.d.ts +50 -0
- package/dist/esm/commands/install-mcp.js +497 -0
- package/dist/esm/commands/install-mcp.js.map +1 -0
- package/dist/esm/commands/install-rules.d.ts +11 -0
- package/dist/esm/commands/install-rules.js +381 -0
- package/dist/esm/commands/install-rules.js.map +1 -0
- package/dist/esm/commands/list-profiles.d.ts +3 -7
- package/dist/esm/commands/list-profiles.js +7 -4
- package/dist/esm/commands/list-profiles.js.map +1 -1
- package/dist/esm/commands/login.d.ts +9 -5
- package/dist/esm/commands/login.js +40 -7
- package/dist/esm/commands/login.js.map +1 -1
- package/dist/esm/commands/logout.d.ts +1 -1
- package/dist/esm/commands/mcp.d.ts +38 -0
- package/dist/esm/commands/mcp.js +82 -0
- package/dist/esm/commands/mcp.js.map +1 -0
- package/dist/esm/commands/preview.d.ts +5 -0
- package/dist/esm/commands/preview.js +93 -0
- package/dist/esm/commands/preview.js.map +1 -0
- package/dist/esm/commands/promote.d.ts +3 -0
- package/dist/esm/commands/promote.js +86 -0
- package/dist/esm/commands/promote.js.map +1 -0
- package/dist/esm/commands/switch.d.ts +19 -0
- package/dist/esm/commands/switch.js +93 -0
- package/dist/esm/commands/switch.js.map +1 -0
- package/dist/esm/commands/trigger.d.ts +33 -0
- package/dist/esm/commands/trigger.js +88 -0
- package/dist/esm/commands/trigger.js.map +1 -0
- package/dist/esm/commands/update.d.ts +3 -2
- package/dist/esm/commands/update.js +23 -9
- package/dist/esm/commands/update.js.map +1 -1
- package/dist/esm/commands/whoami.d.ts +12 -1
- package/dist/esm/commands/whoami.js +36 -6
- package/dist/esm/commands/whoami.js.map +1 -1
- package/dist/esm/commands/workers/build.d.ts +4 -0
- package/dist/esm/commands/workers/build.js +345 -0
- package/dist/esm/commands/workers/build.js.map +1 -0
- package/dist/esm/commands/workers/create.d.ts +2 -0
- package/dist/esm/commands/workers/create.js +91 -0
- package/dist/esm/commands/workers/create.js.map +1 -0
- package/dist/esm/commands/workers/index.d.ts +2 -0
- package/dist/esm/commands/workers/index.js +13 -0
- package/dist/esm/commands/workers/index.js.map +1 -0
- package/dist/esm/commands/workers/list.d.ts +2 -0
- package/dist/esm/commands/workers/list.js +80 -0
- package/dist/esm/commands/workers/list.js.map +1 -0
- package/dist/esm/commands/workers/run.d.ts +2 -0
- package/dist/esm/commands/workers/run.js +105 -0
- package/dist/esm/commands/workers/run.js.map +1 -0
- package/dist/esm/config.d.ts +2 -1
- package/dist/esm/config.js +35 -8
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/deploy/buildImage.d.ts +12 -11
- package/dist/esm/deploy/buildImage.js +360 -115
- package/dist/esm/deploy/buildImage.js.map +1 -1
- package/dist/esm/dev/backgroundWorker.d.ts +6 -245
- package/dist/esm/dev/backgroundWorker.js +11 -320
- package/dist/esm/dev/backgroundWorker.js.map +1 -1
- package/dist/esm/dev/devOutput.js +48 -9
- package/dist/esm/dev/devOutput.js.map +1 -1
- package/dist/esm/dev/devSession.d.ts +2 -1
- package/dist/esm/dev/devSession.js +68 -65
- package/dist/esm/dev/devSession.js.map +1 -1
- package/dist/esm/dev/devSupervisor.d.ts +12 -0
- package/dist/esm/dev/devSupervisor.js +568 -0
- package/dist/esm/dev/devSupervisor.js.map +1 -0
- package/dist/esm/dev/lock.d.ts +1 -0
- package/dist/esm/dev/lock.js +80 -0
- package/dist/esm/dev/lock.js.map +1 -0
- package/dist/esm/dev/mcpServer.d.ts +10 -0
- package/dist/esm/dev/mcpServer.js +201 -0
- package/dist/esm/dev/mcpServer.js.map +1 -0
- package/dist/esm/dev/taskRunProcessPool.d.ts +39 -0
- package/dist/esm/dev/taskRunProcessPool.js +220 -0
- package/dist/esm/dev/taskRunProcessPool.js.map +1 -0
- package/dist/esm/dev/workerRuntime.d.ts +2 -2
- package/dist/esm/dev/workerRuntime.js +1 -265
- package/dist/esm/dev/workerRuntime.js.map +1 -1
- package/dist/esm/entryPoints/dev-index-worker.js +45 -8
- package/dist/esm/entryPoints/dev-index-worker.js.map +1 -1
- package/dist/esm/entryPoints/dev-run-controller.d.ts +58 -0
- package/dist/esm/entryPoints/dev-run-controller.js +652 -0
- package/dist/esm/entryPoints/dev-run-controller.js.map +1 -0
- package/dist/esm/entryPoints/dev-run-worker.js +394 -199
- package/dist/esm/entryPoints/dev-run-worker.js.map +1 -1
- package/dist/esm/entryPoints/managed/controller.d.ts +63 -0
- package/dist/esm/entryPoints/managed/controller.js +502 -0
- package/dist/esm/entryPoints/managed/controller.js.map +1 -0
- package/dist/esm/entryPoints/managed/env.d.ts +170 -0
- package/dist/esm/entryPoints/managed/env.js +199 -0
- package/dist/esm/entryPoints/managed/env.js.map +1 -0
- package/dist/esm/entryPoints/managed/execution.d.ts +143 -0
- package/dist/esm/entryPoints/managed/execution.js +901 -0
- package/dist/esm/entryPoints/managed/execution.js.map +1 -0
- package/dist/esm/entryPoints/managed/logger.d.ts +30 -0
- package/dist/esm/entryPoints/managed/logger.js +47 -0
- package/dist/esm/entryPoints/managed/logger.js.map +1 -0
- package/dist/esm/entryPoints/managed/notifier.d.ts +30 -0
- package/dist/esm/entryPoints/managed/notifier.js +63 -0
- package/dist/esm/entryPoints/managed/notifier.js.map +1 -0
- package/dist/esm/entryPoints/managed/overrides.d.ts +18 -0
- package/dist/esm/entryPoints/managed/overrides.js +19 -0
- package/dist/esm/entryPoints/managed/overrides.js.map +1 -0
- package/dist/esm/entryPoints/managed/poller.d.ts +31 -0
- package/dist/esm/entryPoints/managed/poller.js +89 -0
- package/dist/esm/entryPoints/managed/poller.js.map +1 -0
- package/dist/esm/entryPoints/managed/snapshot.d.ts +54 -0
- package/dist/esm/entryPoints/managed/snapshot.js +293 -0
- package/dist/esm/entryPoints/managed/snapshot.js.map +1 -0
- package/dist/esm/entryPoints/managed/taskRunProcessProvider.d.ts +62 -0
- package/dist/esm/entryPoints/managed/taskRunProcessProvider.js +252 -0
- package/dist/esm/entryPoints/managed/taskRunProcessProvider.js.map +1 -0
- package/dist/esm/entryPoints/{deploy-index-controller.js → managed-index-controller.js} +27 -3
- package/dist/esm/entryPoints/managed-index-controller.js.map +1 -0
- package/dist/esm/entryPoints/{deploy-index-worker.js → managed-index-worker.js} +50 -21
- package/dist/esm/entryPoints/managed-index-worker.js.map +1 -0
- package/dist/esm/entryPoints/managed-run-controller.js +13 -0
- package/dist/esm/entryPoints/managed-run-controller.js.map +1 -0
- package/dist/esm/entryPoints/managed-run-worker.js +512 -0
- package/dist/esm/entryPoints/managed-run-worker.js.map +1 -0
- package/dist/esm/executions/taskRunProcess.d.ts +28 -82
- package/dist/esm/executions/taskRunProcess.js +130 -74
- package/dist/esm/executions/taskRunProcess.js.map +1 -1
- package/dist/esm/indexing/indexWorkerManifest.d.ts +21 -5
- package/dist/esm/indexing/indexWorkerManifest.js +4 -4
- package/dist/esm/indexing/indexWorkerManifest.js.map +1 -1
- package/dist/esm/indexing/registerResources.d.ts +5 -0
- package/dist/esm/indexing/registerResources.js +44 -0
- package/dist/esm/indexing/registerResources.js.map +1 -0
- package/dist/esm/mcp/auth.d.ts +12 -0
- package/dist/esm/mcp/auth.js +152 -0
- package/dist/esm/mcp/auth.js.map +1 -0
- package/dist/esm/mcp/capabilities.d.ts +4 -0
- package/dist/esm/mcp/capabilities.js +22 -0
- package/dist/esm/mcp/capabilities.js.map +1 -0
- package/dist/esm/mcp/config.d.ts +82 -0
- package/dist/esm/mcp/config.js +87 -0
- package/dist/esm/mcp/config.js.map +1 -0
- package/dist/esm/mcp/context.d.ts +45 -0
- package/dist/esm/mcp/context.js +129 -0
- package/dist/esm/mcp/context.js.map +1 -0
- package/dist/esm/mcp/formatters.d.ts +7 -0
- package/dist/esm/mcp/formatters.js +330 -0
- package/dist/esm/mcp/formatters.js.map +1 -0
- package/dist/esm/mcp/logger.d.ts +11 -0
- package/dist/esm/mcp/logger.js +34 -0
- package/dist/esm/mcp/logger.js.map +1 -0
- package/dist/esm/mcp/mintlifyClient.d.ts +1 -0
- package/dist/esm/mcp/mintlifyClient.js +65 -0
- package/dist/esm/mcp/mintlifyClient.js.map +1 -0
- package/dist/esm/mcp/schemas.d.ts +324 -0
- package/dist/esm/mcp/schemas.js +144 -0
- package/dist/esm/mcp/schemas.js.map +1 -0
- package/dist/esm/mcp/tools/deploys.d.ts +174 -0
- package/dist/esm/mcp/tools/deploys.js +161 -0
- package/dist/esm/mcp/tools/deploys.js.map +1 -0
- package/dist/esm/mcp/tools/docs.d.ts +77 -0
- package/dist/esm/mcp/tools/docs.js +18 -0
- package/dist/esm/mcp/tools/docs.js.map +1 -0
- package/dist/esm/mcp/tools/orgs.d.ts +172 -0
- package/dist/esm/mcp/tools/orgs.js +172 -0
- package/dist/esm/mcp/tools/orgs.js.map +1 -0
- package/dist/esm/mcp/tools/previewBranches.d.ts +78 -0
- package/dist/esm/mcp/tools/previewBranches.js +28 -0
- package/dist/esm/mcp/tools/previewBranches.js.map +1 -0
- package/dist/esm/mcp/tools/runs.d.ts +335 -0
- package/dist/esm/mcp/tools/runs.js +160 -0
- package/dist/esm/mcp/tools/runs.js.map +1 -0
- package/dist/esm/mcp/tools/tasks.d.ts +200 -0
- package/dist/esm/mcp/tools/tasks.js +117 -0
- package/dist/esm/mcp/tools/tasks.js.map +1 -0
- package/dist/esm/mcp/tools.d.ts +2 -0
- package/dist/esm/mcp/tools.js +40 -0
- package/dist/esm/mcp/tools.js.map +1 -0
- package/dist/esm/mcp/types.d.ts +6 -0
- package/dist/esm/mcp/types.js +2 -0
- package/dist/esm/mcp/types.js.map +1 -0
- package/dist/esm/mcp/utils.d.ts +89 -0
- package/dist/esm/mcp/utils.js +95 -0
- package/dist/esm/mcp/utils.js.map +1 -0
- package/dist/esm/rules/install.d.ts +1 -0
- package/dist/esm/rules/install.js +2 -0
- package/dist/esm/rules/install.js.map +1 -0
- package/dist/esm/rules/manifest.d.ts +145 -0
- package/dist/esm/rules/manifest.js +110 -0
- package/dist/esm/rules/manifest.js.map +1 -0
- package/dist/esm/rules/types.d.ts +3 -0
- package/dist/esm/rules/types.js +3 -0
- package/dist/esm/rules/types.js.map +1 -0
- package/dist/esm/utilities/accessTokens.d.ts +12 -0
- package/dist/esm/utilities/accessTokens.js +30 -0
- package/dist/esm/utilities/accessTokens.js.map +1 -0
- package/dist/esm/utilities/analyze.d.ts +13 -0
- package/dist/esm/utilities/analyze.js +463 -0
- package/dist/esm/utilities/analyze.js.map +1 -0
- package/dist/esm/utilities/cliOutput.d.ts +6 -1
- package/dist/esm/utilities/cliOutput.js +11 -2
- package/dist/esm/utilities/cliOutput.js.map +1 -1
- package/dist/esm/utilities/configFiles.d.ts +65 -15
- package/dist/esm/utilities/configFiles.js +124 -26
- package/dist/esm/utilities/configFiles.js.map +1 -1
- package/dist/esm/utilities/eventBus.d.ts +7 -3
- package/dist/esm/utilities/eventBus.js.map +1 -1
- package/dist/esm/utilities/fileSystem.d.ts +7 -1
- package/dist/esm/utilities/fileSystem.js +42 -4
- package/dist/esm/utilities/fileSystem.js.map +1 -1
- package/dist/esm/utilities/gitMeta.d.ts +2 -0
- package/dist/esm/utilities/gitMeta.js +220 -0
- package/dist/esm/utilities/gitMeta.js.map +1 -0
- package/dist/esm/utilities/githubActions.d.ts +4 -0
- package/dist/esm/utilities/githubActions.js +18 -0
- package/dist/esm/utilities/githubActions.js.map +1 -0
- package/dist/esm/utilities/initialBanner.js +18 -6
- package/dist/esm/utilities/initialBanner.js.map +1 -1
- package/dist/esm/utilities/localEnvVars.d.ts +3 -0
- package/dist/esm/utilities/localEnvVars.js +19 -0
- package/dist/esm/utilities/localEnvVars.js.map +1 -0
- package/dist/esm/utilities/sanitizeEnvVars.d.ts +16 -3
- package/dist/esm/utilities/sanitizeEnvVars.js +15 -0
- package/dist/esm/utilities/sanitizeEnvVars.js.map +1 -1
- package/dist/esm/utilities/session.d.ts +14 -0
- package/dist/esm/utilities/session.js +44 -47
- package/dist/esm/utilities/session.js.map +1 -1
- package/dist/esm/utilities/supportsHyperlinks.d.ts +15 -0
- package/dist/esm/utilities/supportsHyperlinks.js +122 -0
- package/dist/esm/utilities/supportsHyperlinks.js.map +1 -0
- package/dist/esm/utilities/tempDirectories.d.ts +1 -0
- package/dist/esm/utilities/tempDirectories.js +19 -2
- package/dist/esm/utilities/tempDirectories.js.map +1 -1
- package/dist/esm/utilities/terminalLink.d.ts +56 -0
- package/dist/esm/utilities/terminalLink.js +76 -0
- package/dist/esm/utilities/terminalLink.js.map +1 -0
- package/dist/esm/utilities/windows.js +65 -1
- package/dist/esm/utilities/windows.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +44 -25
- package/dist/esm/entryPoints/deploy-index-controller.js.map +0 -1
- package/dist/esm/entryPoints/deploy-index-worker.js.map +0 -1
- package/dist/esm/entryPoints/deploy-run-controller.js +0 -1099
- package/dist/esm/entryPoints/deploy-run-controller.js.map +0 -1
- package/dist/esm/entryPoints/deploy-run-worker.js +0 -366
- package/dist/esm/entryPoints/deploy-run-worker.js.map +0 -1
- package/dist/esm/indexing/registerTasks.d.ts +0 -2
- package/dist/esm/indexing/registerTasks.js +0 -62
- package/dist/esm/indexing/registerTasks.js.map +0 -1
- package/dist/esm/telemetry/tracing.d.ts +0 -3
- package/dist/esm/telemetry/tracing.js +0 -58
- package/dist/esm/telemetry/tracing.js.map +0 -1
- /package/dist/esm/entryPoints/{deploy-index-controller.d.ts → managed-index-controller.d.ts} +0 -0
- /package/dist/esm/entryPoints/{deploy-index-worker.d.ts → managed-index-worker.d.ts} +0 -0
- /package/dist/esm/entryPoints/{deploy-run-controller.d.ts → managed-run-controller.d.ts} +0 -0
- /package/dist/esm/entryPoints/{deploy-run-worker.d.ts → managed-run-worker.d.ts} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { resourceCatalog } from "@trigger.dev/core/v3";
|
|
2
|
+
import { normalizeImportPath } from "../utilities/normalizeImportPath.js";
|
|
3
|
+
export async function registerResources(buildManifest) {
|
|
4
|
+
const importErrors = [];
|
|
5
|
+
const timings = {};
|
|
6
|
+
for (const file of buildManifest.files) {
|
|
7
|
+
// Set the context before importing
|
|
8
|
+
resourceCatalog.setCurrentFileContext(file.entry, file.out);
|
|
9
|
+
const start = performance.now();
|
|
10
|
+
const [error, _] = await tryImport(file.out);
|
|
11
|
+
const end = performance.now();
|
|
12
|
+
timings[file.entry] = end - start;
|
|
13
|
+
// Clear the context after import, regardless of success/failure
|
|
14
|
+
resourceCatalog.clearCurrentFileContext();
|
|
15
|
+
if (error) {
|
|
16
|
+
if (typeof error === "string") {
|
|
17
|
+
importErrors.push({
|
|
18
|
+
file: file.entry,
|
|
19
|
+
message: error,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
importErrors.push({
|
|
24
|
+
file: file.entry,
|
|
25
|
+
message: error.message,
|
|
26
|
+
stack: error.stack,
|
|
27
|
+
name: error.name,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { importErrors, timings };
|
|
34
|
+
}
|
|
35
|
+
async function tryImport(path) {
|
|
36
|
+
try {
|
|
37
|
+
const module = await import(normalizeImportPath(path));
|
|
38
|
+
return [null, module];
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return [error, null];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=registerResources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerResources.js","sourceRoot":"","sources":["../../../src/indexing/registerResources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,aAA4B;IAE5B,MAAM,YAAY,GAAyB,EAAE,CAAC;IAC9C,MAAM,OAAO,GAA2B,EAAE,CAAC;IAE3C,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,KAAK,EAAE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ChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { LoginResult, LoginResultOk } from "../utilities/session.js";
|
|
3
|
+
import { McpContext } from "./context.js";
|
|
4
|
+
import { ApiClient } from "@trigger.dev/core/v3";
|
|
5
|
+
export type McpAuthOptions = {
|
|
6
|
+
server: McpServer;
|
|
7
|
+
context: McpContext;
|
|
8
|
+
defaultApiUrl?: string;
|
|
9
|
+
profile?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function mcpAuth(options: McpAuthOptions): Promise<LoginResult>;
|
|
12
|
+
export declare function createApiClientWithPublicJWT(auth: LoginResultOk, projectRef: string, envName: string, scopes: string[], previewBranch?: string): Promise<ApiClient | undefined>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { env } from "std-env";
|
|
2
|
+
import { CliApiClient } from "../apiClient.js";
|
|
3
|
+
import { CLOUD_API_URL } from "../consts.js";
|
|
4
|
+
import { readAuthConfigProfile, writeAuthConfigProfile } from "../utilities/configFiles.js";
|
|
5
|
+
import { NotAccessTokenError, validateAccessToken } from "../utilities/accessTokens.js";
|
|
6
|
+
import { getPersonalAccessToken } from "../commands/login.js";
|
|
7
|
+
import open from "open";
|
|
8
|
+
import pRetry from "p-retry";
|
|
9
|
+
import { ApiClient } from "@trigger.dev/core/v3";
|
|
10
|
+
export async function mcpAuth(options) {
|
|
11
|
+
const opts = {
|
|
12
|
+
defaultApiUrl: CLOUD_API_URL,
|
|
13
|
+
...options,
|
|
14
|
+
};
|
|
15
|
+
const accessTokenFromEnv = env.TRIGGER_ACCESS_TOKEN;
|
|
16
|
+
if (accessTokenFromEnv) {
|
|
17
|
+
const validationResult = validateAccessToken(accessTokenFromEnv);
|
|
18
|
+
if (!validationResult.success) {
|
|
19
|
+
// We deliberately don't surface the existence of organization access tokens to the user for now, as they're only used internally.
|
|
20
|
+
// Once we expose them in the application, we should also communicate that option here.
|
|
21
|
+
throw new NotAccessTokenError("Your TRIGGER_ACCESS_TOKEN is not a Personal Access Token, they start with 'tr_pat_'. You can generate one here: https://cloud.trigger.dev/account/tokens");
|
|
22
|
+
}
|
|
23
|
+
const auth = {
|
|
24
|
+
accessToken: accessTokenFromEnv,
|
|
25
|
+
apiUrl: env.TRIGGER_API_URL ?? opts.defaultApiUrl ?? CLOUD_API_URL,
|
|
26
|
+
};
|
|
27
|
+
const apiClient = new CliApiClient(auth.apiUrl, auth.accessToken);
|
|
28
|
+
const userData = await apiClient.whoAmI();
|
|
29
|
+
if (!userData.success) {
|
|
30
|
+
throw new Error(userData.error);
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
ok: true,
|
|
34
|
+
profile: options?.profile ?? "default",
|
|
35
|
+
userId: userData.data.userId,
|
|
36
|
+
email: userData.data.email,
|
|
37
|
+
dashboardUrl: userData.data.dashboardUrl,
|
|
38
|
+
auth: {
|
|
39
|
+
accessToken: auth.accessToken,
|
|
40
|
+
apiUrl: auth.apiUrl,
|
|
41
|
+
tokenType: validationResult.type,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const authConfig = readAuthConfigProfile(options?.profile);
|
|
46
|
+
if (authConfig && authConfig.accessToken) {
|
|
47
|
+
const apiClient = new CliApiClient(authConfig.apiUrl ?? opts.defaultApiUrl, authConfig.accessToken);
|
|
48
|
+
const userData = await apiClient.whoAmI();
|
|
49
|
+
if (!userData.success) {
|
|
50
|
+
throw new Error(userData.error);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
ok: true,
|
|
54
|
+
profile: options?.profile ?? "default",
|
|
55
|
+
userId: userData.data.userId,
|
|
56
|
+
email: userData.data.email,
|
|
57
|
+
dashboardUrl: userData.data.dashboardUrl,
|
|
58
|
+
auth: {
|
|
59
|
+
accessToken: authConfig.accessToken,
|
|
60
|
+
apiUrl: authConfig.apiUrl ?? opts.defaultApiUrl,
|
|
61
|
+
tokenType: "personal",
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const apiClient = new CliApiClient(authConfig?.apiUrl ?? opts.defaultApiUrl);
|
|
66
|
+
//generate authorization code
|
|
67
|
+
const authorizationCodeResult = await createAuthorizationCode(apiClient);
|
|
68
|
+
const url = new URL(authorizationCodeResult.url);
|
|
69
|
+
url.searchParams.set("source", "mcp");
|
|
70
|
+
const clientName = options.server.server.getClientVersion()?.name;
|
|
71
|
+
if (clientName) {
|
|
72
|
+
url.searchParams.set("clientName", clientName);
|
|
73
|
+
}
|
|
74
|
+
// Only elicitInput if the client has the elicitation capability
|
|
75
|
+
// Elicit the user to visit the authorization code URL
|
|
76
|
+
const allowLogin = await askForLoginPermission(opts.server, url.toString());
|
|
77
|
+
if (!allowLogin) {
|
|
78
|
+
return {
|
|
79
|
+
ok: false,
|
|
80
|
+
error: "User did not allow login",
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
// Open the authorization code URL in the browser
|
|
84
|
+
await open(url.toString());
|
|
85
|
+
// Poll for the personal access token
|
|
86
|
+
const indexResult = await pRetry(() => getPersonalAccessToken(apiClient, authorizationCodeResult.authorizationCode), {
|
|
87
|
+
//this means we're polling, same distance between each attempt
|
|
88
|
+
factor: 1,
|
|
89
|
+
retries: 60,
|
|
90
|
+
minTimeout: 1000,
|
|
91
|
+
});
|
|
92
|
+
writeAuthConfigProfile({ accessToken: indexResult.token, apiUrl: opts.defaultApiUrl }, options?.profile);
|
|
93
|
+
const client = new CliApiClient(opts.defaultApiUrl, indexResult.token);
|
|
94
|
+
const userData = await client.whoAmI();
|
|
95
|
+
if (!userData.success) {
|
|
96
|
+
throw new Error(userData.error);
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
ok: true,
|
|
100
|
+
profile: options?.profile ?? "default",
|
|
101
|
+
userId: userData.data.userId,
|
|
102
|
+
email: userData.data.email,
|
|
103
|
+
dashboardUrl: userData.data.dashboardUrl,
|
|
104
|
+
auth: {
|
|
105
|
+
accessToken: indexResult.token,
|
|
106
|
+
apiUrl: opts.defaultApiUrl,
|
|
107
|
+
tokenType: "personal",
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
async function createAuthorizationCode(apiClient) {
|
|
112
|
+
const authorizationCodeResult = await apiClient.createAuthorizationCode();
|
|
113
|
+
if (!authorizationCodeResult.success) {
|
|
114
|
+
throw new Error(`Failed to create authorization code\n${authorizationCodeResult.error}`);
|
|
115
|
+
}
|
|
116
|
+
return authorizationCodeResult.data;
|
|
117
|
+
}
|
|
118
|
+
async function askForLoginPermission(server, authorizationCodeUrl) {
|
|
119
|
+
const capabilities = server.server.getClientCapabilities();
|
|
120
|
+
if (typeof capabilities?.elicitation !== "object") {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
const result = await server.server.elicitInput({
|
|
124
|
+
message: `You are not currently logged in. Would you like to login now? We'll automatically open the authorization code URL (${authorizationCodeUrl}) in your browser.`,
|
|
125
|
+
requestedSchema: {
|
|
126
|
+
type: "object",
|
|
127
|
+
properties: {
|
|
128
|
+
allowLogin: {
|
|
129
|
+
type: "boolean",
|
|
130
|
+
default: false,
|
|
131
|
+
title: "Allow Login",
|
|
132
|
+
description: "Whether to allow the user to login",
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
required: ["allowLogin"],
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
return result.action === "accept" && result.content?.allowLogin;
|
|
139
|
+
}
|
|
140
|
+
export async function createApiClientWithPublicJWT(auth, projectRef, envName, scopes, previewBranch) {
|
|
141
|
+
const cliApiClient = new CliApiClient(auth.auth.apiUrl, auth.auth.accessToken, previewBranch);
|
|
142
|
+
const jwt = await cliApiClient.getJWT(projectRef, envName, {
|
|
143
|
+
claims: {
|
|
144
|
+
scopes,
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
if (!jwt.success) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
return new ApiClient(auth.auth.apiUrl, jwt.data.token);
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/mcp/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAExF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AASjD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAuB;IACnD,MAAM,IAAI,GAAG;QACX,aAAa,EAAE,aAAa;QAC5B,GAAG,OAAO;KACX,CAAC;IAEF,MAAM,kBAAkB,GAAG,GAAG,CAAC,oBAAoB,CAAC;IAEpD,IAAI,kBAAkB,EAAE,CAAC;QACvB,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;QAEjE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC9B,kIAAkI;YAClI,uFAAuF;YACvF,MAAM,IAAI,mBAAmB,CAC3B,0JAA0J,CAC3J,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG;YACX,WAAW,EAAE,kBAAkB;YAC/B,MAAM,EAAE,GAAG,CAAC,eAAe,IAAI,IAAI,CAAC,aAAa,IAAI,aAAa;SACnE,CAAC;QAEF,MAAM,SAAS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@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
export declare function hasRootsCapability(server: McpServer): boolean;
|
|
3
|
+
export declare function hasSamplingCapability(server: McpServer): boolean;
|
|
4
|
+
export declare function hasElicitationCapability(server: McpServer): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function hasRootsCapability(server) {
|
|
2
|
+
const capabilities = server.server.getClientCapabilities();
|
|
3
|
+
if (!capabilities) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
return "roots" in capabilities && typeof capabilities.roots === "object";
|
|
7
|
+
}
|
|
8
|
+
export function hasSamplingCapability(server) {
|
|
9
|
+
const capabilities = server.server.getClientCapabilities();
|
|
10
|
+
if (!capabilities) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return "sampling" in capabilities && typeof capabilities.sampling === "object";
|
|
14
|
+
}
|
|
15
|
+
export function hasElicitationCapability(server) {
|
|
16
|
+
const capabilities = server.server.getClientCapabilities();
|
|
17
|
+
if (!capabilities) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return "elicitation" in capabilities && typeof capabilities.elicitation === "object";
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../src/mcp/capabilities.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;IAE3D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,OAAO,IAAI,YAAY,IAAI,OAAO,YAAY,CAAC,KAAK,KAAK,QAAQ,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAiB;IACrD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;IAE3D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,UAAU,IAAI,YAAY,IAAI,OAAO,YAAY,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;IAE3D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,aAAa,IAAI,YAAY,IAAI,OAAO,YAAY,CAAC,WAAW,KAAK,QAAQ,CAAC;AACvF,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare const serverMetadata: {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
instructions: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const toolsMetadata: {
|
|
7
|
+
search_docs: {
|
|
8
|
+
name: string;
|
|
9
|
+
title: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
list_projects: {
|
|
13
|
+
name: string;
|
|
14
|
+
title: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
list_orgs: {
|
|
18
|
+
name: string;
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
create_project_in_org: {
|
|
23
|
+
name: string;
|
|
24
|
+
title: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
initialize_project: {
|
|
28
|
+
name: string;
|
|
29
|
+
title: string;
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
get_tasks: {
|
|
33
|
+
name: string;
|
|
34
|
+
title: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
get_current_worker: {
|
|
38
|
+
name: string;
|
|
39
|
+
title: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
trigger_task: {
|
|
43
|
+
name: string;
|
|
44
|
+
title: string;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
get_run_details: {
|
|
48
|
+
name: string;
|
|
49
|
+
title: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
wait_for_run_to_complete: {
|
|
53
|
+
name: string;
|
|
54
|
+
title: string;
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
cancel_run: {
|
|
58
|
+
name: string;
|
|
59
|
+
title: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
list_runs: {
|
|
63
|
+
name: string;
|
|
64
|
+
title: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
deploy: {
|
|
68
|
+
name: string;
|
|
69
|
+
title: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
list_deploys: {
|
|
73
|
+
name: string;
|
|
74
|
+
title: string;
|
|
75
|
+
description: string;
|
|
76
|
+
};
|
|
77
|
+
list_preview_branches: {
|
|
78
|
+
name: string;
|
|
79
|
+
title: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { VERSION } from "../version.js";
|
|
2
|
+
export const serverMetadata = {
|
|
3
|
+
name: "trigger",
|
|
4
|
+
version: VERSION,
|
|
5
|
+
instructions: `Trigger.dev MCP server to automate your Trigger.dev projects and answer questions about Trigger.dev by searching the docs.
|
|
6
|
+
If you need help setting up Trigger.dev in your project please refer to https://trigger.dev/docs/manual-setup.
|
|
7
|
+
If the user asks for help with adding Trigger.dev to their project, please refer to https://trigger.dev/docs/manual-setup.
|
|
8
|
+
`,
|
|
9
|
+
};
|
|
10
|
+
export const toolsMetadata = {
|
|
11
|
+
search_docs: {
|
|
12
|
+
name: "search_docs",
|
|
13
|
+
title: "Search Docs",
|
|
14
|
+
description: "Search across the Trigger.dev documentation to find relevant information, code examples, API references, and guides. Use this tool when you need to answer questions about Trigger.dev, find specific documentation, understand how features work, or locate implementation details. The search returns contextual content with titles and direct links to the documentation pages",
|
|
15
|
+
},
|
|
16
|
+
list_projects: {
|
|
17
|
+
name: "list_projects",
|
|
18
|
+
title: "List Projects",
|
|
19
|
+
description: "List all projects for the current user, useful for when searching for a project and for looking up a projectRef",
|
|
20
|
+
},
|
|
21
|
+
list_orgs: {
|
|
22
|
+
name: "list_orgs",
|
|
23
|
+
title: "List Organizations",
|
|
24
|
+
description: "List all organizations for the current user. Useful when looking up an org slug or ID.",
|
|
25
|
+
},
|
|
26
|
+
create_project_in_org: {
|
|
27
|
+
name: "create_project_in_org",
|
|
28
|
+
title: "Create Project in Organization",
|
|
29
|
+
description: "Create a new project in an organization. Only do this if the user wants to add Trigger.dev to an existing project. If there is already a trigger.config.ts file present, then you should not create a new project.",
|
|
30
|
+
},
|
|
31
|
+
initialize_project: {
|
|
32
|
+
name: "initialize_project",
|
|
33
|
+
title: "Initialize Project",
|
|
34
|
+
description: "Initialize Trigger.dev in your project. This will create a new project in the organization you select and add Trigger.dev to your project.",
|
|
35
|
+
},
|
|
36
|
+
get_tasks: {
|
|
37
|
+
name: "get_tasks",
|
|
38
|
+
title: "Get Tasks",
|
|
39
|
+
description: "Get all tasks in the project. Useful when searching for a task and for looking up a task identifier/slug",
|
|
40
|
+
},
|
|
41
|
+
get_current_worker: {
|
|
42
|
+
name: "get_current_worker",
|
|
43
|
+
title: "Get Current Worker",
|
|
44
|
+
description: "Get the current worker for the project. Useful when searching for a task and for looking up a task identifier/slug and payload schema, or looking for the latest version in a specific environment.",
|
|
45
|
+
},
|
|
46
|
+
trigger_task: {
|
|
47
|
+
name: "trigger_task",
|
|
48
|
+
title: "Trigger Task",
|
|
49
|
+
description: "Trigger a task in the project. Use the get_tasks tool to get a list of tasks and ask the user to select one if it's not clear which one to use. Use the wait_for_run_to_complete tool to wait for the run to complete.",
|
|
50
|
+
},
|
|
51
|
+
get_run_details: {
|
|
52
|
+
name: "get_run_details",
|
|
53
|
+
title: "Get Run Details",
|
|
54
|
+
description: "Get the details of a run. The run ID is the ID of the run that was triggered. It starts with run_",
|
|
55
|
+
},
|
|
56
|
+
wait_for_run_to_complete: {
|
|
57
|
+
name: "wait_for_run_to_complete",
|
|
58
|
+
title: "Wait for Run to Complete",
|
|
59
|
+
description: "Wait for a run to complete. The run ID is the ID of the run that was triggered. It starts with run_",
|
|
60
|
+
},
|
|
61
|
+
cancel_run: {
|
|
62
|
+
name: "cancel_run",
|
|
63
|
+
title: "Cancel Run",
|
|
64
|
+
description: "Cancel a run. The run ID is the ID of the run that was triggered. It starts with run_",
|
|
65
|
+
},
|
|
66
|
+
list_runs: {
|
|
67
|
+
name: "list_runs",
|
|
68
|
+
title: "List Runs",
|
|
69
|
+
description: "List all runs for a project. Use this tool when you need to search for a run or list all runs for a project.",
|
|
70
|
+
},
|
|
71
|
+
deploy: {
|
|
72
|
+
name: "deploy",
|
|
73
|
+
title: "Deploy",
|
|
74
|
+
description: "Deploy a project. Use this tool when you need to deploy a project. This will trigger a deployment for the project. This is a long running operation and including a progress token will allow you to display the progress to the user.",
|
|
75
|
+
},
|
|
76
|
+
list_deploys: {
|
|
77
|
+
name: "list_deploys",
|
|
78
|
+
title: "List Deploys",
|
|
79
|
+
description: "List all deploys for a project. Use this tool when you need to search for a deploy or list all deploys for a project.",
|
|
80
|
+
},
|
|
81
|
+
list_preview_branches: {
|
|
82
|
+
name: "list_preview_branches",
|
|
83
|
+
title: "List Preview Branches",
|
|
84
|
+
description: "List all preview branches for a project. Use this tool when you need to search for a preview branch or list all preview branches for a project.",
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/mcp/config.ts"],"names":[],"mappings":"AAAA,OA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EAAE,YAAY;QAClB,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,uFAAuF;KAC1F;IACD,SAAS,EAAE;QACT,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,WAAW;QAClB,WAAW,EACT,8GAA8G;KACjH;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;QACf,WAAW,EACT,wOAAwO;KAC3O;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,cAAc;QACpB,KAAK,EAAE,cAAc;QACrB,WAAW,EACT,uHAAuH;KAC1H;IACD,qBAAqB,EAAE;QACrB,IAAI,EAAE,uBAAuB;QAC7B,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EACT,iJAAiJ;KACpJ;CACF,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ApiClient } from "@trigger.dev/core/v3";
|
|
3
|
+
import { CliApiClient } from "../apiClient.js";
|
|
4
|
+
import { FileLogger } from "./logger.js";
|
|
5
|
+
export type McpContextOptions = {
|
|
6
|
+
projectRef?: string;
|
|
7
|
+
fileLogger?: FileLogger;
|
|
8
|
+
apiUrl?: string;
|
|
9
|
+
profile?: string;
|
|
10
|
+
devOnly?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare class McpContext {
|
|
13
|
+
readonly server: McpServer;
|
|
14
|
+
readonly options: McpContextOptions;
|
|
15
|
+
constructor(server: McpServer, options: McpContextOptions);
|
|
16
|
+
get logger(): FileLogger | undefined;
|
|
17
|
+
getAuth(): Promise<import("../utilities/session.js").LoginResultOk>;
|
|
18
|
+
getCliApiClient(branch?: string): Promise<CliApiClient>;
|
|
19
|
+
getApiClient(options: {
|
|
20
|
+
projectRef: string;
|
|
21
|
+
environment: string;
|
|
22
|
+
scopes: string[];
|
|
23
|
+
branch?: string;
|
|
24
|
+
}): Promise<ApiClient>;
|
|
25
|
+
getCwd(): Promise<string | undefined>;
|
|
26
|
+
getProjectRef(options: {
|
|
27
|
+
projectRef?: string;
|
|
28
|
+
cwd?: string;
|
|
29
|
+
}): Promise<string>;
|
|
30
|
+
getProjectDir({ cwd }: {
|
|
31
|
+
cwd?: string;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
ok: boolean;
|
|
34
|
+
error: string;
|
|
35
|
+
cwd?: undefined;
|
|
36
|
+
} | {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
cwd: string;
|
|
39
|
+
error?: undefined;
|
|
40
|
+
}>;
|
|
41
|
+
getDashboardUrl(path: string): Promise<string>;
|
|
42
|
+
get hasRootsCapability(): boolean;
|
|
43
|
+
get hasSamplingCapability(): boolean;
|
|
44
|
+
get hasElicitationCapability(): boolean;
|
|
45
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { tryCatch } from "@trigger.dev/core/utils";
|
|
2
|
+
import { ApiClient } from "@trigger.dev/core/v3";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { CliApiClient } from "../apiClient.js";
|
|
5
|
+
import { loadConfig } from "../config.js";
|
|
6
|
+
import { mcpAuth } from "./auth.js";
|
|
7
|
+
import { hasElicitationCapability, hasRootsCapability, hasSamplingCapability, } from "./capabilities.js";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
export class McpContext {
|
|
10
|
+
server;
|
|
11
|
+
options;
|
|
12
|
+
constructor(server, options) {
|
|
13
|
+
this.server = server;
|
|
14
|
+
this.options = options;
|
|
15
|
+
}
|
|
16
|
+
get logger() {
|
|
17
|
+
return this.options.fileLogger;
|
|
18
|
+
}
|
|
19
|
+
async getAuth() {
|
|
20
|
+
const auth = await mcpAuth({
|
|
21
|
+
server: this.server,
|
|
22
|
+
defaultApiUrl: this.options.apiUrl,
|
|
23
|
+
profile: this.options.profile,
|
|
24
|
+
context: this,
|
|
25
|
+
});
|
|
26
|
+
if (!auth.ok) {
|
|
27
|
+
throw new Error(auth.error);
|
|
28
|
+
}
|
|
29
|
+
return auth;
|
|
30
|
+
}
|
|
31
|
+
async getCliApiClient(branch) {
|
|
32
|
+
const auth = await this.getAuth();
|
|
33
|
+
return new CliApiClient(auth.auth.apiUrl, auth.auth.accessToken, branch);
|
|
34
|
+
}
|
|
35
|
+
async getApiClient(options) {
|
|
36
|
+
const cliApiClient = await this.getCliApiClient(options.branch);
|
|
37
|
+
const jwt = await cliApiClient.getJWT(options.projectRef, options.environment, {
|
|
38
|
+
claims: {
|
|
39
|
+
scopes: options.scopes,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
if (!jwt.success) {
|
|
43
|
+
throw new Error(`Could not get the authentication token for the project ${options.projectRef} in the ${options.environment} environment. Please try again.`);
|
|
44
|
+
}
|
|
45
|
+
return new ApiClient(cliApiClient.apiURL, jwt.data.token);
|
|
46
|
+
}
|
|
47
|
+
async getCwd() {
|
|
48
|
+
if (!this.hasRootsCapability) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
const response = await this.server.server.listRoots();
|
|
52
|
+
if (response.roots.length >= 1) {
|
|
53
|
+
return response.roots[0]?.uri ? fileURLToPath(response.roots[0].uri) : undefined;
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
async getProjectRef(options) {
|
|
58
|
+
if (options.projectRef) {
|
|
59
|
+
return options.projectRef;
|
|
60
|
+
}
|
|
61
|
+
const projectDir = await this.getProjectDir({ cwd: options.cwd });
|
|
62
|
+
if (!projectDir.ok) {
|
|
63
|
+
throw new Error(projectDir.error);
|
|
64
|
+
}
|
|
65
|
+
const [_, config] = await tryCatch(loadConfig({ cwd: projectDir.cwd }));
|
|
66
|
+
if (config?.configFile &&
|
|
67
|
+
typeof config.project === "string" &&
|
|
68
|
+
config.project.startsWith("proj_")) {
|
|
69
|
+
return config.project;
|
|
70
|
+
}
|
|
71
|
+
throw new Error("No project ref found. Please provide a projectRef.");
|
|
72
|
+
}
|
|
73
|
+
async getProjectDir({ cwd }) {
|
|
74
|
+
// If cwd is a path to the actual trigger.config.ts file, then we should set the cwd to the directory of the file
|
|
75
|
+
let $cwd = cwd ? (path.extname(cwd) !== "" ? path.dirname(cwd) : cwd) : undefined;
|
|
76
|
+
function isRelativePath(filePath) {
|
|
77
|
+
return !path.isAbsolute(filePath);
|
|
78
|
+
}
|
|
79
|
+
if (!cwd) {
|
|
80
|
+
if (!this.hasRootsCapability) {
|
|
81
|
+
return {
|
|
82
|
+
ok: false,
|
|
83
|
+
error: "The current MCP server does not support the roots capability, so please call the tool again with a projectRef or an absolute path as cwd parameter",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
$cwd = await this.getCwd();
|
|
87
|
+
}
|
|
88
|
+
else if (isRelativePath(cwd)) {
|
|
89
|
+
if (!this.hasRootsCapability) {
|
|
90
|
+
return {
|
|
91
|
+
ok: false,
|
|
92
|
+
error: "The current MCP server does not support the roots capability, so please call the tool again with a projectRef or an absolute path as cwd parameter",
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const resolvedCwd = await this.getCwd();
|
|
96
|
+
if (!resolvedCwd) {
|
|
97
|
+
return {
|
|
98
|
+
ok: false,
|
|
99
|
+
error: "No current working directory found. Please provide a projectRef or a cwd.",
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
$cwd = path.resolve(resolvedCwd, cwd);
|
|
103
|
+
}
|
|
104
|
+
if (!$cwd) {
|
|
105
|
+
return {
|
|
106
|
+
ok: false,
|
|
107
|
+
error: "No current working directory found. Please provide a projectRef or a cwd.",
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
ok: true,
|
|
112
|
+
cwd: $cwd,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
async getDashboardUrl(path) {
|
|
116
|
+
const auth = await this.getAuth();
|
|
117
|
+
return `${auth.dashboardUrl}${path}`;
|
|
118
|
+
}
|
|
119
|
+
get hasRootsCapability() {
|
|
120
|
+
return hasRootsCapability(this.server);
|
|
121
|
+
}
|
|
122
|
+
get hasSamplingCapability() {
|
|
123
|
+
return hasSamplingCapability(this.server);
|
|
124
|
+
}
|
|
125
|
+
get hasElicitationCapability() {
|
|
126
|
+
return hasElicitationCapability(this.server);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/mcp/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAUzC,MAAM,OAAO,UAAU;IACL,MAAM,CAAY;IAClB,OAAO,CAAoB;IAE3C,YAAY,MAAiB,EAAE,OAA0B;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IACjC,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC;YACzB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM;YAClC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;YAC7B,OAAO,EAAE,IAAI;SAC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CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,IAAW,qBAAqB;QAC9B,OAAO,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,IAAW,wBAAwB;QACjC,OAAO,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AnyRunShape } from "@trigger.dev/core/v3";
|
|
2
|
+
import { ListRunResponseItem, RetrieveRunResponse, RetrieveRunTraceResponseBody } from "@trigger.dev/core/v3/schemas";
|
|
3
|
+
import type { CursorPageResponse } from "@trigger.dev/core/v3/zodfetch";
|
|
4
|
+
export declare function formatRun(run: RetrieveRunResponse): string;
|
|
5
|
+
export declare function formatRunShape(run: AnyRunShape): string;
|
|
6
|
+
export declare function formatRunTrace(trace: RetrieveRunTraceResponseBody["trace"], maxTraceLines?: number): string;
|
|
7
|
+
export declare function formatRunList(runsPage: CursorPageResponse<ListRunResponseItem>): string;
|