integrate-sdk 0.7.58 → 0.7.61
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 +1 -1
- package/dist/adapters/index.js +26 -9
- package/dist/adapters/solid-start.js +26 -9
- package/dist/adapters/svelte-kit.js +26 -9
- package/dist/index.js +49 -16
- package/dist/server.js +26 -9
- package/dist/src/client.d.ts +17 -7
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/integrations/github.d.ts +0 -50
- package/dist/src/integrations/github.d.ts.map +1 -1
- package/dist/src/integrations/notion.d.ts +0 -44
- package/dist/src/integrations/notion.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -246,7 +246,7 @@ The SDK implements OAuth 2.0 Authorization Code Flow with PKCE for secure author
|
|
|
246
246
|
|
|
247
247
|
```typescript
|
|
248
248
|
// Check authorization
|
|
249
|
-
if (!client.isAuthorized("github")) {
|
|
249
|
+
if (!(await client.isAuthorized("github"))) {
|
|
250
250
|
await client.authorize("github"); // Opens popup or redirects
|
|
251
251
|
}
|
|
252
252
|
|
package/dist/adapters/index.js
CHANGED
|
@@ -1901,6 +1901,7 @@ class MCPClientBase {
|
|
|
1901
1901
|
eventEmitter = new SimpleEventEmitter;
|
|
1902
1902
|
apiRouteBase;
|
|
1903
1903
|
apiBaseUrl;
|
|
1904
|
+
oauthCallbackPromise;
|
|
1904
1905
|
server;
|
|
1905
1906
|
constructor(config) {
|
|
1906
1907
|
this.transport = new HttpSessionTransport({
|
|
@@ -1944,6 +1945,7 @@ class MCPClientBase {
|
|
|
1944
1945
|
}
|
|
1945
1946
|
}
|
|
1946
1947
|
const providers = this.integrations.filter((p) => p.oauth).map((p) => p.oauth.provider);
|
|
1948
|
+
const hasOAuthCallback = typeof window !== "undefined" && window.location && window.location.hash && window.location.hash.includes("oauth_callback=");
|
|
1947
1949
|
const usingDatabaseCallbacks = !!config.getProviderToken;
|
|
1948
1950
|
if (usingDatabaseCallbacks) {
|
|
1949
1951
|
this.oauthManager.loadAllProviderTokens(providers).then(async () => {
|
|
@@ -1969,14 +1971,18 @@ class MCPClientBase {
|
|
|
1969
1971
|
console.error("Failed to load provider tokens:", error);
|
|
1970
1972
|
});
|
|
1971
1973
|
} else {
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1974
|
+
if (!hasOAuthCallback) {
|
|
1975
|
+
this.oauthManager.loadAllProviderTokensSync(providers);
|
|
1976
|
+
for (const integration of this.integrations) {
|
|
1977
|
+
if (integration.oauth) {
|
|
1978
|
+
const provider = integration.oauth.provider;
|
|
1979
|
+
const tokenData = this.oauthManager.getProviderTokenFromCache(provider);
|
|
1980
|
+
if (tokenData) {
|
|
1981
|
+
this.authState.set(provider, { authenticated: true });
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1978
1984
|
}
|
|
1979
|
-
}
|
|
1985
|
+
} else {}
|
|
1980
1986
|
}
|
|
1981
1987
|
const integrationIds = this.integrations.map((i) => i.id);
|
|
1982
1988
|
if (integrationIds.includes("github")) {
|
|
@@ -1985,6 +1991,9 @@ class MCPClientBase {
|
|
|
1985
1991
|
if (integrationIds.includes("gmail")) {
|
|
1986
1992
|
this.gmail = this.createIntegrationProxy("gmail");
|
|
1987
1993
|
}
|
|
1994
|
+
if (integrationIds.includes("notion")) {
|
|
1995
|
+
this.notion = this.createIntegrationProxy("notion");
|
|
1996
|
+
}
|
|
1988
1997
|
this.server = this.createServerProxy();
|
|
1989
1998
|
this.initializeIntegrations();
|
|
1990
1999
|
}
|
|
@@ -2285,10 +2294,18 @@ class MCPClientBase {
|
|
|
2285
2294
|
isProviderAuthenticated(provider) {
|
|
2286
2295
|
return this.authState.get(provider)?.authenticated ?? false;
|
|
2287
2296
|
}
|
|
2288
|
-
isAuthorized(provider) {
|
|
2297
|
+
async isAuthorized(provider) {
|
|
2298
|
+
if (this.oauthCallbackPromise) {
|
|
2299
|
+
await this.oauthCallbackPromise;
|
|
2300
|
+
this.oauthCallbackPromise = null;
|
|
2301
|
+
}
|
|
2289
2302
|
return this.authState.get(provider)?.authenticated ?? false;
|
|
2290
2303
|
}
|
|
2291
|
-
authorizedProviders() {
|
|
2304
|
+
async authorizedProviders() {
|
|
2305
|
+
if (this.oauthCallbackPromise) {
|
|
2306
|
+
await this.oauthCallbackPromise;
|
|
2307
|
+
this.oauthCallbackPromise = null;
|
|
2308
|
+
}
|
|
2292
2309
|
const authorized = [];
|
|
2293
2310
|
for (const integration of this.integrations) {
|
|
2294
2311
|
if (integration.oauth) {
|
|
@@ -1760,6 +1760,7 @@ class MCPClientBase {
|
|
|
1760
1760
|
eventEmitter = new SimpleEventEmitter;
|
|
1761
1761
|
apiRouteBase;
|
|
1762
1762
|
apiBaseUrl;
|
|
1763
|
+
oauthCallbackPromise;
|
|
1763
1764
|
server;
|
|
1764
1765
|
constructor(config) {
|
|
1765
1766
|
this.transport = new HttpSessionTransport({
|
|
@@ -1803,6 +1804,7 @@ class MCPClientBase {
|
|
|
1803
1804
|
}
|
|
1804
1805
|
}
|
|
1805
1806
|
const providers = this.integrations.filter((p) => p.oauth).map((p) => p.oauth.provider);
|
|
1807
|
+
const hasOAuthCallback = typeof window !== "undefined" && window.location && window.location.hash && window.location.hash.includes("oauth_callback=");
|
|
1806
1808
|
const usingDatabaseCallbacks = !!config.getProviderToken;
|
|
1807
1809
|
if (usingDatabaseCallbacks) {
|
|
1808
1810
|
this.oauthManager.loadAllProviderTokens(providers).then(async () => {
|
|
@@ -1828,14 +1830,18 @@ class MCPClientBase {
|
|
|
1828
1830
|
console.error("Failed to load provider tokens:", error);
|
|
1829
1831
|
});
|
|
1830
1832
|
} else {
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1833
|
+
if (!hasOAuthCallback) {
|
|
1834
|
+
this.oauthManager.loadAllProviderTokensSync(providers);
|
|
1835
|
+
for (const integration of this.integrations) {
|
|
1836
|
+
if (integration.oauth) {
|
|
1837
|
+
const provider = integration.oauth.provider;
|
|
1838
|
+
const tokenData = this.oauthManager.getProviderTokenFromCache(provider);
|
|
1839
|
+
if (tokenData) {
|
|
1840
|
+
this.authState.set(provider, { authenticated: true });
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1837
1843
|
}
|
|
1838
|
-
}
|
|
1844
|
+
} else {}
|
|
1839
1845
|
}
|
|
1840
1846
|
const integrationIds = this.integrations.map((i) => i.id);
|
|
1841
1847
|
if (integrationIds.includes("github")) {
|
|
@@ -1844,6 +1850,9 @@ class MCPClientBase {
|
|
|
1844
1850
|
if (integrationIds.includes("gmail")) {
|
|
1845
1851
|
this.gmail = this.createIntegrationProxy("gmail");
|
|
1846
1852
|
}
|
|
1853
|
+
if (integrationIds.includes("notion")) {
|
|
1854
|
+
this.notion = this.createIntegrationProxy("notion");
|
|
1855
|
+
}
|
|
1847
1856
|
this.server = this.createServerProxy();
|
|
1848
1857
|
this.initializeIntegrations();
|
|
1849
1858
|
}
|
|
@@ -2144,10 +2153,18 @@ class MCPClientBase {
|
|
|
2144
2153
|
isProviderAuthenticated(provider) {
|
|
2145
2154
|
return this.authState.get(provider)?.authenticated ?? false;
|
|
2146
2155
|
}
|
|
2147
|
-
isAuthorized(provider) {
|
|
2156
|
+
async isAuthorized(provider) {
|
|
2157
|
+
if (this.oauthCallbackPromise) {
|
|
2158
|
+
await this.oauthCallbackPromise;
|
|
2159
|
+
this.oauthCallbackPromise = null;
|
|
2160
|
+
}
|
|
2148
2161
|
return this.authState.get(provider)?.authenticated ?? false;
|
|
2149
2162
|
}
|
|
2150
|
-
authorizedProviders() {
|
|
2163
|
+
async authorizedProviders() {
|
|
2164
|
+
if (this.oauthCallbackPromise) {
|
|
2165
|
+
await this.oauthCallbackPromise;
|
|
2166
|
+
this.oauthCallbackPromise = null;
|
|
2167
|
+
}
|
|
2151
2168
|
const authorized = [];
|
|
2152
2169
|
for (const integration of this.integrations) {
|
|
2153
2170
|
if (integration.oauth) {
|
|
@@ -1760,6 +1760,7 @@ class MCPClientBase {
|
|
|
1760
1760
|
eventEmitter = new SimpleEventEmitter;
|
|
1761
1761
|
apiRouteBase;
|
|
1762
1762
|
apiBaseUrl;
|
|
1763
|
+
oauthCallbackPromise;
|
|
1763
1764
|
server;
|
|
1764
1765
|
constructor(config) {
|
|
1765
1766
|
this.transport = new HttpSessionTransport({
|
|
@@ -1803,6 +1804,7 @@ class MCPClientBase {
|
|
|
1803
1804
|
}
|
|
1804
1805
|
}
|
|
1805
1806
|
const providers = this.integrations.filter((p) => p.oauth).map((p) => p.oauth.provider);
|
|
1807
|
+
const hasOAuthCallback = typeof window !== "undefined" && window.location && window.location.hash && window.location.hash.includes("oauth_callback=");
|
|
1806
1808
|
const usingDatabaseCallbacks = !!config.getProviderToken;
|
|
1807
1809
|
if (usingDatabaseCallbacks) {
|
|
1808
1810
|
this.oauthManager.loadAllProviderTokens(providers).then(async () => {
|
|
@@ -1828,14 +1830,18 @@ class MCPClientBase {
|
|
|
1828
1830
|
console.error("Failed to load provider tokens:", error);
|
|
1829
1831
|
});
|
|
1830
1832
|
} else {
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1833
|
+
if (!hasOAuthCallback) {
|
|
1834
|
+
this.oauthManager.loadAllProviderTokensSync(providers);
|
|
1835
|
+
for (const integration of this.integrations) {
|
|
1836
|
+
if (integration.oauth) {
|
|
1837
|
+
const provider = integration.oauth.provider;
|
|
1838
|
+
const tokenData = this.oauthManager.getProviderTokenFromCache(provider);
|
|
1839
|
+
if (tokenData) {
|
|
1840
|
+
this.authState.set(provider, { authenticated: true });
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1837
1843
|
}
|
|
1838
|
-
}
|
|
1844
|
+
} else {}
|
|
1839
1845
|
}
|
|
1840
1846
|
const integrationIds = this.integrations.map((i) => i.id);
|
|
1841
1847
|
if (integrationIds.includes("github")) {
|
|
@@ -1844,6 +1850,9 @@ class MCPClientBase {
|
|
|
1844
1850
|
if (integrationIds.includes("gmail")) {
|
|
1845
1851
|
this.gmail = this.createIntegrationProxy("gmail");
|
|
1846
1852
|
}
|
|
1853
|
+
if (integrationIds.includes("notion")) {
|
|
1854
|
+
this.notion = this.createIntegrationProxy("notion");
|
|
1855
|
+
}
|
|
1847
1856
|
this.server = this.createServerProxy();
|
|
1848
1857
|
this.initializeIntegrations();
|
|
1849
1858
|
}
|
|
@@ -2144,10 +2153,18 @@ class MCPClientBase {
|
|
|
2144
2153
|
isProviderAuthenticated(provider) {
|
|
2145
2154
|
return this.authState.get(provider)?.authenticated ?? false;
|
|
2146
2155
|
}
|
|
2147
|
-
isAuthorized(provider) {
|
|
2156
|
+
async isAuthorized(provider) {
|
|
2157
|
+
if (this.oauthCallbackPromise) {
|
|
2158
|
+
await this.oauthCallbackPromise;
|
|
2159
|
+
this.oauthCallbackPromise = null;
|
|
2160
|
+
}
|
|
2148
2161
|
return this.authState.get(provider)?.authenticated ?? false;
|
|
2149
2162
|
}
|
|
2150
|
-
authorizedProviders() {
|
|
2163
|
+
async authorizedProviders() {
|
|
2164
|
+
if (this.oauthCallbackPromise) {
|
|
2165
|
+
await this.oauthCallbackPromise;
|
|
2166
|
+
this.oauthCallbackPromise = null;
|
|
2167
|
+
}
|
|
2151
2168
|
const authorized = [];
|
|
2152
2169
|
for (const integration of this.integrations) {
|
|
2153
2170
|
if (integration.oauth) {
|
package/dist/index.js
CHANGED
|
@@ -1603,6 +1603,7 @@ class MCPClientBase {
|
|
|
1603
1603
|
eventEmitter = new SimpleEventEmitter;
|
|
1604
1604
|
apiRouteBase;
|
|
1605
1605
|
apiBaseUrl;
|
|
1606
|
+
oauthCallbackPromise;
|
|
1606
1607
|
server;
|
|
1607
1608
|
constructor(config) {
|
|
1608
1609
|
this.transport = new HttpSessionTransport({
|
|
@@ -1646,6 +1647,7 @@ class MCPClientBase {
|
|
|
1646
1647
|
}
|
|
1647
1648
|
}
|
|
1648
1649
|
const providers = this.integrations.filter((p) => p.oauth).map((p) => p.oauth.provider);
|
|
1650
|
+
const hasOAuthCallback = typeof window !== "undefined" && window.location && window.location.hash && window.location.hash.includes("oauth_callback=");
|
|
1649
1651
|
const usingDatabaseCallbacks = !!config.getProviderToken;
|
|
1650
1652
|
if (usingDatabaseCallbacks) {
|
|
1651
1653
|
this.oauthManager.loadAllProviderTokens(providers).then(async () => {
|
|
@@ -1671,14 +1673,18 @@ class MCPClientBase {
|
|
|
1671
1673
|
console.error("Failed to load provider tokens:", error);
|
|
1672
1674
|
});
|
|
1673
1675
|
} else {
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1676
|
+
if (!hasOAuthCallback) {
|
|
1677
|
+
this.oauthManager.loadAllProviderTokensSync(providers);
|
|
1678
|
+
for (const integration of this.integrations) {
|
|
1679
|
+
if (integration.oauth) {
|
|
1680
|
+
const provider = integration.oauth.provider;
|
|
1681
|
+
const tokenData = this.oauthManager.getProviderTokenFromCache(provider);
|
|
1682
|
+
if (tokenData) {
|
|
1683
|
+
this.authState.set(provider, { authenticated: true });
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1680
1686
|
}
|
|
1681
|
-
}
|
|
1687
|
+
} else {}
|
|
1682
1688
|
}
|
|
1683
1689
|
const integrationIds = this.integrations.map((i) => i.id);
|
|
1684
1690
|
if (integrationIds.includes("github")) {
|
|
@@ -1687,6 +1693,9 @@ class MCPClientBase {
|
|
|
1687
1693
|
if (integrationIds.includes("gmail")) {
|
|
1688
1694
|
this.gmail = this.createIntegrationProxy("gmail");
|
|
1689
1695
|
}
|
|
1696
|
+
if (integrationIds.includes("notion")) {
|
|
1697
|
+
this.notion = this.createIntegrationProxy("notion");
|
|
1698
|
+
}
|
|
1690
1699
|
this.server = this.createServerProxy();
|
|
1691
1700
|
this.initializeIntegrations();
|
|
1692
1701
|
}
|
|
@@ -1987,10 +1996,18 @@ class MCPClientBase {
|
|
|
1987
1996
|
isProviderAuthenticated(provider) {
|
|
1988
1997
|
return this.authState.get(provider)?.authenticated ?? false;
|
|
1989
1998
|
}
|
|
1990
|
-
isAuthorized(provider) {
|
|
1999
|
+
async isAuthorized(provider) {
|
|
2000
|
+
if (this.oauthCallbackPromise) {
|
|
2001
|
+
await this.oauthCallbackPromise;
|
|
2002
|
+
this.oauthCallbackPromise = null;
|
|
2003
|
+
}
|
|
1991
2004
|
return this.authState.get(provider)?.authenticated ?? false;
|
|
1992
2005
|
}
|
|
1993
|
-
authorizedProviders() {
|
|
2006
|
+
async authorizedProviders() {
|
|
2007
|
+
if (this.oauthCallbackPromise) {
|
|
2008
|
+
await this.oauthCallbackPromise;
|
|
2009
|
+
this.oauthCallbackPromise = null;
|
|
2010
|
+
}
|
|
1994
2011
|
const authorized = [];
|
|
1995
2012
|
for (const integration of this.integrations) {
|
|
1996
2013
|
if (integration.oauth) {
|
|
@@ -2165,14 +2182,14 @@ function createMCPClient(config) {
|
|
|
2165
2182
|
});
|
|
2166
2183
|
}
|
|
2167
2184
|
if (config.autoHandleOAuthCallback !== false) {
|
|
2168
|
-
processOAuthCallbackFromHash(client, config.oauthCallbackErrorBehavior);
|
|
2185
|
+
client.oauthCallbackPromise = processOAuthCallbackFromHash(client, config.oauthCallbackErrorBehavior);
|
|
2169
2186
|
}
|
|
2170
2187
|
return client;
|
|
2171
2188
|
}
|
|
2172
2189
|
}
|
|
2173
2190
|
function processOAuthCallbackFromHash(client, errorBehavior) {
|
|
2174
2191
|
if (typeof window === "undefined" || !window.location) {
|
|
2175
|
-
return;
|
|
2192
|
+
return null;
|
|
2176
2193
|
}
|
|
2177
2194
|
const mode = errorBehavior?.mode || "silent";
|
|
2178
2195
|
try {
|
|
@@ -2183,17 +2200,32 @@ function processOAuthCallbackFromHash(client, errorBehavior) {
|
|
|
2183
2200
|
if (oauthCallbackData) {
|
|
2184
2201
|
const callbackParams = JSON.parse(decodeURIComponent(oauthCallbackData));
|
|
2185
2202
|
if (callbackParams.code && callbackParams.state) {
|
|
2186
|
-
client.handleOAuthCallback(callbackParams).
|
|
2203
|
+
return client.handleOAuthCallback(callbackParams).then(() => {
|
|
2204
|
+
const providers = client.integrations.filter((p) => p.oauth).map((p) => p.oauth.provider);
|
|
2205
|
+
client.oauthManager.loadAllProviderTokensSync(providers);
|
|
2206
|
+
for (const integration of client.integrations) {
|
|
2207
|
+
if (integration.oauth) {
|
|
2208
|
+
const provider = integration.oauth.provider;
|
|
2209
|
+
const tokenData = client.oauthManager.getProviderTokenFromCache(provider);
|
|
2210
|
+
if (tokenData) {
|
|
2211
|
+
client.authState.set(provider, { authenticated: true });
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
if (mode !== "redirect" || !errorBehavior?.redirectUrl) {
|
|
2216
|
+
window.history.replaceState(null, "", window.location.pathname + window.location.search);
|
|
2217
|
+
}
|
|
2218
|
+
}).catch((error) => {
|
|
2187
2219
|
if (mode === "console") {
|
|
2188
2220
|
console.error("Failed to process OAuth callback:", error);
|
|
2189
2221
|
} else if (mode === "redirect" && errorBehavior?.redirectUrl) {
|
|
2190
2222
|
window.location.href = errorBehavior.redirectUrl;
|
|
2191
2223
|
return;
|
|
2192
2224
|
}
|
|
2225
|
+
if (mode !== "redirect" || !errorBehavior?.redirectUrl) {
|
|
2226
|
+
window.history.replaceState(null, "", window.location.pathname + window.location.search);
|
|
2227
|
+
}
|
|
2193
2228
|
});
|
|
2194
|
-
if (mode !== "redirect" || !errorBehavior?.redirectUrl) {
|
|
2195
|
-
window.history.replaceState(null, "", window.location.pathname + window.location.search);
|
|
2196
|
-
}
|
|
2197
2229
|
}
|
|
2198
2230
|
}
|
|
2199
2231
|
}
|
|
@@ -2202,7 +2234,7 @@ function processOAuthCallbackFromHash(client, errorBehavior) {
|
|
|
2202
2234
|
console.error("Failed to process OAuth callback from hash:", error);
|
|
2203
2235
|
} else if (mode === "redirect" && errorBehavior?.redirectUrl) {
|
|
2204
2236
|
window.location.href = errorBehavior.redirectUrl;
|
|
2205
|
-
return;
|
|
2237
|
+
return null;
|
|
2206
2238
|
}
|
|
2207
2239
|
try {
|
|
2208
2240
|
if (mode !== "redirect" || !errorBehavior?.redirectUrl) {
|
|
@@ -2210,6 +2242,7 @@ function processOAuthCallbackFromHash(client, errorBehavior) {
|
|
|
2210
2242
|
}
|
|
2211
2243
|
} catch {}
|
|
2212
2244
|
}
|
|
2245
|
+
return null;
|
|
2213
2246
|
}
|
|
2214
2247
|
async function clearClientCache() {
|
|
2215
2248
|
const clients = Array.from(clientCache.values());
|
package/dist/server.js
CHANGED
|
@@ -1594,6 +1594,7 @@ class MCPClientBase {
|
|
|
1594
1594
|
eventEmitter = new SimpleEventEmitter;
|
|
1595
1595
|
apiRouteBase;
|
|
1596
1596
|
apiBaseUrl;
|
|
1597
|
+
oauthCallbackPromise;
|
|
1597
1598
|
server;
|
|
1598
1599
|
constructor(config) {
|
|
1599
1600
|
this.transport = new HttpSessionTransport({
|
|
@@ -1637,6 +1638,7 @@ class MCPClientBase {
|
|
|
1637
1638
|
}
|
|
1638
1639
|
}
|
|
1639
1640
|
const providers = this.integrations.filter((p) => p.oauth).map((p) => p.oauth.provider);
|
|
1641
|
+
const hasOAuthCallback = typeof window !== "undefined" && window.location && window.location.hash && window.location.hash.includes("oauth_callback=");
|
|
1640
1642
|
const usingDatabaseCallbacks = !!config.getProviderToken;
|
|
1641
1643
|
if (usingDatabaseCallbacks) {
|
|
1642
1644
|
this.oauthManager.loadAllProviderTokens(providers).then(async () => {
|
|
@@ -1662,14 +1664,18 @@ class MCPClientBase {
|
|
|
1662
1664
|
console.error("Failed to load provider tokens:", error);
|
|
1663
1665
|
});
|
|
1664
1666
|
} else {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1667
|
+
if (!hasOAuthCallback) {
|
|
1668
|
+
this.oauthManager.loadAllProviderTokensSync(providers);
|
|
1669
|
+
for (const integration of this.integrations) {
|
|
1670
|
+
if (integration.oauth) {
|
|
1671
|
+
const provider = integration.oauth.provider;
|
|
1672
|
+
const tokenData = this.oauthManager.getProviderTokenFromCache(provider);
|
|
1673
|
+
if (tokenData) {
|
|
1674
|
+
this.authState.set(provider, { authenticated: true });
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1671
1677
|
}
|
|
1672
|
-
}
|
|
1678
|
+
} else {}
|
|
1673
1679
|
}
|
|
1674
1680
|
const integrationIds = this.integrations.map((i) => i.id);
|
|
1675
1681
|
if (integrationIds.includes("github")) {
|
|
@@ -1678,6 +1684,9 @@ class MCPClientBase {
|
|
|
1678
1684
|
if (integrationIds.includes("gmail")) {
|
|
1679
1685
|
this.gmail = this.createIntegrationProxy("gmail");
|
|
1680
1686
|
}
|
|
1687
|
+
if (integrationIds.includes("notion")) {
|
|
1688
|
+
this.notion = this.createIntegrationProxy("notion");
|
|
1689
|
+
}
|
|
1681
1690
|
this.server = this.createServerProxy();
|
|
1682
1691
|
this.initializeIntegrations();
|
|
1683
1692
|
}
|
|
@@ -1978,10 +1987,18 @@ class MCPClientBase {
|
|
|
1978
1987
|
isProviderAuthenticated(provider) {
|
|
1979
1988
|
return this.authState.get(provider)?.authenticated ?? false;
|
|
1980
1989
|
}
|
|
1981
|
-
isAuthorized(provider) {
|
|
1990
|
+
async isAuthorized(provider) {
|
|
1991
|
+
if (this.oauthCallbackPromise) {
|
|
1992
|
+
await this.oauthCallbackPromise;
|
|
1993
|
+
this.oauthCallbackPromise = null;
|
|
1994
|
+
}
|
|
1982
1995
|
return this.authState.get(provider)?.authenticated ?? false;
|
|
1983
1996
|
}
|
|
1984
|
-
authorizedProviders() {
|
|
1997
|
+
async authorizedProviders() {
|
|
1998
|
+
if (this.oauthCallbackPromise) {
|
|
1999
|
+
await this.oauthCallbackPromise;
|
|
2000
|
+
this.oauthCallbackPromise = null;
|
|
2001
|
+
}
|
|
1985
2002
|
const authorized = [];
|
|
1986
2003
|
for (const integration of this.integrations) {
|
|
1987
2004
|
if (integration.oauth) {
|
package/dist/src/client.d.ts
CHANGED
|
@@ -60,6 +60,11 @@ export declare class MCPClientBase<TIntegrations extends readonly MCPIntegration
|
|
|
60
60
|
private eventEmitter;
|
|
61
61
|
private apiRouteBase;
|
|
62
62
|
private apiBaseUrl?;
|
|
63
|
+
/**
|
|
64
|
+
* Promise that resolves when OAuth callback processing is complete
|
|
65
|
+
* @internal Used by createMCPClient to store callback promise
|
|
66
|
+
*/
|
|
67
|
+
oauthCallbackPromise?: Promise<void> | null;
|
|
63
68
|
readonly server: ServerIntegrationClient;
|
|
64
69
|
constructor(config: MCPClientConfig<TIntegrations>);
|
|
65
70
|
/**
|
|
@@ -266,29 +271,34 @@ export declare class MCPClientBase<TIntegrations extends readonly MCPIntegration
|
|
|
266
271
|
* Returns the cached authorization status that is automatically updated when
|
|
267
272
|
* authorize() or disconnectProvider() are called
|
|
268
273
|
*
|
|
274
|
+
* Automatically waits for any pending OAuth callback to complete, ensuring
|
|
275
|
+
* the auth state is always up-to-date, even immediately after OAuth redirects
|
|
276
|
+
*
|
|
269
277
|
* @param provider - Provider name (github, gmail, etc.)
|
|
270
|
-
* @returns
|
|
278
|
+
* @returns Promise that resolves to authorization status
|
|
271
279
|
*
|
|
272
280
|
* @example
|
|
273
281
|
* ```typescript
|
|
274
|
-
* const isAuthorized = client.isAuthorized('github');
|
|
282
|
+
* const isAuthorized = await client.isAuthorized('github');
|
|
275
283
|
* if (!isAuthorized) {
|
|
276
284
|
* await client.authorize('github');
|
|
277
285
|
* // isAuthorized is now automatically true
|
|
278
|
-
* console.log(client.isAuthorized('github')); // true
|
|
286
|
+
* console.log(await client.isAuthorized('github')); // true
|
|
279
287
|
* }
|
|
280
288
|
* ```
|
|
281
289
|
*/
|
|
282
|
-
isAuthorized(provider: string): boolean
|
|
290
|
+
isAuthorized(provider: string): Promise<boolean>;
|
|
283
291
|
/**
|
|
284
292
|
* Get list of all authorized providers
|
|
285
293
|
* Returns cached authorization status for all configured OAuth providers
|
|
286
294
|
*
|
|
287
|
-
*
|
|
295
|
+
* Automatically waits for any pending OAuth callback to complete
|
|
296
|
+
*
|
|
297
|
+
* @returns Promise that resolves to array of authorized provider names
|
|
288
298
|
*
|
|
289
299
|
* @example
|
|
290
300
|
* ```typescript
|
|
291
|
-
* const authorized = client.authorizedProviders();
|
|
301
|
+
* const authorized = await client.authorizedProviders();
|
|
292
302
|
* console.log('Authorized services:', authorized); // ['github', 'gmail']
|
|
293
303
|
*
|
|
294
304
|
* // Check if specific service is in the list
|
|
@@ -297,7 +307,7 @@ export declare class MCPClientBase<TIntegrations extends readonly MCPIntegration
|
|
|
297
307
|
* }
|
|
298
308
|
* ```
|
|
299
309
|
*/
|
|
300
|
-
authorizedProviders(): string[]
|
|
310
|
+
authorizedProviders(): Promise<string[]>;
|
|
301
311
|
/**
|
|
302
312
|
* Get detailed authorization status for a provider
|
|
303
313
|
*
|
package/dist/src/client.d.ts.map
CHANGED
|
@@ -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,EAGpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAiB,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACrG,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E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AAG,OAAO,CAAC,IAAI,CAAC;IAuBrE;;;;;;;OAOG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,kBAAkB,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAIjI;;;;;;;OAOG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,kBAAkB,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtI;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAW9C;;;OAGG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CA2BzD;AAmED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,eAAe,CAAC,aAAa,SAAS,SAAS,cAAc,EAAE,EAC7E,MAAM,EAAE,eAAe,CAAC,aAAa,CAAC,GACrC,SAAS,CAAC,aAAa,CAAC,CAmE1B;AAoGD;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAetD"}
|
|
@@ -27,56 +27,6 @@ export interface GitHubIntegrationConfig {
|
|
|
27
27
|
* These should match the tool names exposed by your MCP server
|
|
28
28
|
*/
|
|
29
29
|
declare const GITHUB_TOOLS: readonly ["github_create_issue", "github_list_issues", "github_get_issue", "github_update_issue", "github_close_issue", "github_create_pull_request", "github_list_pull_requests", "github_get_pull_request", "github_merge_pull_request", "github_list_repos", "github_list_own_repos", "github_get_repo", "github_create_repo", "github_list_branches", "github_create_branch", "github_get_user", "github_list_commits", "github_get_commit"];
|
|
30
|
-
/**
|
|
31
|
-
* GitHub Integration
|
|
32
|
-
*
|
|
33
|
-
* Enables GitHub integration with OAuth authentication.
|
|
34
|
-
*
|
|
35
|
-
* By default, reads GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET from environment variables.
|
|
36
|
-
* You can override these by providing explicit values in the config.
|
|
37
|
-
*
|
|
38
|
-
* @example Server-side (minimal - uses env vars):
|
|
39
|
-
* ```typescript
|
|
40
|
-
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
41
|
-
*
|
|
42
|
-
* // Automatically uses GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET from env
|
|
43
|
-
* export const { client } = createMCPServer({
|
|
44
|
-
* integrations: [
|
|
45
|
-
* githubIntegration({
|
|
46
|
-
* scopes: ['repo', 'user', 'read:org'],
|
|
47
|
-
* }),
|
|
48
|
-
* ],
|
|
49
|
-
* });
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* @example Server-side (with explicit override):
|
|
53
|
-
* ```typescript
|
|
54
|
-
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
55
|
-
*
|
|
56
|
-
* export const { client } = createMCPServer({
|
|
57
|
-
* integrations: [
|
|
58
|
-
* githubIntegration({
|
|
59
|
-
* clientId: process.env.CUSTOM_GITHUB_ID!,
|
|
60
|
-
* clientSecret: process.env.CUSTOM_GITHUB_SECRET!,
|
|
61
|
-
* scopes: ['repo', 'user', 'read:org'],
|
|
62
|
-
* }),
|
|
63
|
-
* ],
|
|
64
|
-
* });
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* @example Client-side (without secrets):
|
|
68
|
-
* ```typescript
|
|
69
|
-
* import { createMCPClient, githubIntegration } from 'integrate-sdk';
|
|
70
|
-
*
|
|
71
|
-
* const client = createMCPClient({
|
|
72
|
-
* integrations: [
|
|
73
|
-
* githubIntegration({
|
|
74
|
-
* scopes: ['repo', 'user', 'read:org'],
|
|
75
|
-
* }),
|
|
76
|
-
* ],
|
|
77
|
-
* });
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
30
|
export declare function githubIntegration(config?: GitHubIntegrationConfig): MCPIntegration<"github">;
|
|
81
31
|
/**
|
|
82
32
|
* Export tool names for type inference
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/integrations/github.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAG9D;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,QAAA,MAAM,YAAY,kbAmBR,CAAC;
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/integrations/github.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAG9D;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,QAAA,MAAM,YAAY,kbAmBR,CAAC;AAGX,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,uBAA4B,GAAG,cAAc,CAAC,QAAQ,CAAC,CA0BhG;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAEtD;;GAEG;AACH,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -3,13 +3,6 @@
|
|
|
3
3
|
* Enables Notion tools with OAuth configuration
|
|
4
4
|
*/
|
|
5
5
|
import type { MCPIntegration } from "./types.js";
|
|
6
|
-
/**
|
|
7
|
-
* Notion integration configuration
|
|
8
|
-
*
|
|
9
|
-
* SERVER-SIDE: Automatically reads NOTION_CLIENT_ID and NOTION_CLIENT_SECRET from environment.
|
|
10
|
-
* You can override by providing explicit clientId and clientSecret values.
|
|
11
|
-
* CLIENT-SIDE: Omit clientId and clientSecret when using createMCPClient()
|
|
12
|
-
*/
|
|
13
6
|
export interface NotionIntegrationConfig {
|
|
14
7
|
/** Notion OAuth client ID (defaults to NOTION_CLIENT_ID env var) */
|
|
15
8
|
clientId?: string;
|
|
@@ -42,43 +35,6 @@ declare const NOTION_TOOLS: readonly ["notion_search", "notion_get_page"];
|
|
|
42
35
|
* - Requires an 'owner' parameter ('user' or 'workspace')
|
|
43
36
|
* - Does not use traditional OAuth scopes
|
|
44
37
|
*
|
|
45
|
-
* @example Server-side (minimal - uses env vars):
|
|
46
|
-
* ```typescript
|
|
47
|
-
* import { createMCPServer, notionIntegration } from 'integrate-sdk/server';
|
|
48
|
-
*
|
|
49
|
-
* // Automatically uses NOTION_CLIENT_ID and NOTION_CLIENT_SECRET from env
|
|
50
|
-
* export const { client } = createMCPServer({
|
|
51
|
-
* integrations: [
|
|
52
|
-
* notionIntegration(),
|
|
53
|
-
* ],
|
|
54
|
-
* });
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* @example Server-side (with explicit override):
|
|
58
|
-
* ```typescript
|
|
59
|
-
* import { createMCPServer, notionIntegration } from 'integrate-sdk/server';
|
|
60
|
-
*
|
|
61
|
-
* export const { client } = createMCPServer({
|
|
62
|
-
* integrations: [
|
|
63
|
-
* notionIntegration({
|
|
64
|
-
* clientId: process.env.NOTION_CLIENT_ID!,
|
|
65
|
-
* clientSecret: process.env.NOTION_CLIENT_SECRET!,
|
|
66
|
-
* owner: 'workspace', // or 'user' (default)
|
|
67
|
-
* }),
|
|
68
|
-
* ],
|
|
69
|
-
* });
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @example Client-side (without secrets):
|
|
73
|
-
* ```typescript
|
|
74
|
-
* import { createMCPClient, notionIntegration } from 'integrate-sdk';
|
|
75
|
-
*
|
|
76
|
-
* const client = createMCPClient({
|
|
77
|
-
* integrations: [
|
|
78
|
-
* notionIntegration(),
|
|
79
|
-
* ],
|
|
80
|
-
* });
|
|
81
|
-
* ```
|
|
82
38
|
*/
|
|
83
39
|
export declare function notionIntegration(config?: NotionIntegrationConfig): MCPIntegration<"notion">;
|
|
84
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notion.d.ts","sourceRoot":"","sources":["../../../src/integrations/notion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"notion.d.ts","sourceRoot":"","sources":["../../../src/integrations/notion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAE9D,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CAC9B;AAED;;;GAGG;AACH,QAAA,MAAM,YAAY,+CAGR,CAAC;AAEX;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,uBAA4B,GAAG,cAAc,CAAC,QAAQ,CAAC,CA4BhG;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAEtD;;GAEG;AACH,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC"}
|