integrate-sdk 0.5.6 → 0.5.8

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 CHANGED
@@ -26,44 +26,58 @@ npm install integrate-sdk
26
26
  bun add integrate-sdk
27
27
  ```
28
28
 
29
- ## Quick Start
29
+ ## Quick Start (2 Files Only!)
30
30
 
31
- ### Server-Side Setup
31
+ ### 1. Create Server Config
32
32
 
33
- First, create your server configuration with OAuth secrets:
33
+ Define your OAuth providers once:
34
34
 
35
35
  ```typescript
36
36
  // lib/integrate-server.ts (server-side only!)
37
- import { createMCPServer, githubPlugin, gmailPlugin } from 'integrate-sdk/server';
37
+ import {
38
+ createMCPServer,
39
+ githubPlugin,
40
+ gmailPlugin,
41
+ } from "integrate-sdk/server";
38
42
 
39
- export const { client: serverClient, handlers } = createMCPServer({
43
+ export const { client: serverClient } = createMCPServer({
40
44
  plugins: [
41
45
  githubPlugin({
42
46
  clientId: process.env.GITHUB_CLIENT_ID,
43
47
  clientSecret: process.env.GITHUB_CLIENT_SECRET,
44
- scopes: ['repo', 'user'],
48
+ scopes: ["repo", "user"],
45
49
  }),
46
50
  gmailPlugin({
47
51
  clientId: process.env.GMAIL_CLIENT_ID,
48
52
  clientSecret: process.env.GMAIL_CLIENT_SECRET,
49
- scopes: ['gmail.readonly'],
53
+ scopes: ["gmail.readonly"],
50
54
  }),
51
55
  ],
52
56
  });
53
57
  ```
54
58
 
55
- Create OAuth route (handles authorization automatically):
59
+ ### 2. Create Single Catch-All Route
60
+
61
+ That's it! Just import and export:
56
62
 
57
63
  ```typescript
58
- // app/api/integrate/oauth/[action]/route.ts
59
- export * from 'integrate-sdk/oauth';
64
+ // app/api/integrate/[...all]/route.ts
65
+ import { toNextJsHandler } from "integrate-sdk/server";
66
+
67
+ export const { POST, GET } = toNextJsHandler({
68
+ redirectUrl: "/dashboard",
69
+ });
60
70
  ```
61
71
 
72
+ This automatically uses your config from step 1 and handles ALL OAuth operations (authorize, callback, status, disconnect) in one file!
73
+
74
+ ### 3. Use in Your App
75
+
62
76
  Use the server client in API routes or server components:
63
77
 
64
78
  ```typescript
65
79
  // app/api/repos/route.ts
66
- import { serverClient } from '@/lib/integrate-server';
80
+ import { serverClient } from "@/lib/integrate-server";
67
81
 
68
82
  export async function GET() {
69
83
  // Automatically connects on first call - no manual setup needed!
@@ -77,34 +91,35 @@ export async function GET() {
77
91
  Use in your client components (no secrets needed):
78
92
 
79
93
  ```typescript
80
- 'use client';
81
- import { createMCPClient, githubPlugin } from 'integrate-sdk';
94
+ "use client";
95
+ import { createMCPClient, githubPlugin } from "integrate-sdk";
82
96
 
83
97
  const client = createMCPClient({
84
98
  plugins: [
85
99
  githubPlugin({
86
- scopes: ['repo', 'user'],
100
+ scopes: ["repo", "user"],
87
101
  // No clientId or clientSecret needed!
88
102
  }),
89
103
  ],
90
- oauthFlow: { mode: 'popup' },
104
+ oauthFlow: { mode: "popup" },
91
105
  });
92
106
 
93
107
  // Authorize user (opens popup)
94
- await client.authorize('github');
108
+ await client.authorize("github");
95
109
 
96
110
  // Use the client - automatically connects!
97
111
  const result = await client.github.createIssue({
98
- owner: 'owner',
99
- repo: 'repo',
100
- title: 'Bug report',
101
- body: 'Description of the bug',
112
+ owner: "owner",
113
+ repo: "repo",
114
+ title: "Bug report",
115
+ body: "Description of the bug",
102
116
  });
103
117
 
104
- console.log('Issue created:', result);
118
+ console.log("Issue created:", result);
105
119
  ```
106
120
 
107
121
  **That's it!** The SDK automatically:
122
+
108
123
  - ✅ Connects on first method call (no manual `connect()` needed)
109
124
  - ✅ Cleans up on exit (no manual `disconnect()` needed)
110
125
  - ✅ Manages OAuth tokens securely through your API routes
@@ -115,6 +130,7 @@ console.log('Issue created:', result);
115
130
  The SDK automatically manages connections for you - no manual `connect()` or `disconnect()` calls needed!
116
131
 
117
132
  **Features:**
133
+
118
134
  - **Lazy Connection**: Automatically connects on first method call
119
135
  - **Auto-Cleanup**: Cleans up on process exit
120
136
  - **Singleton Pattern**: Reuses connections efficiently (configurable)
@@ -124,25 +140,25 @@ The SDK automatically manages connections for you - no manual `connect()` or `di
124
140
  const client = createMCPClient({
125
141
  plugins: [
126
142
  githubPlugin({
127
- scopes: ['repo', 'user'],
143
+ scopes: ["repo", "user"],
128
144
  }),
129
145
  ],
130
146
  });
131
147
 
132
148
  // Use immediately - no connect() needed!
133
- await client.authorize('github');
134
- await client.github.listRepos({ username: 'octocat' });
149
+ await client.authorize("github");
150
+ await client.github.listRepos({ username: "octocat" });
135
151
 
136
152
  // ✅ Want manual control? Use manual mode
137
153
  const manualClient = createMCPClient({
138
- plugins: [githubPlugin({ scopes: ['repo'] })],
139
- connectionMode: 'manual',
154
+ plugins: [githubPlugin({ scopes: ["repo"] })],
155
+ connectionMode: "manual",
140
156
  singleton: false,
141
157
  });
142
158
 
143
159
  await manualClient.connect();
144
- await manualClient.authorize('github');
145
- await manualClient.github.listRepos({ username: 'octocat' });
160
+ await manualClient.authorize("github");
161
+ await manualClient.github.listRepos({ username: "octocat" });
146
162
  await manualClient.disconnect();
147
163
  ```
148
164
 
@@ -165,7 +181,11 @@ Instead of generic tool calls, use typed methods with full autocomplete:
165
181
 
166
182
  ```typescript
167
183
  // ✅ New: Typed methods with autocomplete
168
- await client.github.createIssue({ owner: "user", repo: "project", title: "Bug" });
184
+ await client.github.createIssue({
185
+ owner: "user",
186
+ repo: "project",
187
+ title: "Bug",
188
+ });
169
189
  await client.gmail.sendEmail({ to: "user@example.com", subject: "Hello" });
170
190
  ```
171
191
 
@@ -180,14 +200,21 @@ await client.gmail.sendEmail({ to: "user@example.com", subject: "Hello" });
180
200
 
181
201
  ```typescript
182
202
  // 1. Typed plugin methods (recommended for built-in plugins like GitHub/Gmail)
183
- await client.github.createIssue({ owner: "user", repo: "project", title: "Bug" });
203
+ await client.github.createIssue({
204
+ owner: "user",
205
+ repo: "project",
206
+ title: "Bug",
207
+ });
184
208
  await client.gmail.sendEmail({ to: "user@example.com", subject: "Hello" });
185
209
 
186
210
  // 2. Typed server methods (for server-level tools)
187
211
  await client.server.listToolsByIntegration({ integration: "github" });
188
212
 
189
213
  // 3. Direct tool calls (for other server-supported integrations)
190
- await client._callToolByName("slack_send_message", { channel: "#general", text: "Hello" });
214
+ await client._callToolByName("slack_send_message", {
215
+ channel: "#general",
216
+ text: "Hello",
217
+ });
191
218
  ```
192
219
 
193
220
  ## OAuth Authorization
@@ -195,16 +222,18 @@ await client._callToolByName("slack_send_message", { channel: "#general", text:
195
222
  The SDK implements OAuth 2.0 Authorization Code Flow with PKCE for secure authorization.
196
223
 
197
224
  **Key Features:**
225
+
198
226
  - ✅ Popup or redirect flow modes
199
227
  - ✅ Session token management
200
228
  - ✅ Multiple provider support
201
229
  - ✅ PKCE security
202
230
 
203
231
  **Basic Usage:**
232
+
204
233
  ```typescript
205
234
  // Check authorization
206
- if (!await client.isAuthorized('github')) {
207
- await client.authorize('github'); // Opens popup or redirects
235
+ if (!(await client.isAuthorized("github"))) {
236
+ await client.authorize("github"); // Opens popup or redirects
208
237
  }
209
238
 
210
239
  // Use authorized client
@@ -212,6 +241,7 @@ const repos = await client.github.listOwnRepos({});
212
241
  ```
213
242
 
214
243
  For complete OAuth setup including:
244
+
215
245
  - Popup vs redirect flows
216
246
  - Session token management
217
247
  - Multiple providers
@@ -227,9 +257,13 @@ Access GitHub repositories, issues, pull requests, and more with type-safe metho
227
257
 
228
258
  ```typescript
229
259
  // Available methods
230
- await client.github.getRepo({ owner: 'facebook', repo: 'react' });
231
- await client.github.createIssue({ owner: 'user', repo: 'repo', title: 'Bug' });
232
- await client.github.listPullRequests({ owner: 'user', repo: 'repo', state: 'open' });
260
+ await client.github.getRepo({ owner: "facebook", repo: "react" });
261
+ await client.github.createIssue({ owner: "user", repo: "repo", title: "Bug" });
262
+ await client.github.listPullRequests({
263
+ owner: "user",
264
+ repo: "repo",
265
+ state: "open",
266
+ });
233
267
  await client.github.listOwnRepos({});
234
268
  ```
235
269
 
@@ -241,9 +275,13 @@ Send emails, manage labels, and search messages with type-safe methods.
241
275
 
242
276
  ```typescript
243
277
  // Available methods
244
- await client.gmail.sendEmail({ to: 'user@example.com', subject: 'Hello', body: 'Hi!' });
245
- await client.gmail.listEmails({ maxResults: 10, q: 'is:unread' });
246
- await client.gmail.searchEmails({ query: 'from:notifications@github.com' });
278
+ await client.gmail.sendEmail({
279
+ to: "user@example.com",
280
+ subject: "Hello",
281
+ body: "Hi!",
282
+ });
283
+ await client.gmail.listEmails({ maxResults: 10, q: "is:unread" });
284
+ await client.gmail.searchEmails({ query: "from:notifications@github.com" });
247
285
  ```
248
286
 
249
287
  [→ Gmail plugin documentation](https://integrate.dev/docs/plugins/gmail)
@@ -253,15 +291,15 @@ await client.gmail.searchEmails({ query: 'from:notifications@github.com' });
253
291
  Use `genericOAuthPlugin` to configure any server-supported integration:
254
292
 
255
293
  ```typescript
256
- import { genericOAuthPlugin } from 'integrate-sdk/server';
294
+ import { genericOAuthPlugin } from "integrate-sdk/server";
257
295
 
258
296
  const slackPlugin = genericOAuthPlugin({
259
- id: 'slack',
260
- provider: 'slack',
297
+ id: "slack",
298
+ provider: "slack",
261
299
  clientId: process.env.SLACK_CLIENT_ID,
262
300
  clientSecret: process.env.SLACK_CLIENT_SECRET,
263
- scopes: ['chat:write', 'channels:read'],
264
- tools: ['slack_send_message', 'slack_list_channels'],
301
+ scopes: ["chat:write", "channels:read"],
302
+ tools: ["slack_send_message", "slack_list_channels"],
265
303
  });
266
304
  ```
267
305
 
package/dist/index.js CHANGED
@@ -148,6 +148,102 @@ var init_errors = __esm(() => {
148
148
  };
149
149
  });
150
150
 
151
+ // src/oauth/pkce.ts
152
+ var exports_pkce = {};
153
+ __export(exports_pkce, {
154
+ parseState: () => parseState,
155
+ generateStateWithReturnUrl: () => generateStateWithReturnUrl,
156
+ generateState: () => generateState,
157
+ generateCodeVerifier: () => generateCodeVerifier,
158
+ generateCodeChallenge: () => generateCodeChallenge
159
+ });
160
+ function generateCodeVerifier() {
161
+ const array = new Uint8Array(32);
162
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
163
+ crypto.getRandomValues(array);
164
+ } else if (typeof globalThis !== "undefined" && globalThis.crypto) {
165
+ globalThis.crypto.getRandomValues(array);
166
+ } else {
167
+ throw new Error("crypto.getRandomValues is not available. Please use Node.js 19+ or a modern browser.");
168
+ }
169
+ return base64UrlEncode(array);
170
+ }
171
+ async function generateCodeChallenge(verifier) {
172
+ const encoder = new TextEncoder;
173
+ const data = encoder.encode(verifier);
174
+ let hashBuffer;
175
+ if (typeof crypto !== "undefined" && crypto.subtle) {
176
+ hashBuffer = await crypto.subtle.digest("SHA-256", data);
177
+ } else if (typeof globalThis !== "undefined" && globalThis.crypto?.subtle) {
178
+ hashBuffer = await globalThis.crypto.subtle.digest("SHA-256", data);
179
+ } else {
180
+ throw new Error("crypto.subtle.digest is not available. Please use Node.js 19+ or a modern browser.");
181
+ }
182
+ return base64UrlEncode(new Uint8Array(hashBuffer));
183
+ }
184
+ function generateState() {
185
+ const array = new Uint8Array(16);
186
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
187
+ crypto.getRandomValues(array);
188
+ } else if (typeof globalThis !== "undefined" && globalThis.crypto) {
189
+ globalThis.crypto.getRandomValues(array);
190
+ } else {
191
+ throw new Error("crypto.getRandomValues is not available. Please use Node.js 19+ or a modern browser.");
192
+ }
193
+ return base64UrlEncode(array);
194
+ }
195
+ function generateStateWithReturnUrl(returnUrl) {
196
+ const csrf = generateState();
197
+ const stateData = returnUrl ? { csrf, returnUrl } : { csrf };
198
+ const encoder = new TextEncoder;
199
+ const jsonBytes = encoder.encode(JSON.stringify(stateData));
200
+ return base64UrlEncode(jsonBytes);
201
+ }
202
+ function parseState(state) {
203
+ try {
204
+ const decoded = base64UrlDecode(state);
205
+ const parsed = JSON.parse(decoded);
206
+ if (typeof parsed === "string") {
207
+ return { csrf: parsed };
208
+ } else if (parsed && typeof parsed === "object") {
209
+ return {
210
+ csrf: parsed.csrf || state,
211
+ returnUrl: parsed.returnUrl
212
+ };
213
+ }
214
+ return { csrf: state };
215
+ } catch {
216
+ return { csrf: state };
217
+ }
218
+ }
219
+ function base64UrlEncode(array) {
220
+ let base64 = "";
221
+ if (typeof Buffer !== "undefined") {
222
+ base64 = Buffer.from(array).toString("base64");
223
+ } else {
224
+ const binary = String.fromCharCode(...array);
225
+ base64 = btoa(binary);
226
+ }
227
+ return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
228
+ }
229
+ function base64UrlDecode(str) {
230
+ let base64 = str.replace(/-/g, "+").replace(/_/g, "/");
231
+ while (base64.length % 4 !== 0) {
232
+ base64 += "=";
233
+ }
234
+ if (typeof Buffer !== "undefined") {
235
+ return Buffer.from(base64, "base64").toString("utf-8");
236
+ } else {
237
+ const binary = atob(base64);
238
+ const bytes = new Uint8Array(binary.length);
239
+ for (let i = 0;i < binary.length; i++) {
240
+ bytes[i] = binary.charCodeAt(i);
241
+ }
242
+ const decoder = new TextDecoder;
243
+ return decoder.decode(bytes);
244
+ }
245
+ }
246
+
151
247
  // src/protocol/jsonrpc.ts
152
248
  function parseMessage(message) {
153
249
  try {
@@ -369,95 +465,6 @@ function methodToToolName(methodName, pluginId) {
369
465
  const snakeCaseMethod = camelToSnake(methodName);
370
466
  return `${pluginId}_${snakeCaseMethod}`;
371
467
  }
372
-
373
- // src/oauth/pkce.ts
374
- function generateCodeVerifier() {
375
- const array = new Uint8Array(32);
376
- if (typeof crypto !== "undefined" && crypto.getRandomValues) {
377
- crypto.getRandomValues(array);
378
- } else if (typeof globalThis !== "undefined" && globalThis.crypto) {
379
- globalThis.crypto.getRandomValues(array);
380
- } else {
381
- throw new Error("crypto.getRandomValues is not available. Please use Node.js 19+ or a modern browser.");
382
- }
383
- return base64UrlEncode(array);
384
- }
385
- async function generateCodeChallenge(verifier) {
386
- const encoder = new TextEncoder;
387
- const data = encoder.encode(verifier);
388
- let hashBuffer;
389
- if (typeof crypto !== "undefined" && crypto.subtle) {
390
- hashBuffer = await crypto.subtle.digest("SHA-256", data);
391
- } else if (typeof globalThis !== "undefined" && globalThis.crypto?.subtle) {
392
- hashBuffer = await globalThis.crypto.subtle.digest("SHA-256", data);
393
- } else {
394
- throw new Error("crypto.subtle.digest is not available. Please use Node.js 19+ or a modern browser.");
395
- }
396
- return base64UrlEncode(new Uint8Array(hashBuffer));
397
- }
398
- function generateState() {
399
- const array = new Uint8Array(16);
400
- if (typeof crypto !== "undefined" && crypto.getRandomValues) {
401
- crypto.getRandomValues(array);
402
- } else if (typeof globalThis !== "undefined" && globalThis.crypto) {
403
- globalThis.crypto.getRandomValues(array);
404
- } else {
405
- throw new Error("crypto.getRandomValues is not available. Please use Node.js 19+ or a modern browser.");
406
- }
407
- return base64UrlEncode(array);
408
- }
409
- function generateStateWithReturnUrl(returnUrl) {
410
- const csrf = generateState();
411
- const stateData = returnUrl ? { csrf, returnUrl } : { csrf };
412
- const encoder = new TextEncoder;
413
- const jsonBytes = encoder.encode(JSON.stringify(stateData));
414
- return base64UrlEncode(jsonBytes);
415
- }
416
- function parseState(state) {
417
- try {
418
- const decoded = base64UrlDecode(state);
419
- const parsed = JSON.parse(decoded);
420
- if (typeof parsed === "string") {
421
- return { csrf: parsed };
422
- } else if (parsed && typeof parsed === "object") {
423
- return {
424
- csrf: parsed.csrf || state,
425
- returnUrl: parsed.returnUrl
426
- };
427
- }
428
- return { csrf: state };
429
- } catch {
430
- return { csrf: state };
431
- }
432
- }
433
- function base64UrlEncode(array) {
434
- let base64 = "";
435
- if (typeof Buffer !== "undefined") {
436
- base64 = Buffer.from(array).toString("base64");
437
- } else {
438
- const binary = String.fromCharCode(...array);
439
- base64 = btoa(binary);
440
- }
441
- return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
442
- }
443
- function base64UrlDecode(str) {
444
- let base64 = str.replace(/-/g, "+").replace(/_/g, "/");
445
- while (base64.length % 4 !== 0) {
446
- base64 += "=";
447
- }
448
- if (typeof Buffer !== "undefined") {
449
- return Buffer.from(base64, "base64").toString("utf-8");
450
- } else {
451
- const binary = atob(base64);
452
- const bytes = new Uint8Array(binary.length);
453
- for (let i = 0;i < binary.length; i++) {
454
- bytes[i] = binary.charCodeAt(i);
455
- }
456
- const decoder = new TextDecoder;
457
- return decoder.decode(bytes);
458
- }
459
- }
460
-
461
468
  // src/oauth/window-manager.ts
462
469
  function isBrowser() {
463
470
  return typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -1016,7 +1023,20 @@ class MCPClient {
1016
1023
  headers: config.headers,
1017
1024
  timeout: config.timeout
1018
1025
  });
1019
- this.plugins = config.plugins;
1026
+ const oauthApiBase = config.oauthApiBase || "/api/integrate/oauth";
1027
+ const defaultRedirectUri = this.getDefaultRedirectUri(oauthApiBase);
1028
+ this.plugins = config.plugins.map((plugin) => {
1029
+ if (plugin.oauth && !plugin.oauth.redirectUri) {
1030
+ return {
1031
+ ...plugin,
1032
+ oauth: {
1033
+ ...plugin.oauth,
1034
+ redirectUri: defaultRedirectUri
1035
+ }
1036
+ };
1037
+ }
1038
+ return plugin;
1039
+ });
1020
1040
  this.clientInfo = config.clientInfo || {
1021
1041
  name: "integrate-sdk",
1022
1042
  version: "0.1.0"
@@ -1024,7 +1044,7 @@ class MCPClient {
1024
1044
  this.onReauthRequired = config.onReauthRequired;
1025
1045
  this.maxReauthRetries = config.maxReauthRetries ?? 1;
1026
1046
  this.connectionMode = config.connectionMode ?? "lazy";
1027
- this.oauthManager = new OAuthManager(config.oauthApiBase || "/api/integrate/oauth", config.oauthFlow);
1047
+ this.oauthManager = new OAuthManager(oauthApiBase, config.oauthFlow);
1028
1048
  const providers = this.plugins.filter((p) => p.oauth).map((p) => p.oauth.provider);
1029
1049
  this.oauthManager.loadAllProviderTokens(providers);
1030
1050
  for (const plugin of this.plugins) {
@@ -1041,6 +1061,14 @@ class MCPClient {
1041
1061
  this.server = this.createServerProxy();
1042
1062
  this.initializePlugins();
1043
1063
  }
1064
+ getDefaultRedirectUri(oauthApiBase) {
1065
+ if (typeof window === "undefined" || !window.location) {
1066
+ return "http://localhost:3000/oauth/callback";
1067
+ }
1068
+ const origin = window.location.origin;
1069
+ const normalizedPath = oauthApiBase.replace(/\/$/, "");
1070
+ return `${origin}${normalizedPath}/callback`;
1071
+ }
1044
1072
  async ensureConnected() {
1045
1073
  if (this.initialized && this.transport.isConnected()) {
1046
1074
  return;
@@ -1726,6 +1754,80 @@ function createNextOAuthHandler(config) {
1726
1754
  return Response.json({ error: `Unknown action: ${action}` }, { status: 404 });
1727
1755
  }
1728
1756
  };
1757
+ },
1758
+ toNextJsHandler(redirectConfig) {
1759
+ const defaultRedirectUrl = redirectConfig?.redirectUrl || "/";
1760
+ const errorRedirectUrl = redirectConfig?.errorRedirectUrl || "/auth-error";
1761
+ return {
1762
+ async POST(req, context) {
1763
+ const params = context.params instanceof Promise ? await context.params : context.params;
1764
+ const segments = params.all || [];
1765
+ if (segments.length === 2 && segments[0] === "oauth") {
1766
+ const action = segments[1];
1767
+ if (action === "authorize") {
1768
+ return handlers.authorize(req);
1769
+ }
1770
+ if (action === "callback") {
1771
+ return handlers.callback(req);
1772
+ }
1773
+ if (action === "disconnect") {
1774
+ return handlers.disconnect(req);
1775
+ }
1776
+ return Response.json({ error: `Unknown action: ${action}` }, { status: 404 });
1777
+ }
1778
+ return Response.json({ error: `Invalid route: /${segments.join("/")}` }, { status: 404 });
1779
+ },
1780
+ async GET(req, context) {
1781
+ const params = context.params instanceof Promise ? await context.params : context.params;
1782
+ const segments = params.all || [];
1783
+ if (segments.length === 2 && segments[0] === "oauth") {
1784
+ const action = segments[1];
1785
+ if (action === "status") {
1786
+ return handlers.status(req);
1787
+ }
1788
+ if (action === "callback") {
1789
+ const { searchParams } = new URL(req.url);
1790
+ const code = searchParams.get("code");
1791
+ const state = searchParams.get("state");
1792
+ const error = searchParams.get("error");
1793
+ const errorDescription = searchParams.get("error_description");
1794
+ if (error) {
1795
+ const errorMsg = errorDescription || error;
1796
+ console.error("[OAuth Redirect] Error:", errorMsg);
1797
+ return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(errorMsg)}`, req.url));
1798
+ }
1799
+ if (!code || !state) {
1800
+ console.error("[OAuth Redirect] Missing code or state parameter");
1801
+ return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent("Invalid OAuth callback")}`, req.url));
1802
+ }
1803
+ let returnUrl = defaultRedirectUrl;
1804
+ try {
1805
+ const { parseState: parseState2 } = await Promise.resolve().then(() => exports_pkce);
1806
+ const stateData = parseState2(state);
1807
+ if (stateData.returnUrl) {
1808
+ returnUrl = stateData.returnUrl;
1809
+ }
1810
+ } catch (e) {
1811
+ try {
1812
+ const referrer = req.headers?.get?.("referer") || req.headers?.get?.("referrer");
1813
+ if (referrer) {
1814
+ const referrerUrl = new URL(referrer);
1815
+ const currentUrl = new URL(req.url);
1816
+ if (referrerUrl.origin === currentUrl.origin) {
1817
+ returnUrl = referrerUrl.pathname + referrerUrl.search;
1818
+ }
1819
+ }
1820
+ } catch {}
1821
+ }
1822
+ const targetUrl = new URL(returnUrl, req.url);
1823
+ targetUrl.hash = `oauth_callback=${encodeURIComponent(JSON.stringify({ code, state }))}`;
1824
+ return Response.redirect(targetUrl);
1825
+ }
1826
+ return Response.json({ error: `Unknown action: ${action}` }, { status: 404 });
1827
+ }
1828
+ return Response.json({ error: `Invalid route: /${segments.join("/")}` }, { status: 404 });
1829
+ }
1830
+ };
1729
1831
  }
1730
1832
  };
1731
1833
  return handlers;
package/dist/server.js CHANGED
@@ -148,6 +148,102 @@ var init_errors = __esm(() => {
148
148
  };
149
149
  });
150
150
 
151
+ // src/oauth/pkce.ts
152
+ var exports_pkce = {};
153
+ __export(exports_pkce, {
154
+ parseState: () => parseState,
155
+ generateStateWithReturnUrl: () => generateStateWithReturnUrl,
156
+ generateState: () => generateState,
157
+ generateCodeVerifier: () => generateCodeVerifier,
158
+ generateCodeChallenge: () => generateCodeChallenge
159
+ });
160
+ function generateCodeVerifier() {
161
+ const array = new Uint8Array(32);
162
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
163
+ crypto.getRandomValues(array);
164
+ } else if (typeof globalThis !== "undefined" && globalThis.crypto) {
165
+ globalThis.crypto.getRandomValues(array);
166
+ } else {
167
+ throw new Error("crypto.getRandomValues is not available. Please use Node.js 19+ or a modern browser.");
168
+ }
169
+ return base64UrlEncode(array);
170
+ }
171
+ async function generateCodeChallenge(verifier) {
172
+ const encoder = new TextEncoder;
173
+ const data = encoder.encode(verifier);
174
+ let hashBuffer;
175
+ if (typeof crypto !== "undefined" && crypto.subtle) {
176
+ hashBuffer = await crypto.subtle.digest("SHA-256", data);
177
+ } else if (typeof globalThis !== "undefined" && globalThis.crypto?.subtle) {
178
+ hashBuffer = await globalThis.crypto.subtle.digest("SHA-256", data);
179
+ } else {
180
+ throw new Error("crypto.subtle.digest is not available. Please use Node.js 19+ or a modern browser.");
181
+ }
182
+ return base64UrlEncode(new Uint8Array(hashBuffer));
183
+ }
184
+ function generateState() {
185
+ const array = new Uint8Array(16);
186
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
187
+ crypto.getRandomValues(array);
188
+ } else if (typeof globalThis !== "undefined" && globalThis.crypto) {
189
+ globalThis.crypto.getRandomValues(array);
190
+ } else {
191
+ throw new Error("crypto.getRandomValues is not available. Please use Node.js 19+ or a modern browser.");
192
+ }
193
+ return base64UrlEncode(array);
194
+ }
195
+ function generateStateWithReturnUrl(returnUrl) {
196
+ const csrf = generateState();
197
+ const stateData = returnUrl ? { csrf, returnUrl } : { csrf };
198
+ const encoder = new TextEncoder;
199
+ const jsonBytes = encoder.encode(JSON.stringify(stateData));
200
+ return base64UrlEncode(jsonBytes);
201
+ }
202
+ function parseState(state) {
203
+ try {
204
+ const decoded = base64UrlDecode(state);
205
+ const parsed = JSON.parse(decoded);
206
+ if (typeof parsed === "string") {
207
+ return { csrf: parsed };
208
+ } else if (parsed && typeof parsed === "object") {
209
+ return {
210
+ csrf: parsed.csrf || state,
211
+ returnUrl: parsed.returnUrl
212
+ };
213
+ }
214
+ return { csrf: state };
215
+ } catch {
216
+ return { csrf: state };
217
+ }
218
+ }
219
+ function base64UrlEncode(array) {
220
+ let base64 = "";
221
+ if (typeof Buffer !== "undefined") {
222
+ base64 = Buffer.from(array).toString("base64");
223
+ } else {
224
+ const binary = String.fromCharCode(...array);
225
+ base64 = btoa(binary);
226
+ }
227
+ return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
228
+ }
229
+ function base64UrlDecode(str) {
230
+ let base64 = str.replace(/-/g, "+").replace(/_/g, "/");
231
+ while (base64.length % 4 !== 0) {
232
+ base64 += "=";
233
+ }
234
+ if (typeof Buffer !== "undefined") {
235
+ return Buffer.from(base64, "base64").toString("utf-8");
236
+ } else {
237
+ const binary = atob(base64);
238
+ const bytes = new Uint8Array(binary.length);
239
+ for (let i = 0;i < binary.length; i++) {
240
+ bytes[i] = binary.charCodeAt(i);
241
+ }
242
+ const decoder = new TextDecoder;
243
+ return decoder.decode(bytes);
244
+ }
245
+ }
246
+
151
247
  // src/protocol/jsonrpc.ts
152
248
  function parseMessage(message) {
153
249
  try {
@@ -369,95 +465,6 @@ function methodToToolName(methodName, pluginId) {
369
465
  const snakeCaseMethod = camelToSnake(methodName);
370
466
  return `${pluginId}_${snakeCaseMethod}`;
371
467
  }
372
-
373
- // src/oauth/pkce.ts
374
- function generateCodeVerifier() {
375
- const array = new Uint8Array(32);
376
- if (typeof crypto !== "undefined" && crypto.getRandomValues) {
377
- crypto.getRandomValues(array);
378
- } else if (typeof globalThis !== "undefined" && globalThis.crypto) {
379
- globalThis.crypto.getRandomValues(array);
380
- } else {
381
- throw new Error("crypto.getRandomValues is not available. Please use Node.js 19+ or a modern browser.");
382
- }
383
- return base64UrlEncode(array);
384
- }
385
- async function generateCodeChallenge(verifier) {
386
- const encoder = new TextEncoder;
387
- const data = encoder.encode(verifier);
388
- let hashBuffer;
389
- if (typeof crypto !== "undefined" && crypto.subtle) {
390
- hashBuffer = await crypto.subtle.digest("SHA-256", data);
391
- } else if (typeof globalThis !== "undefined" && globalThis.crypto?.subtle) {
392
- hashBuffer = await globalThis.crypto.subtle.digest("SHA-256", data);
393
- } else {
394
- throw new Error("crypto.subtle.digest is not available. Please use Node.js 19+ or a modern browser.");
395
- }
396
- return base64UrlEncode(new Uint8Array(hashBuffer));
397
- }
398
- function generateState() {
399
- const array = new Uint8Array(16);
400
- if (typeof crypto !== "undefined" && crypto.getRandomValues) {
401
- crypto.getRandomValues(array);
402
- } else if (typeof globalThis !== "undefined" && globalThis.crypto) {
403
- globalThis.crypto.getRandomValues(array);
404
- } else {
405
- throw new Error("crypto.getRandomValues is not available. Please use Node.js 19+ or a modern browser.");
406
- }
407
- return base64UrlEncode(array);
408
- }
409
- function generateStateWithReturnUrl(returnUrl) {
410
- const csrf = generateState();
411
- const stateData = returnUrl ? { csrf, returnUrl } : { csrf };
412
- const encoder = new TextEncoder;
413
- const jsonBytes = encoder.encode(JSON.stringify(stateData));
414
- return base64UrlEncode(jsonBytes);
415
- }
416
- function parseState(state) {
417
- try {
418
- const decoded = base64UrlDecode(state);
419
- const parsed = JSON.parse(decoded);
420
- if (typeof parsed === "string") {
421
- return { csrf: parsed };
422
- } else if (parsed && typeof parsed === "object") {
423
- return {
424
- csrf: parsed.csrf || state,
425
- returnUrl: parsed.returnUrl
426
- };
427
- }
428
- return { csrf: state };
429
- } catch {
430
- return { csrf: state };
431
- }
432
- }
433
- function base64UrlEncode(array) {
434
- let base64 = "";
435
- if (typeof Buffer !== "undefined") {
436
- base64 = Buffer.from(array).toString("base64");
437
- } else {
438
- const binary = String.fromCharCode(...array);
439
- base64 = btoa(binary);
440
- }
441
- return base64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
442
- }
443
- function base64UrlDecode(str) {
444
- let base64 = str.replace(/-/g, "+").replace(/_/g, "/");
445
- while (base64.length % 4 !== 0) {
446
- base64 += "=";
447
- }
448
- if (typeof Buffer !== "undefined") {
449
- return Buffer.from(base64, "base64").toString("utf-8");
450
- } else {
451
- const binary = atob(base64);
452
- const bytes = new Uint8Array(binary.length);
453
- for (let i = 0;i < binary.length; i++) {
454
- bytes[i] = binary.charCodeAt(i);
455
- }
456
- const decoder = new TextDecoder;
457
- return decoder.decode(bytes);
458
- }
459
- }
460
-
461
468
  // src/oauth/window-manager.ts
462
469
  function isBrowser() {
463
470
  return typeof window !== "undefined" && typeof window.document !== "undefined";
@@ -1016,7 +1023,20 @@ class MCPClient {
1016
1023
  headers: config.headers,
1017
1024
  timeout: config.timeout
1018
1025
  });
1019
- this.plugins = config.plugins;
1026
+ const oauthApiBase = config.oauthApiBase || "/api/integrate/oauth";
1027
+ const defaultRedirectUri = this.getDefaultRedirectUri(oauthApiBase);
1028
+ this.plugins = config.plugins.map((plugin) => {
1029
+ if (plugin.oauth && !plugin.oauth.redirectUri) {
1030
+ return {
1031
+ ...plugin,
1032
+ oauth: {
1033
+ ...plugin.oauth,
1034
+ redirectUri: defaultRedirectUri
1035
+ }
1036
+ };
1037
+ }
1038
+ return plugin;
1039
+ });
1020
1040
  this.clientInfo = config.clientInfo || {
1021
1041
  name: "integrate-sdk",
1022
1042
  version: "0.1.0"
@@ -1024,7 +1044,7 @@ class MCPClient {
1024
1044
  this.onReauthRequired = config.onReauthRequired;
1025
1045
  this.maxReauthRetries = config.maxReauthRetries ?? 1;
1026
1046
  this.connectionMode = config.connectionMode ?? "lazy";
1027
- this.oauthManager = new OAuthManager(config.oauthApiBase || "/api/integrate/oauth", config.oauthFlow);
1047
+ this.oauthManager = new OAuthManager(oauthApiBase, config.oauthFlow);
1028
1048
  const providers = this.plugins.filter((p) => p.oauth).map((p) => p.oauth.provider);
1029
1049
  this.oauthManager.loadAllProviderTokens(providers);
1030
1050
  for (const plugin of this.plugins) {
@@ -1041,6 +1061,14 @@ class MCPClient {
1041
1061
  this.server = this.createServerProxy();
1042
1062
  this.initializePlugins();
1043
1063
  }
1064
+ getDefaultRedirectUri(oauthApiBase) {
1065
+ if (typeof window === "undefined" || !window.location) {
1066
+ return "http://localhost:3000/oauth/callback";
1067
+ }
1068
+ const origin = window.location.origin;
1069
+ const normalizedPath = oauthApiBase.replace(/\/$/, "");
1070
+ return `${origin}${normalizedPath}/callback`;
1071
+ }
1044
1072
  async ensureConnected() {
1045
1073
  if (this.initialized && this.transport.isConnected()) {
1046
1074
  return;
@@ -1728,6 +1756,80 @@ function createNextOAuthHandler(config) {
1728
1756
  return Response.json({ error: `Unknown action: ${action}` }, { status: 404 });
1729
1757
  }
1730
1758
  };
1759
+ },
1760
+ toNextJsHandler(redirectConfig) {
1761
+ const defaultRedirectUrl = redirectConfig?.redirectUrl || "/";
1762
+ const errorRedirectUrl = redirectConfig?.errorRedirectUrl || "/auth-error";
1763
+ return {
1764
+ async POST(req, context) {
1765
+ const params = context.params instanceof Promise ? await context.params : context.params;
1766
+ const segments = params.all || [];
1767
+ if (segments.length === 2 && segments[0] === "oauth") {
1768
+ const action = segments[1];
1769
+ if (action === "authorize") {
1770
+ return handlers.authorize(req);
1771
+ }
1772
+ if (action === "callback") {
1773
+ return handlers.callback(req);
1774
+ }
1775
+ if (action === "disconnect") {
1776
+ return handlers.disconnect(req);
1777
+ }
1778
+ return Response.json({ error: `Unknown action: ${action}` }, { status: 404 });
1779
+ }
1780
+ return Response.json({ error: `Invalid route: /${segments.join("/")}` }, { status: 404 });
1781
+ },
1782
+ async GET(req, context) {
1783
+ const params = context.params instanceof Promise ? await context.params : context.params;
1784
+ const segments = params.all || [];
1785
+ if (segments.length === 2 && segments[0] === "oauth") {
1786
+ const action = segments[1];
1787
+ if (action === "status") {
1788
+ return handlers.status(req);
1789
+ }
1790
+ if (action === "callback") {
1791
+ const { searchParams } = new URL(req.url);
1792
+ const code = searchParams.get("code");
1793
+ const state = searchParams.get("state");
1794
+ const error = searchParams.get("error");
1795
+ const errorDescription = searchParams.get("error_description");
1796
+ if (error) {
1797
+ const errorMsg = errorDescription || error;
1798
+ console.error("[OAuth Redirect] Error:", errorMsg);
1799
+ return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(errorMsg)}`, req.url));
1800
+ }
1801
+ if (!code || !state) {
1802
+ console.error("[OAuth Redirect] Missing code or state parameter");
1803
+ return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent("Invalid OAuth callback")}`, req.url));
1804
+ }
1805
+ let returnUrl = defaultRedirectUrl;
1806
+ try {
1807
+ const { parseState: parseState2 } = await Promise.resolve().then(() => exports_pkce);
1808
+ const stateData = parseState2(state);
1809
+ if (stateData.returnUrl) {
1810
+ returnUrl = stateData.returnUrl;
1811
+ }
1812
+ } catch (e) {
1813
+ try {
1814
+ const referrer = req.headers?.get?.("referer") || req.headers?.get?.("referrer");
1815
+ if (referrer) {
1816
+ const referrerUrl = new URL(referrer);
1817
+ const currentUrl = new URL(req.url);
1818
+ if (referrerUrl.origin === currentUrl.origin) {
1819
+ returnUrl = referrerUrl.pathname + referrerUrl.search;
1820
+ }
1821
+ }
1822
+ } catch {}
1823
+ }
1824
+ const targetUrl = new URL(returnUrl, req.url);
1825
+ targetUrl.hash = `oauth_callback=${encodeURIComponent(JSON.stringify({ code, state }))}`;
1826
+ return Response.redirect(targetUrl);
1827
+ }
1828
+ return Response.json({ error: `Unknown action: ${action}` }, { status: 404 });
1829
+ }
1830
+ return Response.json({ error: `Invalid route: /${segments.join("/")}` }, { status: 404 });
1831
+ }
1832
+ };
1731
1833
  }
1732
1834
  };
1733
1835
  return handlers;
@@ -1846,12 +1948,12 @@ function getDefaultRedirectUri() {
1846
1948
  if (typeof window !== "undefined") {
1847
1949
  return `${window.location.origin}/oauth/callback`;
1848
1950
  }
1951
+ if (process.env.INTEGRATE_URL) {
1952
+ return `${process.env.INTEGRATE_URL}/oauth/callback`;
1953
+ }
1849
1954
  if (process.env.VERCEL_URL) {
1850
1955
  return `https://${process.env.VERCEL_URL}/oauth/callback`;
1851
1956
  }
1852
- if (process.env.NEXTAUTH_URL) {
1853
- return `${process.env.NEXTAUTH_URL}/oauth/callback`;
1854
- }
1855
1957
  return "http://localhost:3000/oauth/callback";
1856
1958
  }
1857
1959
  function createMCPServer(config) {
@@ -1859,12 +1961,12 @@ function createMCPServer(config) {
1859
1961
  throw new Error("createMCPServer() should only be called on the server-side. " + "Use createMCPClient() for client-side code.");
1860
1962
  }
1861
1963
  const providers = {};
1862
- for (const plugin of config.plugins) {
1964
+ const updatedPlugins = config.plugins.map((plugin) => {
1863
1965
  if (plugin.oauth) {
1864
1966
  const { clientId, clientSecret, redirectUri: pluginRedirectUri } = plugin.oauth;
1865
1967
  if (!clientId || !clientSecret) {
1866
1968
  console.warn(`Warning: Plugin "${plugin.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the plugin configuration.`);
1867
- continue;
1969
+ return plugin;
1868
1970
  }
1869
1971
  const redirectUri = pluginRedirectUri || config.redirectUri || getDefaultRedirectUri();
1870
1972
  providers[plugin.id] = {
@@ -1872,11 +1974,20 @@ function createMCPServer(config) {
1872
1974
  clientSecret,
1873
1975
  redirectUri
1874
1976
  };
1977
+ return {
1978
+ ...plugin,
1979
+ oauth: {
1980
+ ...plugin.oauth,
1981
+ redirectUri
1982
+ }
1983
+ };
1875
1984
  }
1876
- }
1985
+ return plugin;
1986
+ });
1877
1987
  globalServerConfig = { providers };
1878
1988
  const clientConfig = {
1879
1989
  ...config,
1990
+ plugins: updatedPlugins,
1880
1991
  connectionMode: config.connectionMode || "lazy",
1881
1992
  singleton: config.singleton ?? true
1882
1993
  };
@@ -1908,7 +2019,27 @@ var GET = async (req, context) => {
1908
2019
  const routes = handler.createRoutes();
1909
2020
  return routes.GET(req, context);
1910
2021
  };
2022
+ function toNextJsHandler(redirectConfig) {
2023
+ const POST2 = async (req, context) => {
2024
+ if (!globalServerConfig) {
2025
+ return Response.json({ error: "OAuth not configured. Call createMCPServer() in your server initialization file first." }, { status: 500 });
2026
+ }
2027
+ const handler = createNextOAuthHandler(globalServerConfig);
2028
+ const routes = handler.toNextJsHandler(redirectConfig);
2029
+ return routes.POST(req, context);
2030
+ };
2031
+ const GET2 = async (req, context) => {
2032
+ if (!globalServerConfig) {
2033
+ return Response.json({ error: "OAuth not configured. Call createMCPServer() in your server initialization file first." }, { status: 500 });
2034
+ }
2035
+ const handler = createNextOAuthHandler(globalServerConfig);
2036
+ const routes = handler.toNextJsHandler(redirectConfig);
2037
+ return routes.GET(req, context);
2038
+ };
2039
+ return { POST: POST2, GET: GET2 };
2040
+ }
1911
2041
  export {
2042
+ toNextJsHandler,
1912
2043
  gmailPlugin,
1913
2044
  githubPlugin,
1914
2045
  genericOAuthPlugin,
@@ -265,6 +265,68 @@ export declare function createNextOAuthHandler(config: OAuthHandlerConfig): {
265
265
  }>;
266
266
  }): Promise<NextResponse>;
267
267
  };
268
+ /**
269
+ * Create unified catch-all route handler
270
+ *
271
+ * This is the simplest way to set up OAuth routes - create a single catch-all
272
+ * route file that handles ALL OAuth actions including provider redirects.
273
+ *
274
+ * @param redirectConfig - Configuration for OAuth redirect behavior
275
+ * @returns Object with POST and GET handlers for Next.js catch-all routes
276
+ *
277
+ * @example
278
+ * ```typescript
279
+ * // app/api/integrate/[...all]/route.ts
280
+ * import { createNextOAuthHandler } from 'integrate-sdk';
281
+ *
282
+ * const handler = createNextOAuthHandler({
283
+ * providers: {
284
+ * github: {
285
+ * clientId: process.env.GITHUB_CLIENT_ID!,
286
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
287
+ * },
288
+ * },
289
+ * });
290
+ *
291
+ * export const { POST, GET } = handler.toNextJsHandler({
292
+ * redirectUrl: '/',
293
+ * });
294
+ * ```
295
+ *
296
+ * This single route file handles:
297
+ * - POST /api/integrate/oauth/authorize - Get authorization URL
298
+ * - POST /api/integrate/oauth/callback - Exchange code for token
299
+ * - GET /api/integrate/oauth/callback - Provider OAuth redirect
300
+ * - GET /api/integrate/oauth/status - Check authorization status
301
+ * - POST /api/integrate/oauth/disconnect - Disconnect provider
302
+ */
303
+ toNextJsHandler(redirectConfig?: {
304
+ /** URL to redirect to after OAuth callback (default: '/') */
305
+ redirectUrl?: string;
306
+ /** URL to redirect to on OAuth error (default: '/auth-error') */
307
+ errorRedirectUrl?: string;
308
+ }): {
309
+ /**
310
+ * POST handler for authorize, callback, and disconnect actions
311
+ */
312
+ POST(req: NextRequest, context: {
313
+ params: {
314
+ all: string[];
315
+ } | Promise<{
316
+ all: string[];
317
+ }>;
318
+ }): Promise<NextResponse>;
319
+ /**
320
+ * GET handler for status action and OAuth provider redirects
321
+ */
322
+ GET(req: NextRequest, context: {
323
+ params: {
324
+ all: string[];
325
+ } | Promise<{
326
+ all: string[];
327
+ }>;
328
+ }): Promise<NextResponse>;
329
+ };
268
330
  };
269
331
  export {};
270
332
  //# sourceMappingURL=nextjs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../../../src/adapters/nextjs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG1E,KAAK,WAAW,GAAG,GAAG,CAAC;AACvB,KAAK,YAAY,GAAG,GAAG,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,kBAAkB;IAI7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;mBACkB,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAcxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;kBACiB,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAcvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;gBACe,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IA+BrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;oBACmB,WAAW,GAAG,OAAO,CAAC,YAAY,CAA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;;;OAwBG;;QAGC;;WAEG;kBAEI,WAAW,WACP;YAAE,MAAM,EAAE;gBAAE,MAAM,EAAE,MAAM,CAAA;aAAE,GAAG,OAAO,CAAC;gBAAE,MAAM,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,GACpE,OAAO,CAAC,YAAY,CAAC;QAuBxB;;WAEG;iBAEI,WAAW,WACP;YAAE,MAAM,EAAE;gBAAE,MAAM,EAAE,MAAM,CAAA;aAAE,GAAG,OAAO,CAAC;gBAAE,MAAM,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,GACpE,OAAO,CAAC,YAAY,CAAC;;IAiB5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;qCAC8B;QAC/B,6DAA6D;QAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,iEAAiE;QACjE,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B;QAKG;;WAEG;kBAEI,WAAW,WACP;YAAE,MAAM,EAAE;gBAAE,GAAG,EAAE,MAAM,EAAE,CAAA;aAAE,GAAG,OAAO,CAAC;gBAAE,GAAG,EAAE,MAAM,EAAE,CAAA;aAAE,CAAC,CAAA;SAAE,GAClE,OAAO,CAAC,YAAY,CAAC;QAiCxB;;WAEG;iBAEI,WAAW,WACP;YAAE,MAAM,EAAE;gBAAE,GAAG,EAAE,MAAM,EAAE,CAAA;aAAE,GAAG,OAAO,CAAC;gBAAE,GAAG,EAAE,MAAM,EAAE,CAAA;aAAE,CAAC,CAAA;SAAE,GAClE,OAAO,CAAC,YAAY,CAAC;;EA+F/B"}
@@ -65,6 +65,14 @@ export declare class MCPClient<TPlugins extends readonly MCPPlugin[] = readonly
65
65
  } ? GmailPluginClient : never;
66
66
  readonly server: ServerPluginClient;
67
67
  constructor(config: MCPClientConfig<TPlugins>);
68
+ /**
69
+ * Get default redirect URI for OAuth flows
70
+ * Uses window.location.origin + OAuth API base path
71
+ *
72
+ * @param oauthApiBase - The OAuth API base path (e.g., '/api/integrate/oauth')
73
+ * @returns Default redirect URI
74
+ */
75
+ private getDefaultRedirectUri;
68
76
  /**
69
77
  * Ensure the client is connected (for lazy connection mode)
70
78
  */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,OAAO,EAEP,mBAAmB,EAIpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAiB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,KAAK,EACV,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAgE1B;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,EAAE,GAAG,KAAK,CAAC;AAClE,KAAK,SAAS,CAAC,QAAQ,SAAS,SAAS,SAAS,EAAE,IAAI,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAE1F;;GAEG;AACH,KAAK,WAA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;;;OAGG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CA2BzD;AA4DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,SAAS,SAAS,EAAE,EACnE,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,GAChC,SAAS,CAAC,QAAQ,CAAC,CAkErB;AA0CD;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAetD"}
@@ -166,14 +166,33 @@ export interface MCPClientConfig<TPlugins extends readonly MCPPlugin[]> {
166
166
  /**
167
167
  * Global OAuth redirect URI for all providers
168
168
  * Used as fallback when individual plugins don't specify their own redirectUri
169
- * If not provided, will auto-detect from VERCEL_URL or NEXTAUTH_URL
169
+ *
170
+ * **Server-side (createMCPServer):** If not provided, auto-detects from environment:
171
+ * - INTEGRATE_URL (primary)
172
+ * - VERCEL_URL
173
+ * - Falls back to 'http://localhost:3000/oauth/callback'
174
+ *
175
+ * **Client-side (createMCPClient):** If not provided, auto-detects from:
176
+ * - window.location.origin + oauthApiBase + '/callback'
177
+ * - Example: 'http://localhost:3000/api/integrate/oauth/callback'
170
178
  *
171
179
  * @example
172
180
  * ```typescript
181
+ * // Explicit redirectUri (server-side)
173
182
  * createMCPServer({
174
183
  * redirectUri: 'https://myapp.com/oauth/callback',
175
184
  * plugins: [...]
176
185
  * })
186
+ *
187
+ * // Auto-detection (server-side) - uses process.env.INTEGRATE_URL
188
+ * createMCPServer({
189
+ * plugins: [...]
190
+ * })
191
+ *
192
+ * // Auto-detection (client-side) - uses window.location.origin
193
+ * createMCPClient({
194
+ * plugins: [...]
195
+ * })
177
196
  * ```
178
197
  */
179
198
  redirectUri?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA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YG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;;;;OAaG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,SAAS,SAAS,EAAE,IACjE,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,QAAQ,SAAS,SAAS,SAAS,EAAE,IAAI;KACnE,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;CAC9C,CAAC"}
@@ -12,16 +12,17 @@ import type { MCPPlugin } from './plugins/types.js';
12
12
  * Use this in your server configuration file (e.g., lib/integrate-server.ts)
13
13
  *
14
14
  * The redirectUri can be specified globally and will be used for all plugins.
15
- * If not provided, it will auto-detect from VERCEL_URL or NEXTAUTH_URL.
15
+ * If not provided, it will auto-detect from INTEGRATE_URL or VERCEL_URL
16
16
  *
17
17
  * @example
18
18
  * ```typescript
19
19
  * // lib/integrate-server.ts (server-side only!)
20
20
  * import { createMCPServer, githubPlugin, gmailPlugin } from 'integrate-sdk/server';
21
21
  *
22
+ * // With explicit redirectUri
22
23
  * export const { client: serverClient } = createMCPServer({
23
- * redirectUri: process.env.VERCEL_URL
24
- * ? `https://${process.env.VERCEL_URL}/oauth/callback`
24
+ * redirectUri: process.env.INTEGRATE_URL
25
+ * ? `${process.env.INTEGRATE_URL}/oauth/callback`
25
26
  * : 'http://localhost:3000/oauth/callback',
26
27
  * plugins: [
27
28
  * githubPlugin({
@@ -36,6 +37,17 @@ import type { MCPPlugin } from './plugins/types.js';
36
37
  * }),
37
38
  * ],
38
39
  * });
