integrate-sdk 0.8.42 → 0.8.44-dev.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/dist/adapters/auto-routes.d.ts.map +1 -1
- package/dist/adapters/auto-routes.js +309 -143
- package/dist/adapters/base-handler.d.ts.map +1 -1
- package/dist/adapters/index.js +305 -141
- package/dist/adapters/nextjs-oauth-redirect.d.ts.map +1 -1
- package/dist/adapters/nextjs-oauth-redirect.js +47 -2
- package/dist/adapters/nextjs.d.ts.map +1 -1
- package/dist/adapters/nextjs.js +304 -141
- package/dist/adapters/node.js +304 -141
- package/dist/adapters/svelte-kit.js +304 -141
- package/dist/adapters/tanstack-start.js +304 -141
- package/dist/index.d.ts +19 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +319 -183
- package/dist/oauth.js +309 -143
- package/dist/react.js +59 -14
- package/dist/server.js +308 -141
- package/dist/src/adapters/auto-routes.d.ts.map +1 -1
- package/dist/src/adapters/base-handler.d.ts.map +1 -1
- package/dist/src/adapters/nextjs-oauth-redirect.d.ts.map +1 -1
- package/dist/src/adapters/nextjs.d.ts.map +1 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +15 -0
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/integrations/airtable.d.ts.map +1 -1
- package/dist/src/integrations/calcom.d.ts.map +1 -1
- package/dist/src/integrations/cursor.d.ts.map +1 -1
- package/dist/src/integrations/figma.d.ts.map +1 -1
- package/dist/src/integrations/gcal.d.ts.map +1 -1
- package/dist/src/integrations/github.d.ts.map +1 -1
- package/dist/src/integrations/gmail.d.ts.map +1 -1
- package/dist/src/integrations/gworkspace.d.ts.map +1 -1
- package/dist/src/integrations/hubspot.d.ts.map +1 -1
- package/dist/src/integrations/intercom.d.ts.map +1 -1
- package/dist/src/integrations/linear.d.ts.map +1 -1
- package/dist/src/integrations/notion.d.ts.map +1 -1
- package/dist/src/integrations/onedrive.d.ts.map +1 -1
- package/dist/src/integrations/outlook.d.ts.map +1 -1
- package/dist/src/integrations/polar.d.ts.map +1 -1
- package/dist/src/integrations/ramp.d.ts.map +1 -1
- package/dist/src/integrations/server-client.d.ts +15 -1
- package/dist/src/integrations/server-client.d.ts.map +1 -1
- package/dist/src/integrations/slack.d.ts.map +1 -1
- package/dist/src/integrations/stripe.d.ts.map +1 -1
- package/dist/src/integrations/todoist.d.ts.map +1 -1
- package/dist/src/integrations/vercel.d.ts.map +1 -1
- package/dist/src/integrations/whatsapp.d.ts.map +1 -1
- package/dist/src/integrations/youtube.d.ts.map +1 -1
- package/dist/src/integrations/zendesk.d.ts.map +1 -1
- package/dist/src/oauth/email-fetcher.d.ts.map +1 -1
- package/dist/src/oauth/manager.d.ts.map +1 -1
- package/dist/src/oauth/window-manager.d.ts.map +1 -1
- package/dist/src/react/hooks.d.ts.map +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/transport/http-session.d.ts.map +1 -1
- package/dist/src/transport/http-stream.d.ts.map +1 -1
- package/dist/src/utils/logger.d.ts +37 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/index.ts +20 -72
- package/package.json +2 -2
- package/dist/adapters/base-handler.js +0 -561
- package/dist/ai/cloudflare.d.ts +0 -158
- package/dist/ai/cloudflare.d.ts.map +0 -1
- package/dist/ai/cloudflare.js +0 -4249
- package/dist/ai/langchain.d.ts +0 -139
- package/dist/ai/langchain.d.ts.map +0 -1
- package/dist/ai/langchain.js +0 -4237
- package/dist/ai/llamaindex.d.ts +0 -125
- package/dist/ai/llamaindex.d.ts.map +0 -1
- package/dist/ai/llamaindex.js +0 -4236
- package/dist/ai/mastra.d.ts +0 -138
- package/dist/ai/mastra.d.ts.map +0 -1
- package/dist/ai/mastra.js +0 -4240
- package/dist/src/ai/cloudflare.d.ts +0 -158
- package/dist/src/ai/cloudflare.d.ts.map +0 -1
- package/dist/src/ai/langchain.d.ts +0 -139
- package/dist/src/ai/langchain.d.ts.map +0 -1
- package/dist/src/ai/llamaindex.d.ts +0 -125
- package/dist/src/ai/llamaindex.d.ts.map +0 -1
- package/dist/src/ai/mastra.d.ts +0 -138
- package/dist/src/ai/mastra.d.ts.map +0 -1
- package/dist/src/integrations/vercel-ai.d.ts +0 -127
- package/dist/src/integrations/vercel-ai.d.ts.map +0 -1
- package/dist/src/plugins/generic.d.ts +0 -99
- package/dist/src/plugins/generic.d.ts.map +0 -1
- package/dist/src/plugins/github-client.d.ts +0 -320
- package/dist/src/plugins/github-client.d.ts.map +0 -1
- package/dist/src/plugins/github.d.ts +0 -89
- package/dist/src/plugins/github.d.ts.map +0 -1
- package/dist/src/plugins/gmail-client.d.ts +0 -106
- package/dist/src/plugins/gmail-client.d.ts.map +0 -1
- package/dist/src/plugins/gmail.d.ts +0 -87
- package/dist/src/plugins/gmail.d.ts.map +0 -1
- package/dist/src/plugins/server-client.d.ts +0 -18
- package/dist/src/plugins/server-client.d.ts.map +0 -1
- package/dist/src/plugins/types.d.ts +0 -70
- package/dist/src/plugins/types.d.ts.map +0 -1
package/dist/oauth.js
CHANGED
|
@@ -10,6 +10,49 @@ var __export = (target, all) => {
|
|
|
10
10
|
};
|
|
11
11
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
12
12
|
|
|
13
|
+
// src/utils/logger.ts
|
|
14
|
+
function shouldLog(level) {
|
|
15
|
+
return logLevelHierarchy[level] <= logLevelHierarchy[globalLogLevel];
|
|
16
|
+
}
|
|
17
|
+
function setLogLevel(level) {
|
|
18
|
+
globalLogLevel = level;
|
|
19
|
+
}
|
|
20
|
+
function createLogger(namespace) {
|
|
21
|
+
const prefix = `[${namespace}]`;
|
|
22
|
+
return {
|
|
23
|
+
debug: (...args) => {
|
|
24
|
+
if (shouldLog("debug")) {
|
|
25
|
+
console.log(prefix, ...args);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
info: (...args) => {
|
|
29
|
+
if (shouldLog("info")) {
|
|
30
|
+
console.log(prefix, ...args);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
warn: (...args) => {
|
|
34
|
+
if (shouldLog("warn")) {
|
|
35
|
+
console.warn(prefix, ...args);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
error: (...args) => {
|
|
39
|
+
if (shouldLog("error")) {
|
|
40
|
+
console.error(prefix, ...args);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var globalLogLevel = "error", logLevelHierarchy;
|
|
46
|
+
var init_logger = __esm(() => {
|
|
47
|
+
logLevelHierarchy = {
|
|
48
|
+
none: 0,
|
|
49
|
+
error: 1,
|
|
50
|
+
warn: 2,
|
|
51
|
+
info: 3,
|
|
52
|
+
debug: 4
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
|
|
13
56
|
// src/protocol/jsonrpc.ts
|
|
14
57
|
function parseMessage(message) {
|
|
15
58
|
try {
|
|
@@ -75,7 +118,7 @@ class HttpSessionTransport {
|
|
|
75
118
|
const sid = response.headers.get("mcp-session-id");
|
|
76
119
|
if (sid) {
|
|
77
120
|
this.sessionId = sid;
|
|
78
|
-
|
|
121
|
+
logger.debug("Session established:", sid);
|
|
79
122
|
this.startSSEListener();
|
|
80
123
|
}
|
|
81
124
|
}
|
|
@@ -125,7 +168,7 @@ class HttpSessionTransport {
|
|
|
125
168
|
if (error instanceof Error && error.name === "AbortError") {
|
|
126
169
|
return;
|
|
127
170
|
}
|
|
128
|
-
|
|
171
|
+
logger.error("SSE connection error:", error);
|
|
129
172
|
}
|
|
130
173
|
}
|
|
131
174
|
async processSSEStream(body) {
|
|
@@ -154,7 +197,7 @@ class HttpSessionTransport {
|
|
|
154
197
|
if (error instanceof Error && error.name === "AbortError") {
|
|
155
198
|
return;
|
|
156
199
|
}
|
|
157
|
-
|
|
200
|
+
logger.error("SSE stream error:", error);
|
|
158
201
|
} finally {
|
|
159
202
|
reader.releaseLock();
|
|
160
203
|
}
|
|
@@ -166,11 +209,11 @@ class HttpSessionTransport {
|
|
|
166
209
|
try {
|
|
167
210
|
handler(message);
|
|
168
211
|
} catch (error) {
|
|
169
|
-
|
|
212
|
+
logger.error("Error in message handler:", error);
|
|
170
213
|
}
|
|
171
214
|
});
|
|
172
215
|
} catch (error) {
|
|
173
|
-
|
|
216
|
+
logger.error("Failed to parse notification:", error);
|
|
174
217
|
}
|
|
175
218
|
}
|
|
176
219
|
onMessage(handler) {
|
|
@@ -207,7 +250,11 @@ class HttpSessionTransport {
|
|
|
207
250
|
return { ...this.headers };
|
|
208
251
|
}
|
|
209
252
|
}
|
|
210
|
-
var
|
|
253
|
+
var logger;
|
|
254
|
+
var init_http_session = __esm(() => {
|
|
255
|
+
init_logger();
|
|
256
|
+
logger = createLogger("HTTPSession");
|
|
257
|
+
});
|
|
211
258
|
|
|
212
259
|
// src/protocol/messages.ts
|
|
213
260
|
var init_messages = () => {};
|
|
@@ -566,7 +613,7 @@ class OAuthWindowManager {
|
|
|
566
613
|
const windowName = `oauth_popup_${Date.now()}`;
|
|
567
614
|
this.popupWindow = window.open(url, windowName, features);
|
|
568
615
|
if (!this.popupWindow) {
|
|
569
|
-
|
|
616
|
+
logger2.warn("Popup was blocked by the browser. Please allow popups for this site.");
|
|
570
617
|
return null;
|
|
571
618
|
}
|
|
572
619
|
this.popupWindow.focus();
|
|
@@ -576,7 +623,7 @@ class OAuthWindowManager {
|
|
|
576
623
|
if (!isBrowser()) {
|
|
577
624
|
throw new Error("OAuthWindowManager.openRedirect() can only be used in browser environments");
|
|
578
625
|
}
|
|
579
|
-
|
|
626
|
+
logger2.debug("[OAuthWindowManager] Redirecting to:", url.substring(0, 100) + (url.length > 100 ? "..." : ""));
|
|
580
627
|
window.location.href = url;
|
|
581
628
|
}
|
|
582
629
|
listenForCallback(mode, timeoutMs = 5 * 60 * 1000) {
|
|
@@ -655,7 +702,7 @@ class OAuthWindowManager {
|
|
|
655
702
|
window.history.replaceState(null, "", window.location.pathname + window.location.search);
|
|
656
703
|
}
|
|
657
704
|
} catch (e) {
|
|
658
|
-
|
|
705
|
+
logger2.error("Failed to parse OAuth callback params from hash:", e);
|
|
659
706
|
}
|
|
660
707
|
}
|
|
661
708
|
if (!code && !error) {
|
|
@@ -668,7 +715,7 @@ class OAuthWindowManager {
|
|
|
668
715
|
sessionStorage.removeItem("oauth_callback_params");
|
|
669
716
|
}
|
|
670
717
|
} catch (e) {
|
|
671
|
-
|
|
718
|
+
logger2.error("Failed to parse OAuth callback params from sessionStorage:", e);
|
|
672
719
|
}
|
|
673
720
|
}
|
|
674
721
|
if (error) {
|
|
@@ -701,6 +748,11 @@ class OAuthWindowManager {
|
|
|
701
748
|
this.cleanup();
|
|
702
749
|
}
|
|
703
750
|
}
|
|
751
|
+
var logger2;
|
|
752
|
+
var init_window_manager = __esm(() => {
|
|
753
|
+
init_logger();
|
|
754
|
+
logger2 = createLogger("OAuthWindowManager");
|
|
755
|
+
});
|
|
704
756
|
|
|
705
757
|
// src/oauth/indexeddb-storage.ts
|
|
706
758
|
class IndexedDBStorage {
|
|
@@ -891,7 +943,7 @@ async function fetchUserEmail(provider, tokenData) {
|
|
|
891
943
|
return tokenData.email;
|
|
892
944
|
}
|
|
893
945
|
} catch (error) {
|
|
894
|
-
|
|
946
|
+
logger3.error(`Failed to fetch email for ${provider}:`, error);
|
|
895
947
|
return;
|
|
896
948
|
}
|
|
897
949
|
}
|
|
@@ -933,7 +985,7 @@ async function fetchGitHubEmail(accessToken) {
|
|
|
933
985
|
}
|
|
934
986
|
return;
|
|
935
987
|
} catch (error) {
|
|
936
|
-
|
|
988
|
+
logger3.error("Failed to fetch GitHub email:", error);
|
|
937
989
|
return;
|
|
938
990
|
}
|
|
939
991
|
}
|
|
@@ -950,7 +1002,7 @@ async function fetchGoogleEmail(accessToken) {
|
|
|
950
1002
|
const user = await response.json();
|
|
951
1003
|
return user.email;
|
|
952
1004
|
} catch (error) {
|
|
953
|
-
|
|
1005
|
+
logger3.error("Failed to fetch Google email:", error);
|
|
954
1006
|
return;
|
|
955
1007
|
}
|
|
956
1008
|
}
|
|
@@ -968,10 +1020,15 @@ async function fetchNotionEmail(accessToken) {
|
|
|
968
1020
|
const user = await response.json();
|
|
969
1021
|
return user.person?.email;
|
|
970
1022
|
} catch (error) {
|
|
971
|
-
|
|
1023
|
+
logger3.error("Failed to fetch Notion email:", error);
|
|
972
1024
|
return;
|
|
973
1025
|
}
|
|
974
1026
|
}
|
|
1027
|
+
var logger3;
|
|
1028
|
+
var init_email_fetcher = __esm(() => {
|
|
1029
|
+
init_logger();
|
|
1030
|
+
logger3 = createLogger("EmailFetcher");
|
|
1031
|
+
});
|
|
975
1032
|
|
|
976
1033
|
// src/oauth/manager.ts
|
|
977
1034
|
class OAuthManager {
|
|
@@ -1084,7 +1141,7 @@ class OAuthManager {
|
|
|
1084
1141
|
try {
|
|
1085
1142
|
await this.flowConfig.onAuthCallback(pendingAuth.provider, code, state);
|
|
1086
1143
|
} catch (error) {
|
|
1087
|
-
|
|
1144
|
+
logger4.error("Custom OAuth callback handler failed:", error);
|
|
1088
1145
|
}
|
|
1089
1146
|
}
|
|
1090
1147
|
try {
|
|
@@ -1132,20 +1189,20 @@ class OAuthManager {
|
|
|
1132
1189
|
try {
|
|
1133
1190
|
await this.removeTokenCallback(provider, email, context);
|
|
1134
1191
|
} catch (error) {
|
|
1135
|
-
|
|
1192
|
+
logger4.error(`Failed to delete token for ${provider} (${email}) from database:`, error);
|
|
1136
1193
|
}
|
|
1137
1194
|
} else if (this.setTokenCallback) {
|
|
1138
1195
|
try {
|
|
1139
1196
|
await this.setTokenCallback(provider, null, email, context);
|
|
1140
1197
|
} catch (error) {
|
|
1141
|
-
|
|
1198
|
+
logger4.error(`Failed to delete token for ${provider} (${email}) from database:`, error);
|
|
1142
1199
|
}
|
|
1143
1200
|
}
|
|
1144
1201
|
if (!this.setTokenCallback && !this.removeTokenCallback) {
|
|
1145
1202
|
try {
|
|
1146
1203
|
await this.indexedDBStorage.deleteToken(provider, email);
|
|
1147
1204
|
} catch (error) {
|
|
1148
|
-
|
|
1205
|
+
logger4.error(`Failed to delete token from IndexedDB for ${provider} (${email}):`, error);
|
|
1149
1206
|
}
|
|
1150
1207
|
}
|
|
1151
1208
|
this.providerTokens.delete(provider);
|
|
@@ -1155,13 +1212,13 @@ class OAuthManager {
|
|
|
1155
1212
|
try {
|
|
1156
1213
|
await this.removeTokenCallback(provider, undefined, context);
|
|
1157
1214
|
} catch (error) {
|
|
1158
|
-
|
|
1215
|
+
logger4.error(`Failed to delete tokens for ${provider} from database:`, error);
|
|
1159
1216
|
}
|
|
1160
1217
|
} else if (this.setTokenCallback) {
|
|
1161
1218
|
try {
|
|
1162
1219
|
await this.setTokenCallback(provider, null, undefined, context);
|
|
1163
1220
|
} catch (error) {
|
|
1164
|
-
|
|
1221
|
+
logger4.error(`Failed to delete tokens for ${provider} from database:`, error);
|
|
1165
1222
|
}
|
|
1166
1223
|
}
|
|
1167
1224
|
if (!this.setTokenCallback && !this.removeTokenCallback) {
|
|
@@ -1194,7 +1251,7 @@ class OAuthManager {
|
|
|
1194
1251
|
try {
|
|
1195
1252
|
return await this.indexedDBStorage.listAccounts(provider);
|
|
1196
1253
|
} catch (error) {
|
|
1197
|
-
|
|
1254
|
+
logger4.error(`Failed to list accounts for ${provider}:`, error);
|
|
1198
1255
|
return [];
|
|
1199
1256
|
}
|
|
1200
1257
|
}
|
|
@@ -1209,7 +1266,7 @@ class OAuthManager {
|
|
|
1209
1266
|
}
|
|
1210
1267
|
return tokenData;
|
|
1211
1268
|
} catch (error) {
|
|
1212
|
-
|
|
1269
|
+
logger4.error(`Failed to get token for ${provider} via callback:`, error);
|
|
1213
1270
|
return;
|
|
1214
1271
|
}
|
|
1215
1272
|
}
|
|
@@ -1221,7 +1278,7 @@ class OAuthManager {
|
|
|
1221
1278
|
}
|
|
1222
1279
|
return tokenData;
|
|
1223
1280
|
} catch (error) {
|
|
1224
|
-
|
|
1281
|
+
logger4.error(`Failed to get token from IndexedDB for ${provider}:`, error);
|
|
1225
1282
|
}
|
|
1226
1283
|
}
|
|
1227
1284
|
return this.providerTokens.get(provider);
|
|
@@ -1249,7 +1306,7 @@ class OAuthManager {
|
|
|
1249
1306
|
this.providerTokens.delete(provider);
|
|
1250
1307
|
if (!this.setTokenCallback && !this.removeTokenCallback && !this.skipLocalStorage) {
|
|
1251
1308
|
this.indexedDBStorage.deleteTokensByProvider(provider).catch((error) => {
|
|
1252
|
-
|
|
1309
|
+
logger4.error(`Failed to clear tokens for ${provider} from IndexedDB:`, error);
|
|
1253
1310
|
});
|
|
1254
1311
|
}
|
|
1255
1312
|
}
|
|
@@ -1269,7 +1326,7 @@ class OAuthManager {
|
|
|
1269
1326
|
} catch (localStorageError) {}
|
|
1270
1327
|
}
|
|
1271
1328
|
this.indexedDBStorage.clearAll().catch((error) => {
|
|
1272
|
-
|
|
1329
|
+
logger4.error("Failed to clear all tokens from IndexedDB:", error);
|
|
1273
1330
|
});
|
|
1274
1331
|
}
|
|
1275
1332
|
}
|
|
@@ -1287,7 +1344,7 @@ class OAuthManager {
|
|
|
1287
1344
|
}
|
|
1288
1345
|
keysToRemove.forEach((key) => window.localStorage.removeItem(key));
|
|
1289
1346
|
} catch (error) {
|
|
1290
|
-
|
|
1347
|
+
logger4.error("Failed to clear pending auths from localStorage:", error);
|
|
1291
1348
|
}
|
|
1292
1349
|
}
|
|
1293
1350
|
}
|
|
@@ -1296,7 +1353,7 @@ class OAuthManager {
|
|
|
1296
1353
|
try {
|
|
1297
1354
|
await this.setTokenCallback(provider, tokenData, email, context);
|
|
1298
1355
|
} catch (error) {
|
|
1299
|
-
|
|
1356
|
+
logger4.error(`Failed to ${tokenData === null ? "delete" : "save"} token for ${provider} via callback:`, error);
|
|
1300
1357
|
throw error;
|
|
1301
1358
|
}
|
|
1302
1359
|
return;
|
|
@@ -1337,10 +1394,10 @@ class OAuthManager {
|
|
|
1337
1394
|
const key = `integrate_token_${provider}`;
|
|
1338
1395
|
window.localStorage.setItem(key, JSON.stringify(tokenData));
|
|
1339
1396
|
} catch (localStorageError) {
|
|
1340
|
-
|
|
1397
|
+
logger4.error(`Failed to save token for ${provider} to localStorage:`, localStorageError);
|
|
1341
1398
|
}
|
|
1342
1399
|
} else {
|
|
1343
|
-
|
|
1400
|
+
logger4.error(`Failed to save token for ${provider} to IndexedDB:`, error);
|
|
1344
1401
|
}
|
|
1345
1402
|
}
|
|
1346
1403
|
} else {
|
|
@@ -1349,7 +1406,7 @@ class OAuthManager {
|
|
|
1349
1406
|
const key = `integrate_token_${provider}`;
|
|
1350
1407
|
window.localStorage.setItem(key, JSON.stringify(tokenData));
|
|
1351
1408
|
} catch (localStorageError) {
|
|
1352
|
-
|
|
1409
|
+
logger4.error(`Failed to save token for ${provider} to localStorage:`, localStorageError);
|
|
1353
1410
|
}
|
|
1354
1411
|
}
|
|
1355
1412
|
}
|
|
@@ -1359,7 +1416,7 @@ class OAuthManager {
|
|
|
1359
1416
|
try {
|
|
1360
1417
|
return await this.getTokenCallback(provider, email, context);
|
|
1361
1418
|
} catch (error) {
|
|
1362
|
-
|
|
1419
|
+
logger4.error(`Failed to load token for ${provider} via callback:`, error);
|
|
1363
1420
|
return;
|
|
1364
1421
|
}
|
|
1365
1422
|
}
|
|
@@ -1436,7 +1493,7 @@ class OAuthManager {
|
|
|
1436
1493
|
const key = `integrate_oauth_pending_${state}`;
|
|
1437
1494
|
window.localStorage.setItem(key, JSON.stringify(pendingAuth));
|
|
1438
1495
|
} catch (error) {
|
|
1439
|
-
|
|
1496
|
+
logger4.error("Failed to save pending auth to localStorage:", error);
|
|
1440
1497
|
}
|
|
1441
1498
|
}
|
|
1442
1499
|
}
|
|
@@ -1449,7 +1506,7 @@ class OAuthManager {
|
|
|
1449
1506
|
return JSON.parse(stored);
|
|
1450
1507
|
}
|
|
1451
1508
|
} catch (error) {
|
|
1452
|
-
|
|
1509
|
+
logger4.error("Failed to load pending auth from localStorage:", error);
|
|
1453
1510
|
}
|
|
1454
1511
|
}
|
|
1455
1512
|
return;
|
|
@@ -1460,7 +1517,7 @@ class OAuthManager {
|
|
|
1460
1517
|
const key = `integrate_oauth_pending_${state}`;
|
|
1461
1518
|
window.localStorage.removeItem(key);
|
|
1462
1519
|
} catch (error) {
|
|
1463
|
-
|
|
1520
|
+
logger4.error("Failed to remove pending auth from localStorage:", error);
|
|
1464
1521
|
}
|
|
1465
1522
|
}
|
|
1466
1523
|
}
|
|
@@ -1489,7 +1546,7 @@ class OAuthManager {
|
|
|
1489
1546
|
}
|
|
1490
1547
|
keysToRemove.forEach((key) => window.localStorage.removeItem(key));
|
|
1491
1548
|
} catch (error) {
|
|
1492
|
-
|
|
1549
|
+
logger4.error("Failed to cleanup expired pending auths:", error);
|
|
1493
1550
|
}
|
|
1494
1551
|
}
|
|
1495
1552
|
}
|
|
@@ -1557,7 +1614,13 @@ class OAuthManager {
|
|
|
1557
1614
|
this.windowManager.close();
|
|
1558
1615
|
}
|
|
1559
1616
|
}
|
|
1560
|
-
var
|
|
1617
|
+
var logger4;
|
|
1618
|
+
var init_manager = __esm(() => {
|
|
1619
|
+
init_window_manager();
|
|
1620
|
+
init_email_fetcher();
|
|
1621
|
+
init_logger();
|
|
1622
|
+
logger4 = createLogger("OAuth");
|
|
1623
|
+
});
|
|
1561
1624
|
|
|
1562
1625
|
// src/client.ts
|
|
1563
1626
|
class SimpleEventEmitter {
|
|
@@ -1581,7 +1644,7 @@ class SimpleEventEmitter {
|
|
|
1581
1644
|
try {
|
|
1582
1645
|
handler(payload);
|
|
1583
1646
|
} catch (error) {
|
|
1584
|
-
|
|
1647
|
+
logger5.error(`Error in event handler for ${event}:`, error);
|
|
1585
1648
|
}
|
|
1586
1649
|
});
|
|
1587
1650
|
}
|
|
@@ -1673,7 +1736,7 @@ class MCPClientBase {
|
|
|
1673
1736
|
this.authState.set(provider, { authenticated: !!tokenData });
|
|
1674
1737
|
}
|
|
1675
1738
|
} catch (error) {
|
|
1676
|
-
|
|
1739
|
+
logger5.error(`Failed to check token for ${provider}:`, error);
|
|
1677
1740
|
const currentState = this.authState.get(provider);
|
|
1678
1741
|
if (currentState && !currentState.authenticated && !currentState.lastError) {
|
|
1679
1742
|
this.authState.set(provider, { authenticated: false });
|
|
@@ -1682,7 +1745,7 @@ class MCPClientBase {
|
|
|
1682
1745
|
}
|
|
1683
1746
|
}
|
|
1684
1747
|
}).catch((error) => {
|
|
1685
|
-
|
|
1748
|
+
logger5.error("Failed to load provider tokens:", error);
|
|
1686
1749
|
});
|
|
1687
1750
|
} else {
|
|
1688
1751
|
this.oauthManager.loadAllProviderTokensSync(providers);
|
|
@@ -1777,16 +1840,56 @@ class MCPClientBase {
|
|
|
1777
1840
|
return new Proxy({}, {
|
|
1778
1841
|
get: (_target, methodName) => {
|
|
1779
1842
|
if (methodName === "listConfiguredIntegrations") {
|
|
1780
|
-
return async () =>
|
|
1781
|
-
|
|
1843
|
+
return async () => {
|
|
1844
|
+
const localIntegrations = this.integrations.map((integration) => ({
|
|
1782
1845
|
id: integration.id,
|
|
1783
1846
|
name: integration.name || integration.id,
|
|
1784
1847
|
tools: integration.tools,
|
|
1785
1848
|
hasOAuth: !!integration.oauth,
|
|
1786
1849
|
scopes: integration.oauth?.scopes,
|
|
1787
1850
|
provider: integration.oauth?.provider
|
|
1788
|
-
}))
|
|
1789
|
-
|
|
1851
|
+
}));
|
|
1852
|
+
let serverMetadataMap = new Map;
|
|
1853
|
+
try {
|
|
1854
|
+
const serverResponse = await this.callServerToolInternal("list_all_providers");
|
|
1855
|
+
if (serverResponse.content && serverResponse.content.length > 0) {
|
|
1856
|
+
const textContent = serverResponse.content[0]?.text;
|
|
1857
|
+
if (textContent) {
|
|
1858
|
+
try {
|
|
1859
|
+
const parsed = JSON.parse(textContent);
|
|
1860
|
+
const integrations = parsed.integrations || [];
|
|
1861
|
+
for (const metadata of integrations) {
|
|
1862
|
+
const key = metadata.name.toLowerCase();
|
|
1863
|
+
serverMetadataMap.set(key, metadata);
|
|
1864
|
+
}
|
|
1865
|
+
} catch (parseError) {
|
|
1866
|
+
logger5.debug("Failed to parse server metadata response:", parseError);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
} catch (error) {
|
|
1871
|
+
logger5.debug("Failed to fetch server metadata, returning local-only data:", error);
|
|
1872
|
+
return { integrations: localIntegrations };
|
|
1873
|
+
}
|
|
1874
|
+
const mergedIntegrations = localIntegrations.map((local) => {
|
|
1875
|
+
const metadataKey = local.name.toLowerCase();
|
|
1876
|
+
const serverMetadata = serverMetadataMap.get(metadataKey);
|
|
1877
|
+
const idKey = local.id.toLowerCase();
|
|
1878
|
+
const serverMetadataById = serverMetadataMap.get(idKey) || serverMetadata;
|
|
1879
|
+
if (serverMetadataById) {
|
|
1880
|
+
return {
|
|
1881
|
+
...local,
|
|
1882
|
+
name: serverMetadataById.name || local.name,
|
|
1883
|
+
logoUrl: serverMetadataById.logo_url,
|
|
1884
|
+
description: serverMetadataById.description,
|
|
1885
|
+
owner: serverMetadataById.owner,
|
|
1886
|
+
exampleUsage: serverMetadataById.example_usage
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
return local;
|
|
1890
|
+
});
|
|
1891
|
+
return { integrations: mergedIntegrations };
|
|
1892
|
+
};
|
|
1790
1893
|
}
|
|
1791
1894
|
return async (args, options) => {
|
|
1792
1895
|
const toolName = methodToToolName(methodName, "");
|
|
@@ -1845,7 +1948,7 @@ class MCPClientBase {
|
|
|
1845
1948
|
this.availableTools.set(tool.name, tool);
|
|
1846
1949
|
}
|
|
1847
1950
|
const enabledTools = response.tools.filter((tool) => this.enabledToolNames.has(tool.name));
|
|
1848
|
-
|
|
1951
|
+
logger5.debug(`Discovered ${response.tools.length} tools, ${enabledTools.length} enabled by integrations`);
|
|
1849
1952
|
}
|
|
1850
1953
|
async _callToolByName(name, args, options) {
|
|
1851
1954
|
return await this.callToolWithRetry(name, args, 0, options);
|
|
@@ -2238,12 +2341,14 @@ class MCPClientBase {
|
|
|
2238
2341
|
return success;
|
|
2239
2342
|
}
|
|
2240
2343
|
}
|
|
2241
|
-
var MCP_SERVER_URL = "https://mcp.integrate.dev/api/v1/mcp", clientCache, cleanupClients;
|
|
2344
|
+
var MCP_SERVER_URL = "https://mcp.integrate.dev/api/v1/mcp", logger5, clientCache, cleanupClients;
|
|
2242
2345
|
var init_client = __esm(() => {
|
|
2243
2346
|
init_http_session();
|
|
2244
2347
|
init_messages();
|
|
2245
2348
|
init_errors();
|
|
2349
|
+
init_logger();
|
|
2246
2350
|
init_manager();
|
|
2351
|
+
logger5 = createLogger("MCPClient");
|
|
2247
2352
|
clientCache = new Map;
|
|
2248
2353
|
cleanupClients = new Set;
|
|
2249
2354
|
});
|
|
@@ -2264,7 +2369,7 @@ function createNextOAuthHandler(config) {
|
|
|
2264
2369
|
}
|
|
2265
2370
|
return response;
|
|
2266
2371
|
} catch (error) {
|
|
2267
|
-
|
|
2372
|
+
logger6.error("[OAuth Authorize] Error:", error);
|
|
2268
2373
|
return Response.json({ error: error.message || "Failed to get authorization URL" }, { status: 500 });
|
|
2269
2374
|
}
|
|
2270
2375
|
},
|
|
@@ -2280,7 +2385,7 @@ function createNextOAuthHandler(config) {
|
|
|
2280
2385
|
}
|
|
2281
2386
|
return response;
|
|
2282
2387
|
} catch (error) {
|
|
2283
|
-
|
|
2388
|
+
logger6.error("[OAuth Callback] Error:", error);
|
|
2284
2389
|
return Response.json({ error: error.message || "Failed to exchange authorization code" }, { status: 500 });
|
|
2285
2390
|
}
|
|
2286
2391
|
},
|
|
@@ -2302,7 +2407,7 @@ function createNextOAuthHandler(config) {
|
|
|
2302
2407
|
}
|
|
2303
2408
|
return response;
|
|
2304
2409
|
} catch (error) {
|
|
2305
|
-
|
|
2410
|
+
logger6.error("[OAuth Status] Error:", error);
|
|
2306
2411
|
return Response.json({ error: error.message || "Failed to check authorization status" }, { status: 500 });
|
|
2307
2412
|
}
|
|
2308
2413
|
},
|
|
@@ -2325,7 +2430,7 @@ function createNextOAuthHandler(config) {
|
|
|
2325
2430
|
}
|
|
2326
2431
|
return response;
|
|
2327
2432
|
} catch (error) {
|
|
2328
|
-
|
|
2433
|
+
logger6.error("[OAuth Disconnect] Error:", error);
|
|
2329
2434
|
return Response.json({ error: error.message || "Failed to disconnect provider" }, { status: 500 });
|
|
2330
2435
|
}
|
|
2331
2436
|
},
|
|
@@ -2366,7 +2471,7 @@ function createNextOAuthHandler(config) {
|
|
|
2366
2471
|
const result = await handler.handleToolCall(body, authHeader, integrationsHeader);
|
|
2367
2472
|
return Response.json(result);
|
|
2368
2473
|
} catch (error) {
|
|
2369
|
-
|
|
2474
|
+
logger6.error("[MCP Tool Call] Error:", error);
|
|
2370
2475
|
return Response.json({ error: error.message || "Failed to execute tool call" }, { status: error.statusCode || 500 });
|
|
2371
2476
|
}
|
|
2372
2477
|
},
|
|
@@ -2411,11 +2516,11 @@ function createNextOAuthHandler(config) {
|
|
|
2411
2516
|
const errorDescription = searchParams.get("error_description");
|
|
2412
2517
|
if (error) {
|
|
2413
2518
|
const errorMsg = errorDescription || error;
|
|
2414
|
-
|
|
2519
|
+
logger6.error("[OAuth Redirect] Error:", errorMsg);
|
|
2415
2520
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(errorMsg)}`, req.url));
|
|
2416
2521
|
}
|
|
2417
2522
|
if (!code || !state) {
|
|
2418
|
-
|
|
2523
|
+
logger6.error("[OAuth Redirect] Missing code or state parameter");
|
|
2419
2524
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent("Invalid OAuth callback")}`, req.url));
|
|
2420
2525
|
}
|
|
2421
2526
|
let returnUrl = defaultRedirectUrl;
|
|
@@ -2450,7 +2555,12 @@ function createNextOAuthHandler(config) {
|
|
|
2450
2555
|
};
|
|
2451
2556
|
return handlers;
|
|
2452
2557
|
}
|
|
2453
|
-
var
|
|
2558
|
+
var logger6;
|
|
2559
|
+
var init_nextjs = __esm(() => {
|
|
2560
|
+
init_base_handler();
|
|
2561
|
+
init_logger();
|
|
2562
|
+
logger6 = createLogger("NextJSOAuth");
|
|
2563
|
+
});
|
|
2454
2564
|
|
|
2455
2565
|
// src/utils/env.ts
|
|
2456
2566
|
function getEnv(key) {
|
|
@@ -2534,15 +2644,17 @@ function githubIntegration(config = {}) {
|
|
|
2534
2644
|
tools: [...GITHUB_TOOLS],
|
|
2535
2645
|
oauth,
|
|
2536
2646
|
async onInit(_client) {
|
|
2537
|
-
|
|
2647
|
+
logger7.debug("GitHub integration initialized");
|
|
2538
2648
|
},
|
|
2539
2649
|
async onAfterConnect(_client) {
|
|
2540
|
-
|
|
2650
|
+
logger7.debug("GitHub integration connected");
|
|
2541
2651
|
}
|
|
2542
2652
|
};
|
|
2543
2653
|
}
|
|
2544
|
-
var GITHUB_TOOLS;
|
|
2654
|
+
var logger7, GITHUB_TOOLS;
|
|
2545
2655
|
var init_github = __esm(() => {
|
|
2656
|
+
init_logger();
|
|
2657
|
+
logger7 = createLogger("GitHub");
|
|
2546
2658
|
GITHUB_TOOLS = [
|
|
2547
2659
|
"github_create_issue",
|
|
2548
2660
|
"github_list_issues",
|
|
@@ -2585,15 +2697,17 @@ function gmailIntegration(config = {}) {
|
|
|
2585
2697
|
tools: [...GMAIL_TOOLS],
|
|
2586
2698
|
oauth,
|
|
2587
2699
|
async onInit(_client) {
|
|
2588
|
-
|
|
2700
|
+
logger8.debug("Gmail integration initialized");
|
|
2589
2701
|
},
|
|
2590
2702
|
async onAfterConnect(_client) {
|
|
2591
|
-
|
|
2703
|
+
logger8.debug("Gmail integration connected");
|
|
2592
2704
|
}
|
|
2593
2705
|
};
|
|
2594
2706
|
}
|
|
2595
|
-
var GMAIL_TOOLS;
|
|
2707
|
+
var logger8, GMAIL_TOOLS;
|
|
2596
2708
|
var init_gmail = __esm(() => {
|
|
2709
|
+
init_logger();
|
|
2710
|
+
logger8 = createLogger("Gmail");
|
|
2597
2711
|
GMAIL_TOOLS = [
|
|
2598
2712
|
"gmail_send_message",
|
|
2599
2713
|
"gmail_list_messages",
|
|
@@ -2622,15 +2736,17 @@ function notionIntegration(config = {}) {
|
|
|
2622
2736
|
tools: [...NOTION_TOOLS],
|
|
2623
2737
|
oauth,
|
|
2624
2738
|
async onInit(_client) {
|
|
2625
|
-
|
|
2739
|
+
logger9.debug("Notion integration initialized");
|
|
2626
2740
|
},
|
|
2627
2741
|
async onAfterConnect(_client) {
|
|
2628
|
-
|
|
2742
|
+
logger9.debug("Notion integration connected");
|
|
2629
2743
|
}
|
|
2630
2744
|
};
|
|
2631
2745
|
}
|
|
2632
|
-
var NOTION_TOOLS;
|
|
2746
|
+
var logger9, NOTION_TOOLS;
|
|
2633
2747
|
var init_notion = __esm(() => {
|
|
2748
|
+
init_logger();
|
|
2749
|
+
logger9 = createLogger("Notion");
|
|
2634
2750
|
NOTION_TOOLS = [
|
|
2635
2751
|
"notion_search",
|
|
2636
2752
|
"notion_get_page"
|
|
@@ -2654,15 +2770,17 @@ function slackIntegration(config = {}) {
|
|
|
2654
2770
|
tools: [...SLACK_TOOLS],
|
|
2655
2771
|
oauth,
|
|
2656
2772
|
async onInit(_client) {
|
|
2657
|
-
|
|
2773
|
+
logger10.debug("Slack integration initialized");
|
|
2658
2774
|
},
|
|
2659
2775
|
async onAfterConnect(_client) {
|
|
2660
|
-
|
|
2776
|
+
logger10.debug("Slack integration connected");
|
|
2661
2777
|
}
|
|
2662
2778
|
};
|
|
2663
2779
|
}
|
|
2664
|
-
var SLACK_TOOLS;
|
|
2780
|
+
var logger10, SLACK_TOOLS;
|
|
2665
2781
|
var init_slack = __esm(() => {
|
|
2782
|
+
init_logger();
|
|
2783
|
+
logger10 = createLogger("Slack");
|
|
2666
2784
|
SLACK_TOOLS = [
|
|
2667
2785
|
"slack_send_message",
|
|
2668
2786
|
"slack_list_channels",
|
|
@@ -2693,15 +2811,17 @@ function linearIntegration(config = {}) {
|
|
|
2693
2811
|
tools: [...LINEAR_TOOLS],
|
|
2694
2812
|
oauth,
|
|
2695
2813
|
async onInit(_client) {
|
|
2696
|
-
|
|
2814
|
+
logger11.debug("Linear integration initialized");
|
|
2697
2815
|
},
|
|
2698
2816
|
async onAfterConnect(_client) {
|
|
2699
|
-
|
|
2817
|
+
logger11.debug("Linear integration connected");
|
|
2700
2818
|
}
|
|
2701
2819
|
};
|
|
2702
2820
|
}
|
|
2703
|
-
var LINEAR_TOOLS;
|
|
2821
|
+
var logger11, LINEAR_TOOLS;
|
|
2704
2822
|
var init_linear = __esm(() => {
|
|
2823
|
+
init_logger();
|
|
2824
|
+
logger11 = createLogger("Linear");
|
|
2705
2825
|
LINEAR_TOOLS = [
|
|
2706
2826
|
"linear_create_issue",
|
|
2707
2827
|
"linear_list_issues",
|
|
@@ -2732,15 +2852,17 @@ function vercelIntegration(config = {}) {
|
|
|
2732
2852
|
tools: [...VERCEL_TOOLS],
|
|
2733
2853
|
oauth,
|
|
2734
2854
|
async onInit(_client) {
|
|
2735
|
-
|
|
2855
|
+
logger12.debug("Vercel integration initialized");
|
|
2736
2856
|
},
|
|
2737
2857
|
async onAfterConnect(_client) {
|
|
2738
|
-
|
|
2858
|
+
logger12.debug("Vercel integration connected");
|
|
2739
2859
|
}
|
|
2740
2860
|
};
|
|
2741
2861
|
}
|
|
2742
|
-
var VERCEL_TOOLS;
|
|
2862
|
+
var logger12, VERCEL_TOOLS;
|
|
2743
2863
|
var init_vercel = __esm(() => {
|
|
2864
|
+
init_logger();
|
|
2865
|
+
logger12 = createLogger("Vercel");
|
|
2744
2866
|
VERCEL_TOOLS = [
|
|
2745
2867
|
"vercel_list_projects",
|
|
2746
2868
|
"vercel_get_project",
|
|
@@ -2772,15 +2894,17 @@ function zendeskIntegration(config = {}) {
|
|
|
2772
2894
|
tools: [...ZENDESK_TOOLS],
|
|
2773
2895
|
oauth,
|
|
2774
2896
|
async onInit(_client) {
|
|
2775
|
-
|
|
2897
|
+
logger13.debug("Zendesk integration initialized");
|
|
2776
2898
|
},
|
|
2777
2899
|
async onAfterConnect(_client) {
|
|
2778
|
-
|
|
2900
|
+
logger13.debug("Zendesk integration connected");
|
|
2779
2901
|
}
|
|
2780
2902
|
};
|
|
2781
2903
|
}
|
|
2782
|
-
var ZENDESK_TOOLS;
|
|
2904
|
+
var logger13, ZENDESK_TOOLS;
|
|
2783
2905
|
var init_zendesk = __esm(() => {
|
|
2906
|
+
init_logger();
|
|
2907
|
+
logger13 = createLogger("Zendesk");
|
|
2784
2908
|
ZENDESK_TOOLS = [
|
|
2785
2909
|
"zendesk_list_tickets",
|
|
2786
2910
|
"zendesk_get_ticket",
|
|
@@ -2811,15 +2935,17 @@ function stripeIntegration(config = {}) {
|
|
|
2811
2935
|
tools: [...STRIPE_TOOLS],
|
|
2812
2936
|
oauth,
|
|
2813
2937
|
async onInit(_client) {
|
|
2814
|
-
|
|
2938
|
+
logger14.debug("Stripe integration initialized");
|
|
2815
2939
|
},
|
|
2816
2940
|
async onAfterConnect(_client) {
|
|
2817
|
-
|
|
2941
|
+
logger14.debug("Stripe integration connected");
|
|
2818
2942
|
}
|
|
2819
2943
|
};
|
|
2820
2944
|
}
|
|
2821
|
-
var STRIPE_TOOLS;
|
|
2945
|
+
var logger14, STRIPE_TOOLS;
|
|
2822
2946
|
var init_stripe = __esm(() => {
|
|
2947
|
+
init_logger();
|
|
2948
|
+
logger14 = createLogger("Stripe");
|
|
2823
2949
|
STRIPE_TOOLS = [
|
|
2824
2950
|
"stripe_list_customers",
|
|
2825
2951
|
"stripe_get_customer",
|
|
@@ -2850,15 +2976,17 @@ function gcalIntegration(config = {}) {
|
|
|
2850
2976
|
tools: [...GCAL_TOOLS],
|
|
2851
2977
|
oauth,
|
|
2852
2978
|
async onInit(_client) {
|
|
2853
|
-
|
|
2979
|
+
logger15.debug("Google Calendar integration initialized");
|
|
2854
2980
|
},
|
|
2855
2981
|
async onAfterConnect(_client) {
|
|
2856
|
-
|
|
2982
|
+
logger15.debug("Google Calendar integration connected");
|
|
2857
2983
|
}
|
|
2858
2984
|
};
|
|
2859
2985
|
}
|
|
2860
|
-
var GCAL_TOOLS;
|
|
2986
|
+
var logger15, GCAL_TOOLS;
|
|
2861
2987
|
var init_gcal = __esm(() => {
|
|
2988
|
+
init_logger();
|
|
2989
|
+
logger15 = createLogger("Google Calendar");
|
|
2862
2990
|
GCAL_TOOLS = [
|
|
2863
2991
|
"gcal_list_calendars",
|
|
2864
2992
|
"gcal_get_calendar",
|
|
@@ -2889,15 +3017,17 @@ function outlookIntegration(config = {}) {
|
|
|
2889
3017
|
tools: [...OUTLOOK_TOOLS],
|
|
2890
3018
|
oauth,
|
|
2891
3019
|
async onInit(_client) {
|
|
2892
|
-
|
|
3020
|
+
logger16.debug("Outlook integration initialized");
|
|
2893
3021
|
},
|
|
2894
3022
|
async onAfterConnect(_client) {
|
|
2895
|
-
|
|
3023
|
+
logger16.debug("Outlook integration connected");
|
|
2896
3024
|
}
|
|
2897
3025
|
};
|
|
2898
3026
|
}
|
|
2899
|
-
var OUTLOOK_TOOLS;
|
|
3027
|
+
var logger16, OUTLOOK_TOOLS;
|
|
2900
3028
|
var init_outlook = __esm(() => {
|
|
3029
|
+
init_logger();
|
|
3030
|
+
logger16 = createLogger("Outlook");
|
|
2901
3031
|
OUTLOOK_TOOLS = [
|
|
2902
3032
|
"outlook_list_messages",
|
|
2903
3033
|
"outlook_get_message",
|
|
@@ -2928,15 +3058,17 @@ function airtableIntegration(config = {}) {
|
|
|
2928
3058
|
tools: [...AIRTABLE_TOOLS],
|
|
2929
3059
|
oauth,
|
|
2930
3060
|
async onInit(_client) {
|
|
2931
|
-
|
|
3061
|
+
logger17.debug("Airtable integration initialized");
|
|
2932
3062
|
},
|
|
2933
3063
|
async onAfterConnect(_client) {
|
|
2934
|
-
|
|
3064
|
+
logger17.debug("Airtable integration connected");
|
|
2935
3065
|
}
|
|
2936
3066
|
};
|
|
2937
3067
|
}
|
|
2938
|
-
var AIRTABLE_TOOLS;
|
|
3068
|
+
var logger17, AIRTABLE_TOOLS;
|
|
2939
3069
|
var init_airtable = __esm(() => {
|
|
3070
|
+
init_logger();
|
|
3071
|
+
logger17 = createLogger("Airtable");
|
|
2940
3072
|
AIRTABLE_TOOLS = [
|
|
2941
3073
|
"airtable_list_bases",
|
|
2942
3074
|
"airtable_get_base",
|
|
@@ -2967,15 +3099,17 @@ function todoistIntegration(config = {}) {
|
|
|
2967
3099
|
tools: [...TODOIST_TOOLS],
|
|
2968
3100
|
oauth,
|
|
2969
3101
|
async onInit(_client) {
|
|
2970
|
-
|
|
3102
|
+
logger18.debug("Todoist integration initialized");
|
|
2971
3103
|
},
|
|
2972
3104
|
async onAfterConnect(_client) {
|
|
2973
|
-
|
|
3105
|
+
logger18.debug("Todoist integration connected");
|
|
2974
3106
|
}
|
|
2975
3107
|
};
|
|
2976
3108
|
}
|
|
2977
|
-
var TODOIST_TOOLS;
|
|
3109
|
+
var logger18, TODOIST_TOOLS;
|
|
2978
3110
|
var init_todoist = __esm(() => {
|
|
3111
|
+
init_logger();
|
|
3112
|
+
logger18 = createLogger("Todoist");
|
|
2979
3113
|
TODOIST_TOOLS = [
|
|
2980
3114
|
"todoist_list_projects",
|
|
2981
3115
|
"todoist_get_project",
|
|
@@ -3007,15 +3141,17 @@ function whatsappIntegration(config = {}) {
|
|
|
3007
3141
|
tools: [...WHATSAPP_TOOLS],
|
|
3008
3142
|
oauth,
|
|
3009
3143
|
async onInit(_client) {
|
|
3010
|
-
|
|
3144
|
+
logger19.debug("WhatsApp Business integration initialized");
|
|
3011
3145
|
},
|
|
3012
3146
|
async onAfterConnect(_client) {
|
|
3013
|
-
|
|
3147
|
+
logger19.debug("WhatsApp Business integration connected");
|
|
3014
3148
|
}
|
|
3015
3149
|
};
|
|
3016
3150
|
}
|
|
3017
|
-
var WHATSAPP_TOOLS;
|
|
3151
|
+
var logger19, WHATSAPP_TOOLS;
|
|
3018
3152
|
var init_whatsapp = __esm(() => {
|
|
3153
|
+
init_logger();
|
|
3154
|
+
logger19 = createLogger("WhatsApp");
|
|
3019
3155
|
WHATSAPP_TOOLS = [
|
|
3020
3156
|
"whatsapp_send_message",
|
|
3021
3157
|
"whatsapp_send_template",
|
|
@@ -3046,15 +3182,17 @@ function calcomIntegration(config = {}) {
|
|
|
3046
3182
|
tools: [...CALCOM_TOOLS],
|
|
3047
3183
|
oauth,
|
|
3048
3184
|
async onInit(_client) {
|
|
3049
|
-
|
|
3185
|
+
logger20.debug("Cal.com integration initialized");
|
|
3050
3186
|
},
|
|
3051
3187
|
async onAfterConnect(_client) {
|
|
3052
|
-
|
|
3188
|
+
logger20.debug("Cal.com integration connected");
|
|
3053
3189
|
}
|
|
3054
3190
|
};
|
|
3055
3191
|
}
|
|
3056
|
-
var CALCOM_TOOLS;
|
|
3192
|
+
var logger20, CALCOM_TOOLS;
|
|
3057
3193
|
var init_calcom = __esm(() => {
|
|
3194
|
+
init_logger();
|
|
3195
|
+
logger20 = createLogger("Cal.com");
|
|
3058
3196
|
CALCOM_TOOLS = [
|
|
3059
3197
|
"calcom_list_bookings",
|
|
3060
3198
|
"calcom_get_booking",
|
|
@@ -3086,15 +3224,17 @@ function rampIntegration(config = {}) {
|
|
|
3086
3224
|
tools: [...RAMP_TOOLS],
|
|
3087
3225
|
oauth,
|
|
3088
3226
|
async onInit(_client) {
|
|
3089
|
-
|
|
3227
|
+
logger21.debug("Ramp integration initialized");
|
|
3090
3228
|
},
|
|
3091
3229
|
async onAfterConnect(_client) {
|
|
3092
|
-
|
|
3230
|
+
logger21.debug("Ramp integration connected");
|
|
3093
3231
|
}
|
|
3094
3232
|
};
|
|
3095
3233
|
}
|
|
3096
|
-
var RAMP_TOOLS;
|
|
3234
|
+
var logger21, RAMP_TOOLS;
|
|
3097
3235
|
var init_ramp = __esm(() => {
|
|
3236
|
+
init_logger();
|
|
3237
|
+
logger21 = createLogger("Ramp");
|
|
3098
3238
|
RAMP_TOOLS = [
|
|
3099
3239
|
"ramp_list_transactions",
|
|
3100
3240
|
"ramp_get_transaction",
|
|
@@ -3125,15 +3265,17 @@ function onedriveIntegration(config = {}) {
|
|
|
3125
3265
|
tools: [...ONEDRIVE_TOOLS],
|
|
3126
3266
|
oauth,
|
|
3127
3267
|
async onInit(_client) {
|
|
3128
|
-
|
|
3268
|
+
logger22.debug("OneDrive integration initialized");
|
|
3129
3269
|
},
|
|
3130
3270
|
async onAfterConnect(_client) {
|
|
3131
|
-
|
|
3271
|
+
logger22.debug("OneDrive integration connected");
|
|
3132
3272
|
}
|
|
3133
3273
|
};
|
|
3134
3274
|
}
|
|
3135
|
-
var ONEDRIVE_TOOLS;
|
|
3275
|
+
var logger22, ONEDRIVE_TOOLS;
|
|
3136
3276
|
var init_onedrive = __esm(() => {
|
|
3277
|
+
init_logger();
|
|
3278
|
+
logger22 = createLogger("OneDrive");
|
|
3137
3279
|
ONEDRIVE_TOOLS = [
|
|
3138
3280
|
"onedrive_list_files",
|
|
3139
3281
|
"onedrive_get_file",
|
|
@@ -3172,15 +3314,17 @@ function gworkspaceIntegration(config = {}) {
|
|
|
3172
3314
|
tools: [...GWORKSPACE_TOOLS],
|
|
3173
3315
|
oauth,
|
|
3174
3316
|
async onInit(_client) {
|
|
3175
|
-
|
|
3317
|
+
logger23.debug("Google Workspace integration initialized");
|
|
3176
3318
|
},
|
|
3177
3319
|
async onAfterConnect(_client) {
|
|
3178
|
-
|
|
3320
|
+
logger23.debug("Google Workspace integration connected");
|
|
3179
3321
|
}
|
|
3180
3322
|
};
|
|
3181
3323
|
}
|
|
3182
|
-
var GWORKSPACE_TOOLS;
|
|
3324
|
+
var logger23, GWORKSPACE_TOOLS;
|
|
3183
3325
|
var init_gworkspace = __esm(() => {
|
|
3326
|
+
init_logger();
|
|
3327
|
+
logger23 = createLogger("Google Workspace");
|
|
3184
3328
|
GWORKSPACE_TOOLS = [
|
|
3185
3329
|
"gworkspace_sheets_list",
|
|
3186
3330
|
"gworkspace_sheets_get",
|
|
@@ -3215,15 +3359,17 @@ function polarIntegration(config = {}) {
|
|
|
3215
3359
|
tools: [...POLAR_TOOLS],
|
|
3216
3360
|
oauth,
|
|
3217
3361
|
async onInit(_client) {
|
|
3218
|
-
|
|
3362
|
+
logger24.debug("Polar integration initialized");
|
|
3219
3363
|
},
|
|
3220
3364
|
async onAfterConnect(_client) {
|
|
3221
|
-
|
|
3365
|
+
logger24.debug("Polar integration connected");
|
|
3222
3366
|
}
|
|
3223
3367
|
};
|
|
3224
3368
|
}
|
|
3225
|
-
var POLAR_TOOLS;
|
|
3369
|
+
var logger24, POLAR_TOOLS;
|
|
3226
3370
|
var init_polar = __esm(() => {
|
|
3371
|
+
init_logger();
|
|
3372
|
+
logger24 = createLogger("Polar");
|
|
3227
3373
|
POLAR_TOOLS = [
|
|
3228
3374
|
"polar_list_products",
|
|
3229
3375
|
"polar_get_product",
|
|
@@ -3254,15 +3400,17 @@ function figmaIntegration(config = {}) {
|
|
|
3254
3400
|
tools: [...FIGMA_TOOLS],
|
|
3255
3401
|
oauth,
|
|
3256
3402
|
async onInit(_client) {
|
|
3257
|
-
|
|
3403
|
+
logger25.debug("Figma integration initialized");
|
|
3258
3404
|
},
|
|
3259
3405
|
async onAfterConnect(_client) {
|
|
3260
|
-
|
|
3406
|
+
logger25.debug("Figma integration connected");
|
|
3261
3407
|
}
|
|
3262
3408
|
};
|
|
3263
3409
|
}
|
|
3264
|
-
var FIGMA_TOOLS;
|
|
3410
|
+
var logger25, FIGMA_TOOLS;
|
|
3265
3411
|
var init_figma = __esm(() => {
|
|
3412
|
+
init_logger();
|
|
3413
|
+
logger25 = createLogger("Figma");
|
|
3266
3414
|
FIGMA_TOOLS = [
|
|
3267
3415
|
"figma_get_file",
|
|
3268
3416
|
"figma_get_file_nodes",
|
|
@@ -3293,15 +3441,17 @@ function intercomIntegration(config = {}) {
|
|
|
3293
3441
|
tools: [...INTERCOM_TOOLS],
|
|
3294
3442
|
oauth,
|
|
3295
3443
|
async onInit(_client) {
|
|
3296
|
-
|
|
3444
|
+
logger26.debug("Intercom integration initialized");
|
|
3297
3445
|
},
|
|
3298
3446
|
async onAfterConnect(_client) {
|
|
3299
|
-
|
|
3447
|
+
logger26.debug("Intercom integration connected");
|
|
3300
3448
|
}
|
|
3301
3449
|
};
|
|
3302
3450
|
}
|
|
3303
|
-
var INTERCOM_TOOLS;
|
|
3451
|
+
var logger26, INTERCOM_TOOLS;
|
|
3304
3452
|
var init_intercom = __esm(() => {
|
|
3453
|
+
init_logger();
|
|
3454
|
+
logger26 = createLogger("Intercom");
|
|
3305
3455
|
INTERCOM_TOOLS = [
|
|
3306
3456
|
"intercom_list_contacts",
|
|
3307
3457
|
"intercom_get_contact",
|
|
@@ -3340,15 +3490,17 @@ function hubspotIntegration(config = {}) {
|
|
|
3340
3490
|
tools: [...HUBSPOT_TOOLS],
|
|
3341
3491
|
oauth,
|
|
3342
3492
|
async onInit(_client) {
|
|
3343
|
-
|
|
3493
|
+
logger27.debug("HubSpot integration initialized");
|
|
3344
3494
|
},
|
|
3345
3495
|
async onAfterConnect(_client) {
|
|
3346
|
-
|
|
3496
|
+
logger27.debug("HubSpot integration connected");
|
|
3347
3497
|
}
|
|
3348
3498
|
};
|
|
3349
3499
|
}
|
|
3350
|
-
var HUBSPOT_TOOLS;
|
|
3500
|
+
var logger27, HUBSPOT_TOOLS;
|
|
3351
3501
|
var init_hubspot = __esm(() => {
|
|
3502
|
+
init_logger();
|
|
3503
|
+
logger27 = createLogger("HubSpot");
|
|
3352
3504
|
HUBSPOT_TOOLS = [
|
|
3353
3505
|
"hubspot_list_contacts",
|
|
3354
3506
|
"hubspot_get_contact",
|
|
@@ -3382,15 +3534,17 @@ function youtubeIntegration(config = {}) {
|
|
|
3382
3534
|
tools: [...YOUTUBE_TOOLS],
|
|
3383
3535
|
oauth,
|
|
3384
3536
|
async onInit(_client) {
|
|
3385
|
-
|
|
3537
|
+
logger28.debug("YouTube integration initialized");
|
|
3386
3538
|
},
|
|
3387
3539
|
async onAfterConnect(_client) {
|
|
3388
|
-
|
|
3540
|
+
logger28.debug("YouTube integration connected");
|
|
3389
3541
|
}
|
|
3390
3542
|
};
|
|
3391
3543
|
}
|
|
3392
|
-
var YOUTUBE_TOOLS;
|
|
3544
|
+
var logger28, YOUTUBE_TOOLS;
|
|
3393
3545
|
var init_youtube = __esm(() => {
|
|
3546
|
+
init_logger();
|
|
3547
|
+
logger28 = createLogger("YouTube");
|
|
3394
3548
|
YOUTUBE_TOOLS = [
|
|
3395
3549
|
"youtube_search",
|
|
3396
3550
|
"youtube_get_video",
|
|
@@ -3410,15 +3564,17 @@ function cursorIntegration(_config = {}) {
|
|
|
3410
3564
|
id: "cursor",
|
|
3411
3565
|
tools: [...CURSOR_TOOLS],
|
|
3412
3566
|
async onInit(_client) {
|
|
3413
|
-
|
|
3567
|
+
logger29.debug("Cursor integration initialized");
|
|
3414
3568
|
},
|
|
3415
3569
|
async onAfterConnect(_client) {
|
|
3416
|
-
|
|
3570
|
+
logger29.debug("Cursor integration connected");
|
|
3417
3571
|
}
|
|
3418
3572
|
};
|
|
3419
3573
|
}
|
|
3420
|
-
var CURSOR_TOOLS;
|
|
3574
|
+
var logger29, CURSOR_TOOLS;
|
|
3421
3575
|
var init_cursor = __esm(() => {
|
|
3576
|
+
init_logger();
|
|
3577
|
+
logger29 = createLogger("Cursor");
|
|
3422
3578
|
CURSOR_TOOLS = [
|
|
3423
3579
|
"cursor_list_agents",
|
|
3424
3580
|
"cursor_get_agent",
|
|
@@ -9266,6 +9422,7 @@ var init_zodToJsonSchema = __esm(() => {
|
|
|
9266
9422
|
|
|
9267
9423
|
// node_modules/zod-to-json-schema/dist/esm/index.js
|
|
9268
9424
|
var init_esm = __esm(() => {
|
|
9425
|
+
init_zodToJsonSchema();
|
|
9269
9426
|
init_Options();
|
|
9270
9427
|
init_Refs();
|
|
9271
9428
|
init_parseDef();
|
|
@@ -9297,7 +9454,6 @@ var init_esm = __esm(() => {
|
|
|
9297
9454
|
init_unknown();
|
|
9298
9455
|
init_selectParser();
|
|
9299
9456
|
init_zodToJsonSchema();
|
|
9300
|
-
init_zodToJsonSchema();
|
|
9301
9457
|
});
|
|
9302
9458
|
|
|
9303
9459
|
// src/ai/openai.ts
|
|
@@ -9782,6 +9938,7 @@ function getDefaultRedirectUri() {
|
|
|
9782
9938
|
return "http://localhost:3000/api/integrate/oauth/callback";
|
|
9783
9939
|
}
|
|
9784
9940
|
function createMCPServer(config) {
|
|
9941
|
+
setLogLevel(config.debug ? "debug" : "error");
|
|
9785
9942
|
if (typeof window !== "undefined") {
|
|
9786
9943
|
throw new Error("createMCPServer() should only be called on the server-side. " + "Use createMCPClient() for client-side code.");
|
|
9787
9944
|
}
|
|
@@ -9790,7 +9947,7 @@ function createMCPServer(config) {
|
|
|
9790
9947
|
if (integration.oauth) {
|
|
9791
9948
|
const { clientId, clientSecret, redirectUri: integrationRedirectUri, config: oauthConfig } = integration.oauth;
|
|
9792
9949
|
if (!clientId || !clientSecret) {
|
|
9793
|
-
|
|
9950
|
+
logger30.warn(`Warning: Integration "${integration.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the integration configuration.`);
|
|
9794
9951
|
return integration;
|
|
9795
9952
|
}
|
|
9796
9953
|
const redirectUri = integrationRedirectUri || config.redirectUri || getDefaultRedirectUri();
|
|
@@ -9903,7 +10060,7 @@ function createMCPServer(config) {
|
|
|
9903
10060
|
const body = await webRequest.json();
|
|
9904
10061
|
const authHeader = webRequest.headers.get("authorization");
|
|
9905
10062
|
const integrationsHeader = webRequest.headers.get("x-integrations");
|
|
9906
|
-
const { OAuthHandler: OAuthHandler2 } = await Promise.resolve().then(() => exports_base_handler);
|
|
10063
|
+
const { OAuthHandler: OAuthHandler2 } = await Promise.resolve().then(() => (init_base_handler(), exports_base_handler));
|
|
9907
10064
|
const oauthHandler = new OAuthHandler2({
|
|
9908
10065
|
providers,
|
|
9909
10066
|
serverUrl: config.serverUrl,
|
|
@@ -9919,7 +10076,7 @@ function createMCPServer(config) {
|
|
|
9919
10076
|
}
|
|
9920
10077
|
return response2;
|
|
9921
10078
|
} catch (error) {
|
|
9922
|
-
|
|
10079
|
+
logger30.error("[MCP Tool Call] Error:", error);
|
|
9923
10080
|
return Response.json({ error: error.message || "Failed to execute tool call" }, { status: error.statusCode || 500 });
|
|
9924
10081
|
}
|
|
9925
10082
|
}
|
|
@@ -9983,7 +10140,7 @@ function createMCPServer(config) {
|
|
|
9983
10140
|
})
|
|
9984
10141
|
});
|
|
9985
10142
|
} catch (scheduleError) {
|
|
9986
|
-
|
|
10143
|
+
logger30.error("[Trigger] Failed to register with scheduler:", scheduleError);
|
|
9987
10144
|
}
|
|
9988
10145
|
return Response.json(created, { status: 201 });
|
|
9989
10146
|
}
|
|
@@ -10018,7 +10175,7 @@ function createMCPServer(config) {
|
|
|
10018
10175
|
body: JSON.stringify({ triggerId })
|
|
10019
10176
|
});
|
|
10020
10177
|
} catch (error) {
|
|
10021
|
-
|
|
10178
|
+
logger30.error("[Trigger] Failed to pause in scheduler:", error);
|
|
10022
10179
|
}
|
|
10023
10180
|
return Response.json(updated);
|
|
10024
10181
|
} else if (subAction === "resume" && method === "POST") {
|
|
@@ -10046,7 +10203,7 @@ function createMCPServer(config) {
|
|
|
10046
10203
|
body: JSON.stringify({ triggerId })
|
|
10047
10204
|
});
|
|
10048
10205
|
} catch (error) {
|
|
10049
|
-
|
|
10206
|
+
logger30.error("[Trigger] Failed to resume in scheduler:", error);
|
|
10050
10207
|
}
|
|
10051
10208
|
return Response.json(updated);
|
|
10052
10209
|
} else if (subAction === "run" && method === "POST") {
|
|
@@ -10061,7 +10218,7 @@ function createMCPServer(config) {
|
|
|
10061
10218
|
if (!providerToken) {
|
|
10062
10219
|
return Response.json({ error: "No OAuth token available for this trigger" }, { status: 401 });
|
|
10063
10220
|
}
|
|
10064
|
-
const { OAuthHandler: OAuthHandler2 } = await Promise.resolve().then(() => exports_base_handler);
|
|
10221
|
+
const { OAuthHandler: OAuthHandler2 } = await Promise.resolve().then(() => (init_base_handler(), exports_base_handler));
|
|
10065
10222
|
const oauthHandler = new OAuthHandler2({
|
|
10066
10223
|
providers,
|
|
10067
10224
|
serverUrl: config.serverUrl,
|
|
@@ -10187,7 +10344,7 @@ function createMCPServer(config) {
|
|
|
10187
10344
|
})
|
|
10188
10345
|
});
|
|
10189
10346
|
} catch (error) {
|
|
10190
|
-
|
|
10347
|
+
logger30.error("[Trigger] Failed to update scheduler:", error);
|
|
10191
10348
|
}
|
|
10192
10349
|
}
|
|
10193
10350
|
return Response.json(updated);
|
|
@@ -10204,14 +10361,14 @@ function createMCPServer(config) {
|
|
|
10204
10361
|
body: JSON.stringify({ triggerId })
|
|
10205
10362
|
});
|
|
10206
10363
|
} catch (error) {
|
|
10207
|
-
|
|
10364
|
+
logger30.error("[Trigger] Failed to unregister from scheduler:", error);
|
|
10208
10365
|
}
|
|
10209
10366
|
return new Response(null, { status: 204 });
|
|
10210
10367
|
}
|
|
10211
10368
|
}
|
|
10212
10369
|
return Response.json({ error: "Invalid trigger route or method" }, { status: 404 });
|
|
10213
10370
|
} catch (error) {
|
|
10214
|
-
|
|
10371
|
+
logger30.error("[Trigger] Error:", error);
|
|
10215
10372
|
return Response.json({ error: error.message || "Failed to process trigger request" }, { status: error.statusCode || 500 });
|
|
10216
10373
|
}
|
|
10217
10374
|
}
|
|
@@ -10237,11 +10394,11 @@ function createMCPServer(config) {
|
|
|
10237
10394
|
const errorRedirectUrl = "/auth-error";
|
|
10238
10395
|
if (error) {
|
|
10239
10396
|
const errorMsg = errorDescription || error;
|
|
10240
|
-
|
|
10397
|
+
logger30.error("[OAuth Redirect] Error:", errorMsg);
|
|
10241
10398
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(errorMsg)}`, webRequest.url));
|
|
10242
10399
|
}
|
|
10243
10400
|
if (!code || !state) {
|
|
10244
|
-
|
|
10401
|
+
logger30.error("[OAuth Redirect] Missing code or state parameter");
|
|
10245
10402
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent("Invalid OAuth callback")}`, webRequest.url));
|
|
10246
10403
|
}
|
|
10247
10404
|
let returnUrl = defaultRedirectUrl;
|
|
@@ -10273,7 +10430,7 @@ function createMCPServer(config) {
|
|
|
10273
10430
|
if (codeVerifierEntry) {
|
|
10274
10431
|
try {
|
|
10275
10432
|
const { codeVerifier, provider, frontendOrigin: storedFrontendOrigin } = codeVerifierEntry;
|
|
10276
|
-
const { OAuthHandler: OAuthHandler2 } = await Promise.resolve().then(() => exports_base_handler);
|
|
10433
|
+
const { OAuthHandler: OAuthHandler2 } = await Promise.resolve().then(() => (init_base_handler(), exports_base_handler));
|
|
10277
10434
|
const oauthHandler = new OAuthHandler2({
|
|
10278
10435
|
providers,
|
|
10279
10436
|
serverUrl: config.serverUrl,
|
|
@@ -10317,7 +10474,7 @@ function createMCPServer(config) {
|
|
|
10317
10474
|
frontendUrl.hash = `oauth_callback=${encodeURIComponent(JSON.stringify({ code, state, tokenData }))}`;
|
|
10318
10475
|
return Response.redirect(frontendUrl);
|
|
10319
10476
|
} catch (error2) {
|
|
10320
|
-
|
|
10477
|
+
logger30.error("[OAuth Backend Callback] Error:", error2);
|
|
10321
10478
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(error2.message || "Failed to exchange token")}`, webRequest.url));
|
|
10322
10479
|
}
|
|
10323
10480
|
} else {
|
|
@@ -10536,7 +10693,7 @@ function toSvelteKitHandler(clientOrHandlerOrOptions, _redirectOptions) {
|
|
|
10536
10693
|
}
|
|
10537
10694
|
};
|
|
10538
10695
|
}
|
|
10539
|
-
var globalServerConfig = null, codeVerifierStorage, POST = async (req, context) => {
|
|
10696
|
+
var logger30, globalServerConfig = null, codeVerifierStorage, POST = async (req, context) => {
|
|
10540
10697
|
if (!globalServerConfig) {
|
|
10541
10698
|
return Response.json({ error: "OAuth not configured. Call createMCPServer() in your server initialization file first." }, { status: 500 });
|
|
10542
10699
|
}
|
|
@@ -10554,6 +10711,7 @@ var globalServerConfig = null, codeVerifierStorage, POST = async (req, context)
|
|
|
10554
10711
|
var init_server = __esm(() => {
|
|
10555
10712
|
init_client();
|
|
10556
10713
|
init_nextjs();
|
|
10714
|
+
init_logger();
|
|
10557
10715
|
init_github();
|
|
10558
10716
|
init_gmail();
|
|
10559
10717
|
init_notion();
|
|
@@ -10583,6 +10741,7 @@ var init_server = __esm(() => {
|
|
|
10583
10741
|
init_anthropic();
|
|
10584
10742
|
init_google();
|
|
10585
10743
|
init_ai();
|
|
10744
|
+
logger30 = createLogger("MCPServer");
|
|
10586
10745
|
codeVerifierStorage = new Map;
|
|
10587
10746
|
});
|
|
10588
10747
|
|
|
@@ -11081,11 +11240,11 @@ class OAuthHandler {
|
|
|
11081
11240
|
try {
|
|
11082
11241
|
await this.config.removeProviderToken(request.provider, undefined, context);
|
|
11083
11242
|
} catch (error) {
|
|
11084
|
-
|
|
11243
|
+
logger31.error(`Failed to delete token for ${request.provider} from database via removeProviderToken:`, error);
|
|
11085
11244
|
}
|
|
11086
11245
|
}
|
|
11087
11246
|
} catch (error) {
|
|
11088
|
-
|
|
11247
|
+
logger31.error(`Failed to extract context for disconnect:`, error);
|
|
11089
11248
|
}
|
|
11090
11249
|
}
|
|
11091
11250
|
const url = new URL("/oauth/disconnect", this.serverUrl);
|
|
@@ -11145,9 +11304,16 @@ class OAuthHandler {
|
|
|
11145
11304
|
return jsonRpcResponse.result;
|
|
11146
11305
|
}
|
|
11147
11306
|
}
|
|
11148
|
-
var MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
|
|
11307
|
+
var logger31, MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
|
|
11308
|
+
var init_base_handler = __esm(() => {
|
|
11309
|
+
init_logger();
|
|
11310
|
+
logger31 = createLogger("OAuthHandler");
|
|
11311
|
+
});
|
|
11149
11312
|
|
|
11150
11313
|
// src/adapters/auto-routes.ts
|
|
11314
|
+
init_base_handler();
|
|
11315
|
+
init_logger();
|
|
11316
|
+
var logger32 = createLogger("AutoRoutes");
|
|
11151
11317
|
var globalOAuthConfig = null;
|
|
11152
11318
|
async function POST2(req, context) {
|
|
11153
11319
|
if (!globalOAuthConfig) {
|
|
@@ -11189,7 +11355,7 @@ async function POST2(req, context) {
|
|
|
11189
11355
|
}
|
|
11190
11356
|
return createErrorResponse(`Unknown action: ${action}`, 404);
|
|
11191
11357
|
} catch (error) {
|
|
11192
|
-
|
|
11358
|
+
logger32.error(`[OAuth ${action}] Error:`, error);
|
|
11193
11359
|
return createErrorResponse(error.message, 500);
|
|
11194
11360
|
}
|
|
11195
11361
|
}
|
|
@@ -11217,7 +11383,7 @@ async function GET2(req, context) {
|
|
|
11217
11383
|
}
|
|
11218
11384
|
return createErrorResponse(`Unknown action: ${action}`, 404);
|
|
11219
11385
|
} catch (error) {
|
|
11220
|
-
|
|
11386
|
+
logger32.error(`[OAuth ${action}] Error:`, error);
|
|
11221
11387
|
return createErrorResponse(error.message, 500);
|
|
11222
11388
|
}
|
|
11223
11389
|
}
|