integrate-sdk 0.8.31-dev.1 → 0.8.35

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/server.js CHANGED
@@ -359,6 +359,81 @@ function methodToToolName(methodName, integrationId) {
359
359
  return `${integrationId}_${snakeCaseMethod}`;
360
360
  }
361
361
 
362
+ // src/triggers/client.ts
363
+ class TriggerClient {
364
+ config;
365
+ constructor(config) {
366
+ this.config = config;
367
+ }
368
+ async create(params) {
369
+ return this.request("POST", "/triggers", params);
370
+ }
371
+ async list(params) {
372
+ let path = "/triggers";
373
+ if (params) {
374
+ const searchParams = new URLSearchParams;
375
+ if (params.status)
376
+ searchParams.set("status", params.status);
377
+ if (params.toolName)
378
+ searchParams.set("toolName", params.toolName);
379
+ if (params.limit !== undefined)
380
+ searchParams.set("limit", params.limit.toString());
381
+ if (params.offset !== undefined)
382
+ searchParams.set("offset", params.offset.toString());
383
+ const query = searchParams.toString();
384
+ if (query)
385
+ path += `?${query}`;
386
+ }
387
+ return this.request("GET", path);
388
+ }
389
+ async get(triggerId) {
390
+ return this.request("GET", `/triggers/${triggerId}`);
391
+ }
392
+ async update(triggerId, params) {
393
+ return this.request("PATCH", `/triggers/${triggerId}`, params);
394
+ }
395
+ async delete(triggerId) {
396
+ await this.request("DELETE", `/triggers/${triggerId}`);
397
+ }
398
+ async pause(triggerId) {
399
+ return this.request("POST", `/triggers/${triggerId}/pause`);
400
+ }
401
+ async resume(triggerId) {
402
+ return this.request("POST", `/triggers/${triggerId}/resume`);
403
+ }
404
+ async run(triggerId) {
405
+ return this.request("POST", `/triggers/${triggerId}/run`);
406
+ }
407
+ async request(method, path, body) {
408
+ const url = this.config.apiBaseUrl ? `${this.config.apiBaseUrl}${this.config.apiRouteBase}${path}` : `${this.config.apiRouteBase}${path}`;
409
+ const options = {
410
+ method,
411
+ headers: {
412
+ "Content-Type": "application/json",
413
+ ...this.config.getHeaders()
414
+ }
415
+ };
416
+ if (body !== undefined) {
417
+ options.body = JSON.stringify(body);
418
+ }
419
+ const response = await fetch(url, options);
420
+ if (!response.ok) {
421
+ let errorMessage = `Request failed: ${response.statusText}`;
422
+ try {
423
+ const errorData = await response.json();
424
+ if (errorData.error) {
425
+ errorMessage = typeof errorData.error === "string" ? errorData.error : errorData.error.message || errorMessage;
426
+ }
427
+ } catch {}
428
+ throw new Error(errorMessage);
429
+ }
430
+ if (method === "DELETE" && response.status === 204) {
431
+ return;
432
+ }
433
+ return response.json();
434
+ }
435
+ }
436
+
362
437
  // src/oauth/pkce.ts
363
438
  var exports_pkce = {};