40
+ *
41
+ * // Or omit redirectUri to use auto-detection from environment variables
42
+ * export const { client: serverClient } = createMCPServer({
43
+ * plugins: [
44
+ * githubPlugin({
45
+ * clientId: process.env.GITHUB_CLIENT_ID!,
46
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
47
+ * scopes: ['repo', 'user'],
48
+ * }),
49
+ * ],
50
+ * });
39
51
  * ```
40
52
  *
41
53
  * Then in your route file:
@@ -109,4 +121,55 @@ export declare const GET: (req: any, context: {
109
121
  action: string;
110
122
  }>;
111
123
  }) => Promise<any>;
124
+ /**
125
+ * Create catch-all route handlers from the global server configuration
126
+ *
127
+ * This is a helper function to create POST and GET handlers for catch-all routes
128
+ * that use the configuration from createMCPServer().
129
+ *
130
+ * @param redirectConfig - Optional configuration for OAuth redirect behavior
131
+ * @returns Object with POST and GET handlers for Next.js catch-all routes
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * // lib/integrate-server.ts
136
+ * import { createMCPServer, githubPlugin } from 'integrate-sdk/server';
137
+ *
138
+ * export const { client: serverClient } = createMCPServer({
139
+ * plugins: [
140
+ * githubPlugin({
141
+ * clientId: process.env.GITHUB_CLIENT_ID!,
142
+ * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
143
+ * scopes: ['repo', 'user'],
144
+ * }),
145
+ * ],
146
+ * });
147
+ *
148
+ * // app/api/integrate/[...all]/route.ts
149
+ * import { toNextJsHandler } from 'integrate-sdk/server';
150
+ *
151
+ * export const { POST, GET } = toNextJsHandler({
152
+ * redirectUrl: '/dashboard',
153
+ * });
154
+ * ```
155
+ */
156
+ export declare function toNextJsHandler(redirectConfig?: {
157
+ redirectUrl?: string;
158
+ errorRedirectUrl?: string;
159
+ }): {
160
+ POST: (req: any, context: {
161
+ params: {
162
+ all: string[];
163
+ } | Promise<{
164
+ all: string[];
165
+ }>;
166
+ }) => Promise<any>;
167
+ GET: (req: any, context: {
168
+ params: {
169
+ all: string[];
170
+ } | Promise<{
171
+ all: string[];
172
+ }>;
173
+ }) => Promise<any>;
174
+ };
112
175
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAyCpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,SAAS,SAAS,EAAE,EACnE,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC;IAuD/B,2DAA2D;;IAG3D,4DAA4D;;;;;;;;IAG5D,2DAA2D;;;;;;;;EAG9D;AAYD,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE9E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI,GACf,KAAK,GAAG,EACR,SAAS;IAAE,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,iBAYtE,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,GAAG,GACd,KAAK,GAAG,EACR,SAAS;IAAE,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAA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AE,CAAC,CAAA;CAAE,iBAYtE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,eAAe,CAAC,cAAc,CAAC,EAAE;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;gBAMQ,GAAG,WACC;QAAE,MAAM,EAAE;YAAE,GAAG,EAAE,MAAM,EAAE,CAAA;SAAE,GAAG,OAAO,CAAC;YAAE,GAAG,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAA;KAAE;eAmB9D,GAAG,WACC;QAAE,MAAM,EAAE;YAAE,GAAG,EAAE,MAAM,EAAE,CAAA;SAAE,GAAG,OAAO,CAAC;YAAE,GAAG,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAA;KAAE;EAetE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "integrate-sdk",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "description": "Type-safe TypeScript SDK for MCP Client with plugin-based OAuth provider configuration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",