integrate-sdk 0.5.9 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -1
- package/dist/index.js +1 -1
- package/dist/server.js +5 -5
- package/dist/src/config/types.d.ts +1 -1
- package/dist/src/server.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,19 @@ bun add integrate-sdk
|
|
|
28
28
|
|
|
29
29
|
## Quick Start (2 Files Only!)
|
|
30
30
|
|
|
31
|
+
### 0. Configure OAuth Redirect URI
|
|
32
|
+
|
|
33
|
+
⚠️ **Important**: Configure your OAuth apps with this redirect URI:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
http://localhost:3000/api/integrate/oauth/callback
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **GitHub**: Settings → Developer settings → OAuth Apps → Authorization callback URL
|
|
40
|
+
- **Google/Gmail**: Google Cloud Console → Credentials → Authorized redirect URIs
|
|
41
|
+
|
|
42
|
+
For production, use: `https://yourdomain.com/api/integrate/oauth/callback`
|
|
43
|
+
|
|
31
44
|
### 1. Create Server Config
|
|
32
45
|
|
|
33
46
|
Define your OAuth providers once:
|
|
@@ -66,7 +79,7 @@ import { serverClient } from "@/lib/integrate-server";
|
|
|
66
79
|
import { toNextJsHandler } from "integrate-sdk/server";
|
|
67
80
|
|
|
68
81
|
export const { POST, GET } = toNextJsHandler({
|
|
69
|
-
client: serverClient,
|
|
82
|
+
client: serverClient, // Pass the client
|
|
70
83
|
redirectUrl: "/dashboard",
|
|
71
84
|
});
|
|
72
85
|
```
|
package/dist/index.js
CHANGED
|
@@ -1063,7 +1063,7 @@ class MCPClient {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
getDefaultRedirectUri(oauthApiBase) {
|
|
1065
1065
|
if (typeof window === "undefined" || !window.location) {
|
|
1066
|
-
return "http://localhost:3000/oauth/callback";
|
|
1066
|
+
return "http://localhost:3000/api/integrate/oauth/callback";
|
|
1067
1067
|
}
|
|
1068
1068
|
const origin = window.location.origin;
|
|
1069
1069
|
const normalizedPath = oauthApiBase.replace(/\/$/, "");
|
package/dist/server.js
CHANGED
|
@@ -1063,7 +1063,7 @@ class MCPClient {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
getDefaultRedirectUri(oauthApiBase) {
|
|
1065
1065
|
if (typeof window === "undefined" || !window.location) {
|
|
1066
|
-
return "http://localhost:3000/oauth/callback";
|
|
1066
|
+
return "http://localhost:3000/api/integrate/oauth/callback";
|
|
1067
1067
|
}
|
|
1068
1068
|
const origin = window.location.origin;
|
|
1069
1069
|
const normalizedPath = oauthApiBase.replace(/\/$/, "");
|
|
@@ -1946,15 +1946,15 @@ function createSimplePlugin(config) {
|
|
|
1946
1946
|
var globalServerConfig = null;
|
|
1947
1947
|
function getDefaultRedirectUri() {
|
|
1948
1948
|
if (typeof window !== "undefined") {
|
|
1949
|
-
return `${window.location.origin}/oauth/callback`;
|
|
1949
|
+
return `${window.location.origin}/api/integrate/oauth/callback`;
|
|
1950
1950
|
}
|
|
1951
1951
|
if (process.env.INTEGRATE_URL) {
|
|
1952
|
-
return `${process.env.INTEGRATE_URL}/oauth/callback`;
|
|
1952
|
+
return `${process.env.INTEGRATE_URL}/api/integrate/oauth/callback`;
|
|
1953
1953
|
}
|
|
1954
1954
|
if (process.env.VERCEL_URL) {
|
|
1955
|
-
return `https://${process.env.VERCEL_URL}/oauth/callback`;
|
|
1955
|
+
return `https://${process.env.VERCEL_URL}/api/integrate/oauth/callback`;
|
|
1956
1956
|
}
|
|
1957
|
-
return "http://localhost:3000/oauth/callback";
|
|
1957
|
+
return "http://localhost:3000/api/integrate/oauth/callback";
|
|
1958
1958
|
}
|
|
1959
1959
|
function createMCPServer(config) {
|
|
1960
1960
|
if (typeof window !== "undefined") {
|
|
@@ -170,7 +170,7 @@ export interface MCPClientConfig<TPlugins extends readonly MCPPlugin[]> {
|
|
|
170
170
|
* **Server-side (createMCPServer):** If not provided, auto-detects from environment:
|
|
171
171
|
* - INTEGRATE_URL (primary)
|
|
172
172
|
* - VERCEL_URL
|
|
173
|
-
* - Falls back to 'http://localhost:3000/oauth/callback'
|
|
173
|
+
* - Falls back to 'http://localhost:3000/api/integrate/oauth/callback'
|
|
174
174
|
*
|
|
175
175
|
* **Client-side (createMCPClient):** If not provided, auto-detects from:
|
|
176
176
|
* - window.location.origin + oauthApiBase + '/callback'
|
package/dist/src/server.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ import type { MCPPlugin } from './plugins/types.js';
|
|
|
23
23
|
* export const { client: serverClient } = createMCPServer({
|
|
24
24
|
* redirectUri: process.env.INTEGRATE_URL
|
|
25
25
|
* ? `${process.env.INTEGRATE_URL}/oauth/callback`
|
|
26
|
-
* : 'http://localhost:3000/oauth/callback',
|
|
26
|
+
* : 'http://localhost:3000/api/integrate/oauth/callback',
|
|
27
27
|
* plugins: [
|
|
28
28
|
* githubPlugin({
|
|
29
29
|
* clientId: process.env.GITHUB_CLIENT_ID!,
|