364
439
  __export(exports_pkce, {
@@ -1537,6 +1612,7 @@ class MCPClientBase {
1537
1612
  databaseDetected = false;
1538
1613
  oauthCallbackPromise;
1539
1614
  server;
1615
+ trigger;
1540
1616
  constructor(config) {
1541
1617
  this.transport = new HttpSessionTransport({
1542
1618
  url: config.serverUrl || MCP_SERVER_URL,
@@ -1579,6 +1655,10 @@ class MCPClientBase {
1579
1655
  this.authState.set(provider, { authenticated: false });
1580
1656
  }
1581
1657
  }
1658
+ const integrationHeaderValue = this.getIntegrationHeaderValue();
1659
+ if (integrationHeaderValue && this.transport.setHeader) {
1660
+ this.transport.setHeader("X-Integrations", integrationHeaderValue);
1661
+ }
1582
1662
  const providers = this.integrations.filter((p) => p.oauth).map((p) => p.oauth.provider);
1583
1663
  const usingDatabaseCallbacks = !!config.getProviderToken;
1584
1664
  if (usingDatabaseCallbacks) {
@@ -1654,6 +1734,13 @@ class MCPClientBase {
1654
1734
  this.todoist = this.createIntegrationProxy("todoist");
1655
1735
  }
1656
1736
  this.server = this.createServerProxy();
1737
+ this.trigger = new TriggerClient({
1738
+ apiRouteBase: this.apiRouteBase,
1739
+ apiBaseUrl: this.apiBaseUrl,
1740
+ getHeaders: () => ({
1741
+ "X-Integrations": this.getIntegrationHeaderValue()
1742
+ })
1743
+ });
1657
1744
  this.initializeIntegrations();
1658
1745
  }
1659
1746
  getDefaultRedirectUri(oauthApiBase, apiBaseUrl) {
@@ -1683,9 +1770,24 @@ class MCPClientBase {
1683
1770
  }
1684
1771
  });
1685
1772
  }
1773
+ getIntegrationHeaderValue() {
1774
+ return this.integrations.map((integration) => integration.id).join(",");
1775
+ }
1686
1776
  createServerProxy() {
1687
1777
  return new Proxy({}, {
1688
1778
  get: (_target, methodName) => {
1779
+ if (methodName === "listConfiguredIntegrations") {
1780
+ return async () => ({
1781
+ integrations: this.integrations.map((integration) => ({
1782
+ id: integration.id,
1783
+ name: integration.name || integration.id,
1784
+ tools: integration.tools,
1785
+ hasOAuth: !!integration.oauth,
1786
+ scopes: integration.oauth?.scopes,
1787
+ provider: integration.oauth?.provider
1788
+ }))
1789
+ });
1790
+ }
1689
1791
  return async (args, options) => {
1690
1792
  const toolName = methodToToolName(methodName, "");
1691
1793
  const finalToolName = toolName.startsWith("_") ? toolName.substring(1) : toolName;
@@ -1791,6 +1893,10 @@ class MCPClientBase {
1791
1893
  const headers = {
1792
1894
  "Content-Type": "application/json"
1793
1895
  };
1896
+ const integrationsHeader = this.getIntegrationHeaderValue();
1897
+ if (integrationsHeader) {
1898
+ headers["X-Integrations"] = integrationsHeader;
1899
+ }
1794
1900
  if (provider) {
1795
1901
  const tokenData = await this.oauthManager.getProviderToken(provider, undefined, options?.context);
1796
1902
  if (tokenData) {
@@ -2662,7 +2768,7 @@ class OAuthHandler {
2662
2768
  const data = await response.json();
2663
2769
  return data;
2664
2770
  }
2665
- async handleToolCall(request, authHeader) {
2771
+ async handleToolCall(request, authHeader, integrationsHeader) {
2666
2772
  const url = this.serverUrl;
2667
2773
  const headers = this.getHeaders({
2668
2774
  "Content-Type": "application/json"
@@ -2670,6 +2776,9 @@ class OAuthHandler {
2670
2776
  if (authHeader && authHeader.startsWith("Bearer ")) {
2671
2777
  headers["Authorization"] = authHeader;
2672
2778
  }
2779
+ if (integrationsHeader) {
2780
+ headers["X-Integrations"] = integrationsHeader;
2781
+ }
2673
2782
  const jsonRpcRequest = {
2674
2783
  jsonrpc: "2.0",
2675
2784
  id: Date.now() + Math.random(),
@@ -2814,7 +2923,8 @@ function createNextOAuthHandler(config) {
2814
2923
  try {
2815
2924
  const body = await req.json();
2816
2925
  const authHeader = req.headers.get("authorization");
2817
- const result = await handler.handleToolCall(body, authHeader);
2926
+ const integrationsHeader = req.headers.get("x-integrations");
2927
+ const result = await handler.handleToolCall(body, authHeader, integrationsHeader);
2818
2928
  return Response.json(result);
2819
2929
  } catch (error) {
2820
2930
  console.error("[MCP Tool Call] Error:", error);
@@ -8378,6 +8488,71 @@ var init_ai = __esm(() => {
8378
8488
  init_google();
8379
8489
  });
8380
8490
 
8491
+ // node_modules/nanoid/url-alphabet/index.js
8492
+ var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
8493
+ var init_url_alphabet = () => {};
8494
+
8495
+ // node_modules/nanoid/index.js
8496
+ import crypto2 from "crypto";
8497
+ var POOL_SIZE_MULTIPLIER = 128, pool, poolOffset, fillPool = (bytes) => {
8498
+ if (!pool || pool.length < bytes) {
8499
+ pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
8500
+ crypto2.randomFillSync(pool);
8501
+ poolOffset = 0;
8502
+ } else if (poolOffset + bytes > pool.length) {
8503
+ crypto2.randomFillSync(pool);
8504
+ poolOffset = 0;
8505
+ }
8506
+ poolOffset += bytes;
8507
+ }, nanoid = (size = 21) => {
8508
+ fillPool(size |= 0);
8509
+ let id = "";
8510
+ for (let i = poolOffset - size;i < poolOffset; i++) {
8511
+ id += urlAlphabet[pool[i] & 63];
8512
+ }
8513
+ return id;
8514
+ };
8515
+ var init_nanoid = __esm(() => {
8516
+ init_url_alphabet();
8517
+ });
8518
+
8519
+ // src/triggers/utils.ts
8520
+ var exports_utils = {};
8521
+ __export(exports_utils, {
8522
+ validateStatusTransition: () => validateStatusTransition,
8523
+ generateTriggerId: () => generateTriggerId,
8524
+ extractProviderFromToolName: () => extractProviderFromToolName,
8525
+ calculateHasMore: () => calculateHasMore
8526
+ });
8527
+ function generateTriggerId() {
8528
+ return `trig_${nanoid(12)}`;
8529
+ }
8530
+ function extractProviderFromToolName(toolName) {
8531
+ const parts = toolName.split("_");
8532
+ return parts[0] || toolName;
8533
+ }
8534
+ function validateStatusTransition(currentStatus, targetStatus) {
8535
+ if (targetStatus === "paused" && currentStatus !== "active") {
8536
+ return {
8537
+ valid: false,
8538
+ error: `Cannot pause trigger with status '${currentStatus}'. Only 'active' triggers can be paused.`
8539
+ };
8540
+ }
8541
+ if (targetStatus === "active" && currentStatus !== "paused") {
8542
+ return {
8543
+ valid: false,
8544
+ error: `Cannot resume trigger with status '${currentStatus}'. Only 'paused' triggers can be resumed.`
8545
+ };
8546
+ }
8547
+ return { valid: true };
8548
+ }
8549
+ function calculateHasMore(offset, returnedCount, total) {
8550
+ return offset + returnedCount < total;
8551
+ }
8552
+ var init_utils2 = __esm(() => {
8553
+ init_nanoid();
8554
+ });
8555
+
8381
8556
  // src/server.ts
8382
8557
  var exports_server = {};
8383
8558
  __export(exports_server, {
@@ -8577,6 +8752,7 @@ function createMCPServer(config) {
8577
8752
  try {
8578
8753
  const body = await webRequest.json();
8579
8754
  const authHeader = webRequest.headers.get("authorization");
8755
+ const integrationsHeader = webRequest.headers.get("x-integrations");
8580
8756
  const { OAuthHandler: OAuthHandler2 } = await Promise.resolve().then(() => exports_base_handler);
8581
8757
  const oauthHandler = new OAuthHandler2({
8582
8758
  providers,
@@ -8586,7 +8762,7 @@ function createMCPServer(config) {
8586
8762
  removeProviderToken: config.removeProviderToken,
8587
8763
  getSessionContext: config.getSessionContext
8588
8764
  });
8589
- const result = await oauthHandler.handleToolCall(body, authHeader);
8765
+ const result = await oauthHandler.handleToolCall(body, authHeader, integrationsHeader);
8590
8766
  const response2 = Response.json(result);
8591
8767
  if (oauthHandler.hasDatabaseCallbacks()) {
8592
8768
  response2.headers.set("X-Integrate-Use-Database", "true");
@@ -8597,13 +8773,308 @@ function createMCPServer(config) {
8597
8773
  return Response.json({ error: error.message || "Failed to execute tool call" }, { status: error.statusCode || 500 });
8598
8774
  }
8599
8775
  }
8776
+ if (segments.length >= 1 && segments[0] === "triggers") {
8777
+ if (!config.triggers) {
8778
+ return Response.json({ error: "Triggers not configured. Add triggers callbacks to createMCPServer config." }, { status: 501 });
8779
+ }
8780
+ try {
8781
+ const context2 = config.getSessionContext ? await config.getSessionContext(webRequest) : undefined;
8782
+ if (segments.length === 1) {
8783
+ if (method === "GET") {
8784
+ const url = new URL(webRequest.url);
8785
+ const params = {
8786
+ status: url.searchParams.get("status"),
8787
+ toolName: url.searchParams.get("toolName") || undefined,
8788
+ limit: url.searchParams.get("limit") ? parseInt(url.searchParams.get("limit")) : undefined,
8789
+ offset: url.searchParams.get("offset") ? parseInt(url.searchParams.get("offset")) : undefined
8790
+ };
8791
+ const callbackResult = await config.triggers.list(params, context2);
8792
+ const { calculateHasMore: calculateHasMore2 } = await Promise.resolve().then(() => (init_utils2(), exports_utils));
8793
+ const offset = params.offset || 0;
8794
+ const hasMore = calculateHasMore2(offset, callbackResult.triggers.length, callbackResult.total);
8795
+ return Response.json({
8796
+ triggers: callbackResult.triggers,
8797
+ total: callbackResult.total,
8798
+ hasMore
8799
+ });
8800
+ } else if (method === "POST") {
8801
+ const body = await webRequest.json();
8802
+ const { generateTriggerId: generateTriggerId2, extractProviderFromToolName: extractProviderFromToolName2 } = await Promise.resolve().then(() => (init_utils2(), exports_utils));
8803
+ const triggerId = generateTriggerId2();
8804
+ const provider = body.toolName ? extractProviderFromToolName2(body.toolName) : undefined;
8805
+ const trigger = {
8806
+ id: triggerId,
8807
+ ...body,
8808
+ provider,
8809
+ status: body.status || "active",
8810
+ createdAt: new Date().toISOString(),
8811
+ updatedAt: new Date().toISOString(),
8812
+ runCount: 0
8813
+ };
8814
+ const created = await config.triggers.create(trigger, context2);
8815
+ const schedulerUrl = config.schedulerUrl || config.serverUrl || "https://mcp.integrate.dev";
8816
+ const callbackBaseUrl = process.env.INTEGRATE_URL || (typeof window !== "undefined" ? window.location.origin : "http://localhost:3000");
8817
+ try {
8818
+ await fetch(`${schedulerUrl}/scheduler/register`, {
8819
+ method: "POST",
8820
+ headers: {
8821
+ "Content-Type": "application/json",
8822
+ "X-API-KEY": config.apiKey || ""
8823
+ },
8824
+ body: JSON.stringify({
8825
+ triggerId: created.id,
8826
+ schedule: created.schedule,
8827
+ callbackUrl: `${callbackBaseUrl}/api/integrate/triggers/${created.id}/execute`,
8828
+ completeUrl: `${callbackBaseUrl}/api/integrate/triggers/${created.id}/complete`,
8829
+ metadata: {
8830
+ userId: context2?.userId,
8831
+ provider: created.provider
8832
+ }
8833
+ })
8834
+ });
8835
+ } catch (scheduleError) {
8836
+ console.error("[Trigger] Failed to register with scheduler:", scheduleError);
8837
+ }
8838
+ return Response.json(created, { status: 201 });
8839
+ }
8840
+ } else if (segments.length >= 2) {
8841
+ const triggerId = segments[1];
8842
+ if (!triggerId) {
8843
+ return Response.json({ error: "Trigger ID is required" }, { status: 400 });
8844
+ }
8845
+ const subAction = segments.length > 2 ? segments[2] : undefined;
8846
+ if (subAction === "pause" && method === "POST") {
8847
+ const trigger = await config.triggers.get(triggerId, context2);
8848
+ if (!trigger) {
8849
+ return Response.json({ error: "Trigger not found" }, { status: 404 });
8850
+ }
8851
+ const { validateStatusTransition: validateStatusTransition2 } = await Promise.resolve().then(() => (init_utils2(), exports_utils));
8852
+ const validation = validateStatusTransition2(trigger.status, "paused");
8853
+ if (!validation.valid) {
8854
+ return Response.json({ error: validation.error }, { status: 400 });
8855
+ }
8856
+ const updated = await config.triggers.update(triggerId, {
8857
+ status: "paused",
8858
+ updatedAt: new Date().toISOString()
8859
+ }, context2);
8860
+ const schedulerUrl = config.schedulerUrl || config.serverUrl || "https://mcp.integrate.dev";
8861
+ try {
8862
+ await fetch(`${schedulerUrl}/scheduler/pause`, {
8863
+ method: "POST",
8864
+ headers: {
8865
+ "Content-Type": "application/json",
8866
+ "X-API-KEY": config.apiKey || ""
8867
+ },
8868
+ body: JSON.stringify({ triggerId })
8869
+ });
8870
+ } catch (error) {
8871
+ console.error("[Trigger] Failed to pause in scheduler:", error);
8872
+ }
8873
+ return Response.json(updated);
8874
+ } else if (subAction === "resume" && method === "POST") {
8875
+ const trigger = await config.triggers.get(triggerId, context2);
8876
+ if (!trigger) {
8877
+ return Response.json({ error: "Trigger not found" }, { status: 404 });
8878
+ }
8879
+ const { validateStatusTransition: validateStatusTransition2 } = await Promise.resolve().then(() => (init_utils2(), exports_utils));
8880
+ const validation = validateStatusTransition2(trigger.status, "active");
8881
+ if (!validation.valid) {
8882
+ return Response.json({ error: validation.error }, { status: 400 });
8883
+ }
8884
+ const updated = await config.triggers.update(triggerId, {
8885
+ status: "active",
8886
+ updatedAt: new Date().toISOString()
8887
+ }, context2);
8888
+ const schedulerUrl = config.schedulerUrl || config.serverUrl || "https://mcp.integrate.dev";
8889
+ try {
8890
+ await fetch(`${schedulerUrl}/scheduler/resume`, {
8891
+ method: "POST",
8892
+ headers: {
8893
+ "Content-Type": "application/json",
8894
+ "X-API-KEY": config.apiKey || ""
8895
+ },
8896
+ body: JSON.stringify({ triggerId })
8897
+ });
8898
+ } catch (error) {
8899
+ console.error("[Trigger] Failed to resume in scheduler:", error);
8900
+ }
8901
+ return Response.json(updated);
8902
+ } else if (subAction === "run" && method === "POST") {
8903
+ const trigger = await config.triggers.get(triggerId, context2);
8904
+ if (!trigger) {
8905
+ return Response.json({ error: "Trigger not found" }, { status: 404 });
8906
+ }
8907
+ if (!trigger.provider) {
8908
+ return Response.json({ error: "Trigger has no provider configured" }, { status: 400 });
8909
+ }
8910
+ const providerToken = config.getProviderToken ? await config.getProviderToken(trigger.provider, undefined, context2) : undefined;
8911
+ if (!providerToken) {
8912
+ return Response.json({ error: "No OAuth token available for this trigger" }, { status: 401 });
8913
+ }
8914
+ const { OAuthHandler: OAuthHandler2 } = await Promise.resolve().then(() => exports_base_handler);
8915
+ const oauthHandler = new OAuthHandler2({
8916
+ providers,
8917
+ serverUrl: config.serverUrl,
8918
+ apiKey: config.apiKey,
8919
+ setProviderToken: config.setProviderToken,
8920
+ removeProviderToken: config.removeProviderToken,
8921
+ getSessionContext: config.getSessionContext
8922
+ });
8923
+ const startTime = Date.now();
8924
+ try {
8925
+ const result = await oauthHandler.handleToolCall({ name: trigger.toolName, arguments: trigger.toolArguments }, `Bearer ${providerToken.accessToken}`, null);
8926
+ const duration = Date.now() - startTime;
8927
+ const executionResult = {
8928
+ success: true,
8929
+ result,
8930
+ executedAt: new Date().toISOString(),
8931
+ duration
8932
+ };
8933
+ await config.triggers.update(triggerId, {
8934
+ lastRunAt: executionResult.executedAt,
8935
+ runCount: (trigger.runCount || 0) + 1,
8936
+ lastResult: result,
8937
+ lastError: undefined
8938
+ }, context2);
8939
+ return Response.json(executionResult);
8940
+ } catch (error) {
8941
+ const duration = Date.now() - startTime;
8942
+ const executionResult = {
8943
+ success: false,
8944
+ error: error.message || "Tool execution failed",
8945
+ executedAt: new Date().toISOString(),
8946
+ duration
8947
+ };
8948
+ await config.triggers.update(triggerId, {
8949
+ lastRunAt: executionResult.executedAt,
8950
+ runCount: (trigger.runCount || 0) + 1,
8951
+ lastError: error.message,
8952
+ status: "failed"
8953
+ }, context2);
8954
+ return Response.json(executionResult, { status: 500 });
8955
+ }
8956
+ } else if (subAction === "execute" && method === "GET") {
8957
+ const apiKey = webRequest.headers.get("x-api-key");
8958
+ if (!apiKey || apiKey !== config.apiKey) {
8959
+ return Response.json({ error: "Unauthorized" }, { status: 401 });
8960
+ }
8961
+ const trigger = await config.triggers.get(triggerId, context2);
8962
+ if (!trigger) {
8963
+ return Response.json({ error: "Trigger not found" }, { status: 404 });
8964
+ }
8965
+ if (!trigger.provider) {
8966
+ return Response.json({ error: "Trigger has no provider configured" }, { status: 400 });
8967
+ }
8968
+ const providerToken = config.getProviderToken ? await config.getProviderToken(trigger.provider, undefined, context2) : undefined;
8969
+ if (!providerToken) {
8970
+ return Response.json({ error: "No OAuth token available for this trigger" }, { status: 401 });
8971
+ }
8972
+ return Response.json({
8973
+ trigger: {
8974
+ id: trigger.id,
8975
+ toolName: trigger.toolName,
8976
+ toolArguments: trigger.toolArguments,
8977
+ provider: trigger.provider
8978
+ },
8979
+ accessToken: providerToken.accessToken,
8980
+ tokenType: providerToken.tokenType || "Bearer"
8981
+ });
8982
+ } else if (subAction === "complete" && method === "POST") {
8983
+ const apiKey = webRequest.headers.get("x-api-key");
8984
+ if (!apiKey || apiKey !== config.apiKey) {
8985
+ return Response.json({ error: "Unauthorized" }, { status: 401 });
8986
+ }
8987
+ const body = await webRequest.json();
8988
+ const trigger = await config.triggers.get(triggerId, context2);
8989
+ if (!trigger) {
8990
+ return Response.json({ error: "Trigger not found" }, { status: 404 });
8991
+ }
8992
+ const updates = {
8993
+ lastRunAt: body.executedAt,
8994
+ runCount: (trigger.runCount || 0) + 1
8995
+ };
8996
+ if (body.success) {
8997
+ updates.lastResult = body.result;
8998
+ updates.lastError = undefined;
8999
+ if (trigger.schedule.type === "once") {
9000
+ updates.status = "completed";
9001
+ }
9002
+ } else {
9003
+ updates.lastError = body.error;
9004
+ updates.status = "failed";
9005
+ }
9006
+ await config.triggers.update(triggerId, updates, context2);
9007
+ return Response.json({ success: true });
9008
+ } else if (!subAction && method === "GET") {
9009
+ const trigger = await config.triggers.get(triggerId, context2);
9010
+ if (!trigger) {
9011
+ return Response.json({ error: "Trigger not found" }, { status: 404 });
9012
+ }
9013
+ return Response.json(trigger);
9014
+ } else if (!subAction && method === "PATCH") {
9015
+ const body = await webRequest.json();
9016
+ const trigger = await config.triggers.get(triggerId, context2);
9017
+ if (!trigger) {
9018
+ return Response.json({ error: "Trigger not found" }, { status: 404 });
9019
+ }
9020
+ const updates = {
9021
+ ...body,
9022
+ updatedAt: new Date().toISOString()
9023
+ };
9024
+ const updated = await config.triggers.update(triggerId, updates, context2);
9025
+ if (body.schedule) {
9026
+ const schedulerUrl = config.schedulerUrl || config.serverUrl || "https://mcp.integrate.dev";
9027
+ try {
9028
+ await fetch(`${schedulerUrl}/scheduler/update`, {
9029
+ method: "POST",
9030
+ headers: {
9031
+ "Content-Type": "application/json",
9032
+ "X-API-KEY": config.apiKey || ""
9033
+ },
9034
+ body: JSON.stringify({
9035
+ triggerId,
9036
+ schedule: body.schedule
9037
+ })
9038
+ });
9039
+ } catch (error) {
9040
+ console.error("[Trigger] Failed to update scheduler:", error);
9041
+ }
9042
+ }
9043
+ return Response.json(updated);
9044
+ } else if (!subAction && method === "DELETE") {
9045
+ await config.triggers.delete(triggerId, context2);
9046
+ const schedulerUrl = config.schedulerUrl || config.serverUrl || "https://mcp.integrate.dev";
9047
+ try {
9048
+ await fetch(`${schedulerUrl}/scheduler/unregister`, {
9049
+ method: "POST",
9050
+ headers: {
9051
+ "Content-Type": "application/json",
9052
+ "X-API-KEY": config.apiKey || ""
9053
+ },
9054
+ body: JSON.stringify({ triggerId })
9055
+ });
9056
+ } catch (error) {
9057
+ console.error("[Trigger] Failed to unregister from scheduler:", error);
9058
+ }
9059
+ return new Response(null, { status: 204 });
9060
+ }
9061
+ }
9062
+ return Response.json({ error: "Invalid trigger route or method" }, { status: 404 });
9063
+ } catch (error) {
9064
+ console.error("[Trigger] Error:", error);
9065
+ return Response.json({ error: error.message || "Failed to process trigger request" }, { status: error.statusCode || 500 });
9066
+ }
9067
+ }
8600
9068
  if (segments.length > 0) {
8601
- if (segments.length === 2 && segments[0] !== "oauth") {
9069
+ if (segments.length === 2 && segments[0] !== "oauth" && segments[0] !== "triggers") {
8602
9070
  return Response.json({ error: `Invalid route: /${segments.join("/")}` }, { status: 404 });
8603
9071
  }
8604
9072
  if (segments.length === 1 && segments[0] === "mcp") {
8605
9073
  return Response.json({ error: `Method ${method} not allowed for /mcp route. Use POST.` }, { status: 405 });
8606
9074
  }
9075
+ if (segments.length >= 1 && segments[0] === "triggers") {
9076
+ return Response.json({ error: `Invalid trigger route or method` }, { status: 404 });
9077
+ }
8607
9078
  }
8608
9079
  if (method === "GET" && action === "callback") {
8609
9080
  const url = new URL(webRequest.url);
@@ -263,10 +263,11 @@ export declare class OAuthHandler {
263
263
  *
264
264
  * @param request - Tool call request with name and arguments
265
265
  * @param authHeader - Authorization header from client (Bearer token)
266
+ * @param integrationsHeader - Comma-separated integration IDs configured on client
266
267
  * @returns Tool call response
267
268
  *
268
269
  * @throws Error if MCP server request fails
269
270
  */
270
- handleToolCall(request: ToolCallRequest, authHeader: string | null): Promise<ToolCallResponse>;
271
+ handleToolCall(request: ToolCallRequest, authHeader: string | null, integrationsHeader?: string | null): Promise<ToolCallResponse>;
271
272
  }
272
273
  //# sourceMappingURL=base-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-handler.d.ts","sourceRoot":"","sources":["../../../src/adapters/base-handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAO3D;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE;QACxB,iDAAiD;QACjD,QAAQ,EAAE,MAAM,CAAC;QACjB,qDAAqD;QACrD,YAAY,EAAE,MAAM,CAAC;QACrB,qCAAqC;QACrC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,8CAA8C;QAC9C,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,kFAAkF;QAClF,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC9B,CAAC,CAAC;IACH;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;;;;;OAcG;IACH,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,GAAG,UA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} from "./integrations/hubspot-client.js"
30
30
  import type { YouTubeIntegrationClient } from "./integrations/youtube-client.js";
31
31
  import type { CursorIntegrationClient } from "./integrations/cursor-client.js";
32
32
  import type { ServerIntegrationClient } from "./integrations/server-client.js";
33
+ import { TriggerClient } from "./triggers/client.js";
33
34
  import type { AuthStatus, OAuthCallbackParams, OAuthEventHandler, AuthStartedEvent, AuthCompleteEvent, AuthErrorEvent, AuthLogoutEvent, AuthDisconnectEvent } from "./oauth/types.js";
34
35
  /**
35
36
  * Tool invocation options
@@ -87,6 +88,7 @@ export declare class MCPClientBase<TIntegrations extends readonly MCPIntegration
87
88
  */
88
89
  oauthCallbackPromise?: Promise<void> | null;
89
90
  readonly server: ServerIntegrationClient;
91
+ readonly trigger: TriggerClient;
90
92
  constructor(config: MCPClientConfig<TIntegrations>);
91
93
  /**
92
94
  * Get default redirect URI for OAuth flows
@@ -106,6 +108,10 @@ export declare class MCPClientBase<TIntegrations extends readonly MCPIntegration
106
108
  * Returns undefined if the integration is not configured
107
109
  */
108
110
  private createIntegrationProxy;
111
+ /**
112
+ * Get comma-separated integration IDs for header propagation
113
+ */
114
+ private getIntegrationHeaderValue;
109
115
  /**
110
116
  * Create a proxy for the server namespace that handles server-level tools
111
117
  */