integrate-sdk 0.7.17 → 0.7.20
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 +30 -30
- package/dist/adapters/solid-start.js +56 -56
- package/dist/adapters/svelte-kit.js +56 -56
- package/dist/index.d.ts +4 -4
- package/dist/index.js +89 -88
- package/dist/server.d.ts +1 -1
- package/dist/server.js +87 -86
- package/dist/src/adapters/svelte-kit.d.ts +6 -6
- package/dist/src/adapters/tanstack-start.d.ts +3 -3
- package/dist/src/{integrations → ai}/anthropic.d.ts +6 -6
- package/dist/src/ai/anthropic.d.ts.map +1 -0
- package/dist/src/{integrations → ai}/cloudflare.d.ts +6 -6
- package/dist/src/ai/cloudflare.d.ts.map +1 -0
- package/dist/src/{integrations → ai}/google.d.ts +6 -6
- package/dist/src/ai/google.d.ts.map +1 -0
- package/dist/src/{integrations → ai}/index.d.ts +4 -4
- package/dist/src/ai/index.d.ts.map +1 -0
- package/dist/src/{integrations → ai}/langchain.d.ts +6 -6
- package/dist/src/ai/langchain.d.ts.map +1 -0
- package/dist/src/{integrations → ai}/llamaindex.d.ts +6 -6
- package/dist/src/ai/llamaindex.d.ts.map +1 -0
- package/dist/src/{integrations → ai}/mastra.d.ts +6 -6
- package/dist/src/ai/mastra.d.ts.map +1 -0
- package/dist/src/{integrations → ai}/openai-agents.d.ts +6 -6
- package/dist/src/ai/openai-agents.d.ts.map +1 -0
- package/dist/src/{integrations → ai}/openai.d.ts +6 -6
- package/dist/src/ai/openai.d.ts.map +1 -0
- package/dist/src/{integrations → ai}/utils.d.ts +1 -1
- package/dist/src/ai/utils.d.ts.map +1 -0
- package/dist/src/{integrations → ai}/vercel-ai.d.ts +4 -4
- package/dist/src/ai/vercel-ai.d.ts.map +1 -0
- package/dist/src/client.d.ts +39 -39
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +24 -24
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +10 -10
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/{plugins → integrations}/generic.d.ts +14 -14
- package/dist/src/integrations/generic.d.ts.map +1 -0
- package/dist/src/{plugins → integrations}/github-client.d.ts +4 -4
- package/dist/src/integrations/github-client.d.ts.map +1 -0
- package/dist/src/{plugins → integrations}/github.d.ts +17 -17
- package/dist/src/integrations/github.d.ts.map +1 -0
- package/dist/src/{plugins → integrations}/gmail-client.d.ts +4 -4
- package/dist/src/integrations/gmail-client.d.ts.map +1 -0
- package/dist/src/{plugins → integrations}/gmail.d.ts +17 -17
- package/dist/src/integrations/gmail.d.ts.map +1 -0
- package/dist/src/{plugins → integrations}/server-client.d.ts +4 -4
- package/dist/src/integrations/server-client.d.ts.map +1 -0
- package/dist/src/{plugins → integrations}/types.d.ts +15 -15
- package/dist/src/integrations/types.d.ts.map +1 -0
- package/dist/src/oauth/manager.d.ts +1 -1
- package/dist/src/oauth/manager.d.ts.map +1 -1
- package/dist/src/react/hooks.d.ts +5 -5
- package/dist/src/server.d.ts +25 -25
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/utils/env.d.ts.map +1 -1
- package/dist/src/utils/naming.d.ts +3 -3
- package/dist/src/utils/naming.d.ts.map +1 -1
- package/index.ts +4 -4
- package/package.json +27 -27
- package/server.ts +1 -1
- package/dist/src/integrations/anthropic.d.ts.map +0 -1
- package/dist/src/integrations/cloudflare.d.ts.map +0 -1
- package/dist/src/integrations/google.d.ts.map +0 -1
- package/dist/src/integrations/index.d.ts.map +0 -1
- package/dist/src/integrations/langchain.d.ts.map +0 -1
- package/dist/src/integrations/llamaindex.d.ts.map +0 -1
- package/dist/src/integrations/mastra.d.ts.map +0 -1
- package/dist/src/integrations/openai-agents.d.ts.map +0 -1
- package/dist/src/integrations/openai.d.ts.map +0 -1
- package/dist/src/integrations/utils.d.ts.map +0 -1
- package/dist/src/integrations/vercel-ai.d.ts.map +0 -1
- package/dist/src/plugins/generic.d.ts.map +0 -1
- package/dist/src/plugins/github-client.d.ts.map +0 -1
- package/dist/src/plugins/github.d.ts.map +0 -1
- package/dist/src/plugins/gmail-client.d.ts.map +0 -1
- package/dist/src/plugins/gmail.d.ts.map +0 -1
- package/dist/src/plugins/server-client.d.ts.map +0 -1
- package/dist/src/plugins/types.d.ts.map +0 -1
package/dist/server.js
CHANGED
|
@@ -631,9 +631,9 @@ init_errors();
|
|
|
631
631
|
function camelToSnake(str) {
|
|
632
632
|
return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
633
633
|
}
|
|
634
|
-
function methodToToolName(methodName,
|
|
634
|
+
function methodToToolName(methodName, integrationId) {
|
|
635
635
|
const snakeCaseMethod = camelToSnake(methodName);
|
|
636
|
-
return `${
|
|
636
|
+
return `${integrationId}_${snakeCaseMethod}`;
|
|
637
637
|
}
|
|
638
638
|
// src/oauth/window-manager.ts
|
|
639
639
|
function isBrowser() {
|
|
@@ -1172,7 +1172,7 @@ var cleanupHandlersRegistered = false;
|
|
|
1172
1172
|
|
|
1173
1173
|
class MCPClient {
|
|
1174
1174
|
transport;
|
|
1175
|
-
|
|
1175
|
+
integrations;
|
|
1176
1176
|
availableTools = new Map;
|
|
1177
1177
|
enabledToolNames = new Set;
|
|
1178
1178
|
initialized = false;
|
|
@@ -1195,17 +1195,17 @@ class MCPClient {
|
|
|
1195
1195
|
const oauthApiBase = config.oauthApiBase || "/api/integrate/oauth";
|
|
1196
1196
|
const defaultRedirectUri = this.getDefaultRedirectUri(oauthApiBase);
|
|
1197
1197
|
this.apiRouteBase = config.apiRouteBase || "/api/integrate";
|
|
1198
|
-
this.
|
|
1199
|
-
if (
|
|
1198
|
+
this.integrations = config.integrations.map((integration) => {
|
|
1199
|
+
if (integration.oauth && !integration.oauth.redirectUri) {
|
|
1200
1200
|
return {
|
|
1201
|
-
...
|
|
1201
|
+
...integration,
|
|
1202
1202
|
oauth: {
|
|
1203
|
-
...
|
|
1203
|
+
...integration.oauth,
|
|
1204
1204
|
redirectUri: defaultRedirectUri
|
|
1205
1205
|
}
|
|
1206
1206
|
};
|
|
1207
1207
|
}
|
|
1208
|
-
return
|
|
1208
|
+
return integration;
|
|
1209
1209
|
});
|
|
1210
1210
|
this.clientInfo = config.clientInfo || {
|
|
1211
1211
|
name: "integrate-sdk",
|
|
@@ -1214,21 +1214,21 @@ class MCPClient {
|
|
|
1214
1214
|
this.onReauthRequired = config.onReauthRequired;
|
|
1215
1215
|
this.maxReauthRetries = config.maxReauthRetries ?? 1;
|
|
1216
1216
|
this.oauthManager = new OAuthManager(oauthApiBase, config.oauthFlow);
|
|
1217
|
-
const providers = this.
|
|
1217
|
+
const providers = this.integrations.filter((p) => p.oauth).map((p) => p.oauth.provider);
|
|
1218
1218
|
this.oauthManager.loadAllProviderTokens(providers);
|
|
1219
|
-
for (const
|
|
1220
|
-
for (const toolName of
|
|
1219
|
+
for (const integration of this.integrations) {
|
|
1220
|
+
for (const toolName of integration.tools) {
|
|
1221
1221
|
this.enabledToolNames.add(toolName);
|
|
1222
1222
|
}
|
|
1223
|
-
if (
|
|
1224
|
-
const hasToken = this.oauthManager.getProviderToken(
|
|
1225
|
-
this.authState.set(
|
|
1223
|
+
if (integration.oauth) {
|
|
1224
|
+
const hasToken = this.oauthManager.getProviderToken(integration.oauth.provider) !== undefined;
|
|
1225
|
+
this.authState.set(integration.oauth.provider, { authenticated: hasToken });
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
1228
|
-
this.github = this.
|
|
1229
|
-
this.gmail = this.
|
|
1228
|
+
this.github = this.createIntegrationProxy("github");
|
|
1229
|
+
this.gmail = this.createIntegrationProxy("gmail");
|
|
1230
1230
|
this.server = this.createServerProxy();
|
|
1231
|
-
this.
|
|
1231
|
+
this.initializeIntegrations();
|
|
1232
1232
|
}
|
|
1233
1233
|
getDefaultRedirectUri(oauthApiBase) {
|
|
1234
1234
|
if (typeof window === "undefined" || !window.location) {
|
|
@@ -1238,11 +1238,11 @@ class MCPClient {
|
|
|
1238
1238
|
const normalizedPath = oauthApiBase.replace(/\/$/, "");
|
|
1239
1239
|
return `${origin}${normalizedPath}/callback`;
|
|
1240
1240
|
}
|
|
1241
|
-
|
|
1241
|
+
createIntegrationProxy(integrationId) {
|
|
1242
1242
|
return new Proxy({}, {
|
|
1243
1243
|
get: (_target, methodName) => {
|
|
1244
1244
|
return async (args) => {
|
|
1245
|
-
const toolName = methodToToolName(methodName,
|
|
1245
|
+
const toolName = methodToToolName(methodName, integrationId);
|
|
1246
1246
|
return await this.callToolWithRetry(toolName, args, 0);
|
|
1247
1247
|
};
|
|
1248
1248
|
}
|
|
@@ -1268,25 +1268,25 @@ class MCPClient {
|
|
|
1268
1268
|
throw parsedError;
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
|
-
async
|
|
1272
|
-
for (const
|
|
1273
|
-
if (
|
|
1274
|
-
await
|
|
1271
|
+
async initializeIntegrations() {
|
|
1272
|
+
for (const integration of this.integrations) {
|
|
1273
|
+
if (integration.onInit) {
|
|
1274
|
+
await integration.onInit(this);
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
async connect() {
|
|
1279
|
-
for (const
|
|
1280
|
-
if (
|
|
1281
|
-
await
|
|
1279
|
+
for (const integration of this.integrations) {
|
|
1280
|
+
if (integration.onBeforeConnect) {
|
|
1281
|
+
await integration.onBeforeConnect(this);
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
1284
1284
|
await this.transport.connect();
|
|
1285
1285
|
await this.initialize();
|
|
1286
1286
|
await this.discoverTools();
|
|
1287
|
-
for (const
|
|
1288
|
-
if (
|
|
1289
|
-
await
|
|
1287
|
+
for (const integration of this.integrations) {
|
|
1288
|
+
if (integration.onAfterConnect) {
|
|
1289
|
+
await integration.onAfterConnect(this);
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
@@ -1308,7 +1308,7 @@ class MCPClient {
|
|
|
1308
1308
|
this.availableTools.set(tool.name, tool);
|
|
1309
1309
|
}
|
|
1310
1310
|
const enabledTools = response.tools.filter((tool) => this.enabledToolNames.has(tool.name));
|
|
1311
|
-
console.log(`Discovered ${response.tools.length} tools, ${enabledTools.length} enabled by
|
|
1311
|
+
console.log(`Discovered ${response.tools.length} tools, ${enabledTools.length} enabled by integrations`);
|
|
1312
1312
|
}
|
|
1313
1313
|
async _callToolByName(name, args) {
|
|
1314
1314
|
return await this.callToolWithRetry(name, args, 0);
|
|
@@ -1368,7 +1368,7 @@ class MCPClient {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
async callToolWithRetry(name, args, retryCount = 0) {
|
|
1370
1370
|
if (!this.enabledToolNames.has(name)) {
|
|
1371
|
-
throw new Error(`Tool "${name}" is not enabled. Enable it by adding the appropriate
|
|
1371
|
+
throw new Error(`Tool "${name}" is not enabled. Enable it by adding the appropriate integration.`);
|
|
1372
1372
|
}
|
|
1373
1373
|
const provider = this.getProviderForTool(name);
|
|
1374
1374
|
try {
|
|
@@ -1401,9 +1401,9 @@ class MCPClient {
|
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
1403
|
getProviderForTool(toolName) {
|
|
1404
|
-
for (const
|
|
1405
|
-
if (
|
|
1406
|
-
return
|
|
1404
|
+
for (const integration of this.integrations) {
|
|
1405
|
+
if (integration.tools.includes(toolName) && integration.oauth) {
|
|
1406
|
+
return integration.oauth.provider;
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
1409
1409
|
return;
|
|
@@ -1420,15 +1420,15 @@ class MCPClient {
|
|
|
1420
1420
|
getEnabledTools() {
|
|
1421
1421
|
return Array.from(this.availableTools.values()).filter((tool) => this.enabledToolNames.has(tool.name));
|
|
1422
1422
|
}
|
|
1423
|
-
getOAuthConfig(
|
|
1424
|
-
const
|
|
1425
|
-
return
|
|
1423
|
+
getOAuthConfig(integrationId) {
|
|
1424
|
+
const integration = this.integrations.find((p) => p.id === integrationId);
|
|
1425
|
+
return integration?.oauth;
|
|
1426
1426
|
}
|
|
1427
1427
|
getAllOAuthConfigs() {
|
|
1428
1428
|
const configs = new Map;
|
|
1429
|
-
for (const
|
|
1430
|
-
if (
|
|
1431
|
-
configs.set(
|
|
1429
|
+
for (const integration of this.integrations) {
|
|
1430
|
+
if (integration.oauth) {
|
|
1431
|
+
configs.set(integration.id, integration.oauth);
|
|
1432
1432
|
}
|
|
1433
1433
|
}
|
|
1434
1434
|
return configs;
|
|
@@ -1446,8 +1446,8 @@ class MCPClient {
|
|
|
1446
1446
|
this.oauthManager.clearAllProviderTokens();
|
|
1447
1447
|
}
|
|
1448
1448
|
async disconnectProvider(provider) {
|
|
1449
|
-
const
|
|
1450
|
-
if (!
|
|
1449
|
+
const integration = this.integrations.find((p) => p.oauth?.provider === provider);
|
|
1450
|
+
if (!integration?.oauth) {
|
|
1451
1451
|
throw new Error(`No OAuth configuration found for provider: ${provider}`);
|
|
1452
1452
|
}
|
|
1453
1453
|
try {
|
|
@@ -1466,17 +1466,17 @@ class MCPClient {
|
|
|
1466
1466
|
this.clearSessionToken();
|
|
1467
1467
|
this.oauthManager.clearAllPendingAuths();
|
|
1468
1468
|
this.authState.clear();
|
|
1469
|
-
for (const
|
|
1470
|
-
if (
|
|
1471
|
-
this.authState.set(
|
|
1469
|
+
for (const integration of this.integrations) {
|
|
1470
|
+
if (integration.oauth) {
|
|
1471
|
+
this.authState.set(integration.oauth.provider, { authenticated: false });
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
1474
|
this.eventEmitter.emit("auth:logout", {});
|
|
1475
1475
|
}
|
|
1476
1476
|
async disconnect() {
|
|
1477
|
-
for (const
|
|
1478
|
-
if (
|
|
1479
|
-
await
|
|
1477
|
+
for (const integration of this.integrations) {
|
|
1478
|
+
if (integration.onDisconnect) {
|
|
1479
|
+
await integration.onDisconnect(this);
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
1482
|
await this.transport.disconnect();
|
|
@@ -1500,11 +1500,11 @@ class MCPClient {
|
|
|
1500
1500
|
}
|
|
1501
1501
|
async authorizedProviders() {
|
|
1502
1502
|
const authorized = [];
|
|
1503
|
-
for (const
|
|
1504
|
-
if (
|
|
1505
|
-
const status = await this.oauthManager.checkAuthStatus(
|
|
1503
|
+
for (const integration of this.integrations) {
|
|
1504
|
+
if (integration.oauth) {
|
|
1505
|
+
const status = await this.oauthManager.checkAuthStatus(integration.oauth.provider);
|
|
1506
1506
|
if (status.authorized) {
|
|
1507
|
-
authorized.push(
|
|
1507
|
+
authorized.push(integration.oauth.provider);
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
1510
1510
|
}
|
|
@@ -1514,15 +1514,15 @@ class MCPClient {
|
|
|
1514
1514
|
return await this.oauthManager.checkAuthStatus(provider);
|
|
1515
1515
|
}
|
|
1516
1516
|
async authorize(provider, options) {
|
|
1517
|
-
const
|
|
1518
|
-
if (!
|
|
1517
|
+
const integration = this.integrations.find((p) => p.oauth?.provider === provider);
|
|
1518
|
+
if (!integration?.oauth) {
|
|
1519
1519
|
const error = new Error(`No OAuth configuration found for provider: ${provider}`);
|
|
1520
1520
|
this.eventEmitter.emit("auth:error", { provider, error });
|
|
1521
1521
|
throw error;
|
|
1522
1522
|
}
|
|
1523
1523
|
this.eventEmitter.emit("auth:started", { provider });
|
|
1524
1524
|
try {
|
|
1525
|
-
await this.oauthManager.initiateFlow(provider,
|
|
1525
|
+
await this.oauthManager.initiateFlow(provider, integration.oauth, options?.returnUrl);
|
|
1526
1526
|
const tokenData = this.oauthManager.getProviderToken(provider);
|
|
1527
1527
|
if (tokenData) {
|
|
1528
1528
|
this.eventEmitter.emit("auth:complete", {
|
|
@@ -1572,7 +1572,7 @@ class MCPClient {
|
|
|
1572
1572
|
async reauthenticate(provider) {
|
|
1573
1573
|
const state = this.authState.get(provider);
|
|
1574
1574
|
if (!state) {
|
|
1575
|
-
throw new Error(`Provider "${provider}" not found in configured
|
|
1575
|
+
throw new Error(`Provider "${provider}" not found in configured integrations`);
|
|
1576
1576
|
}
|
|
1577
1577
|
if (!this.onReauthRequired) {
|
|
1578
1578
|
throw new Error("No re-authentication handler configured. Set onReauthRequired in client config.");
|
|
@@ -1626,7 +1626,7 @@ function generateCacheKey(config) {
|
|
|
1626
1626
|
config.serverUrl || "default",
|
|
1627
1627
|
config.clientInfo?.name || "integrate-sdk",
|
|
1628
1628
|
config.clientInfo?.version || "0.1.0",
|
|
1629
|
-
JSON.stringify(config.
|
|
1629
|
+
JSON.stringify(config.integrations.map((p) => ({ id: p.id, tools: p.tools }))),
|
|
1630
1630
|
JSON.stringify(config.headers || {}),
|
|
1631
1631
|
config.timeout?.toString() || "30000"
|
|
1632
1632
|
];
|
|
@@ -1900,9 +1900,10 @@ function createNextOAuthHandler(config) {
|
|
|
1900
1900
|
// src/utils/env.ts
|
|
1901
1901
|
function getEnv(key) {
|
|
1902
1902
|
try {
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1905
|
-
|
|
1903
|
+
const getImportMeta = new Function('return typeof import.meta !== "undefined" ? import.meta : undefined');
|
|
1904
|
+
const importMeta = getImportMeta();
|
|
1905
|
+
if (importMeta && typeof importMeta.env === "object" && importMeta.env !== null) {
|
|
1906
|
+
const value = importMeta.env[key];
|
|
1906
1907
|
if (value !== undefined && value !== null && value !== "") {
|
|
1907
1908
|
return String(value);
|
|
1908
1909
|
}
|
|
@@ -1917,7 +1918,7 @@ function getEnv(key) {
|
|
|
1917
1918
|
return;
|
|
1918
1919
|
}
|
|
1919
1920
|
|
|
1920
|
-
// src/
|
|
1921
|
+
// src/integrations/github.ts
|
|
1921
1922
|
var GITHUB_TOOLS = [
|
|
1922
1923
|
"github_create_issue",
|
|
1923
1924
|
"github_list_issues",
|
|
@@ -1938,7 +1939,7 @@ var GITHUB_TOOLS = [
|
|
|
1938
1939
|
"github_list_commits",
|
|
1939
1940
|
"github_get_commit"
|
|
1940
1941
|
];
|
|
1941
|
-
function
|
|
1942
|
+
function githubIntegration(config = {}) {
|
|
1942
1943
|
const oauth = {
|
|
1943
1944
|
provider: "github",
|
|
1944
1945
|
clientId: config.clientId ?? getEnv("GITHUB_CLIENT_ID"),
|
|
@@ -1955,21 +1956,21 @@ function githubPlugin(config = {}) {
|
|
|
1955
1956
|
tools: [...GITHUB_TOOLS],
|
|
1956
1957
|
oauth,
|
|
1957
1958
|
async onInit(_client) {
|
|
1958
|
-
console.log("GitHub
|
|
1959
|
+
console.log("GitHub integration initialized");
|
|
1959
1960
|
},
|
|
1960
1961
|
async onAfterConnect(_client) {
|
|
1961
|
-
console.log("GitHub
|
|
1962
|
+
console.log("GitHub integration connected");
|
|
1962
1963
|
}
|
|
1963
1964
|
};
|
|
1964
1965
|
}
|
|
1965
|
-
// src/
|
|
1966
|
+
// src/integrations/gmail.ts
|
|
1966
1967
|
var GMAIL_TOOLS = [
|
|
1967
1968
|
"gmail_send_message",
|
|
1968
1969
|
"gmail_list_messages",
|
|
1969
1970
|
"gmail_get_message",
|
|
1970
1971
|
"gmail_search_messages"
|
|
1971
1972
|
];
|
|
1972
|
-
function
|
|
1973
|
+
function gmailIntegration(config = {}) {
|
|
1973
1974
|
const oauth = {
|
|
1974
1975
|
provider: "gmail",
|
|
1975
1976
|
clientId: config.clientId ?? getEnv("GMAIL_CLIENT_ID"),
|
|
@@ -1988,15 +1989,15 @@ function gmailPlugin(config = {}) {
|
|
|
1988
1989
|
tools: [...GMAIL_TOOLS],
|
|
1989
1990
|
oauth,
|
|
1990
1991
|
async onInit(_client) {
|
|
1991
|
-
console.log("Gmail
|
|
1992
|
+
console.log("Gmail integration initialized");
|
|
1992
1993
|
},
|
|
1993
1994
|
async onAfterConnect(_client) {
|
|
1994
|
-
console.log("Gmail
|
|
1995
|
+
console.log("Gmail integration connected");
|
|
1995
1996
|
}
|
|
1996
1997
|
};
|
|
1997
1998
|
}
|
|
1998
|
-
// src/
|
|
1999
|
-
function
|
|
1999
|
+
// src/integrations/generic.ts
|
|
2000
|
+
function genericOAuthIntegration(config) {
|
|
2000
2001
|
const providerUpper = config.provider.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
2001
2002
|
const oauth = {
|
|
2002
2003
|
provider: config.provider,
|
|
@@ -2015,7 +2016,7 @@ function genericOAuthPlugin(config) {
|
|
|
2015
2016
|
onDisconnect: config.onDisconnect
|
|
2016
2017
|
};
|
|
2017
2018
|
}
|
|
2018
|
-
function
|
|
2019
|
+
function createSimpleIntegration(config) {
|
|
2019
2020
|
return {
|
|
2020
2021
|
id: config.id,
|
|
2021
2022
|
tools: config.tools,
|
|
@@ -2046,28 +2047,28 @@ function createMCPServer(config) {
|
|
|
2046
2047
|
throw new Error("createMCPServer() should only be called on the server-side. " + "Use createMCPClient() for client-side code.");
|
|
2047
2048
|
}
|
|
2048
2049
|
const providers = {};
|
|
2049
|
-
const
|
|
2050
|
-
if (
|
|
2051
|
-
const { clientId, clientSecret, redirectUri:
|
|
2050
|
+
const updatedIntegrations = config.integrations.map((integration) => {
|
|
2051
|
+
if (integration.oauth) {
|
|
2052
|
+
const { clientId, clientSecret, redirectUri: integrationRedirectUri } = integration.oauth;
|
|
2052
2053
|
if (!clientId || !clientSecret) {
|
|
2053
|
-
console.warn(`Warning:
|
|
2054
|
-
return
|
|
2054
|
+
console.warn(`Warning: Integration "${integration.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the integration configuration.`);
|
|
2055
|
+
return integration;
|
|
2055
2056
|
}
|
|
2056
|
-
const redirectUri =
|
|
2057
|
-
providers[
|
|
2057
|
+
const redirectUri = integrationRedirectUri || config.redirectUri || getDefaultRedirectUri();
|
|
2058
|
+
providers[integration.id] = {
|
|
2058
2059
|
clientId,
|
|
2059
2060
|
clientSecret,
|
|
2060
2061
|
redirectUri
|
|
2061
2062
|
};
|
|
2062
2063
|
return {
|
|
2063
|
-
...
|
|
2064
|
+
...integration,
|
|
2064
2065
|
oauth: {
|
|
2065
|
-
...
|
|
2066
|
+
...integration.oauth,
|
|
2066
2067
|
redirectUri
|
|
2067
2068
|
}
|
|
2068
2069
|
};
|
|
2069
2070
|
}
|
|
2070
|
-
return
|
|
2071
|
+
return integration;
|
|
2071
2072
|
});
|
|
2072
2073
|
globalServerConfig = {
|
|
2073
2074
|
providers,
|
|
@@ -2076,7 +2077,7 @@ function createMCPServer(config) {
|
|
|
2076
2077
|
};
|
|
2077
2078
|
const clientConfig = {
|
|
2078
2079
|
...config,
|
|
2079
|
-
|
|
2080
|
+
integrations: updatedIntegrations,
|
|
2080
2081
|
connectionMode: config.connectionMode || "lazy",
|
|
2081
2082
|
singleton: config.singleton ?? true
|
|
2082
2083
|
};
|
|
@@ -2398,10 +2399,10 @@ export {
|
|
|
2398
2399
|
toSvelteKitHandler,
|
|
2399
2400
|
toSolidStartHandler,
|
|
2400
2401
|
toNextJsHandler,
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2402
|
+
gmailIntegration,
|
|
2403
|
+
githubIntegration,
|
|
2404
|
+
genericOAuthIntegration,
|
|
2405
|
+
createSimpleIntegration,
|
|
2405
2406
|
createMCPServer,
|
|
2406
2407
|
POST,
|
|
2407
2408
|
GET
|
|
@@ -18,11 +18,11 @@ type ResolveFunction = any;
|
|
|
18
18
|
* @example
|
|
19
19
|
* ```typescript
|
|
20
20
|
* // lib/integrate-server.ts
|
|
21
|
-
* import { createMCPServer,
|
|
21
|
+
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
22
22
|
*
|
|
23
23
|
* export const { client: serverClient, handler } = createMCPServer({
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* integrations: [
|
|
25
|
+
* githubIntegration({
|
|
26
26
|
* clientId: process.env.GITHUB_CLIENT_ID!,
|
|
27
27
|
* clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
28
28
|
* }),
|
|
@@ -55,11 +55,11 @@ export declare function svelteKitHandler({ authConfig, event, resolve, basePath,
|
|
|
55
55
|
* @example
|
|
56
56
|
* ```typescript
|
|
57
57
|
* // lib/integrate-server.ts
|
|
58
|
-
* import { createMCPServer,
|
|
58
|
+
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
59
59
|
*
|
|
60
60
|
* export const { client: serverClient, handler } = createMCPServer({
|
|
61
|
-
*
|
|
62
|
-
*
|
|
61
|
+
* integrations: [
|
|
62
|
+
* githubIntegration({
|
|
63
63
|
* clientId: process.env.GITHUB_CLIENT_ID!,
|
|
64
64
|
* clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
65
65
|
* }),
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
|
16
16
|
* // lib/integrate-server.ts
|
|
17
|
-
* import { createMCPServer,
|
|
17
|
+
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
18
18
|
*
|
|
19
19
|
* export const { client: serverClient, handler } = createMCPServer({
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* integrations: [
|
|
21
|
+
* githubIntegration({
|
|
22
22
|
* clientId: process.env.GITHUB_CLIENT_ID!,
|
|
23
23
|
* clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
24
24
|
* }),
|
|
@@ -148,12 +148,12 @@ export declare function handleAnthropicToolCalls(client: MCPClient<any>, message
|
|
|
148
148
|
* @example
|
|
149
149
|
* ```typescript
|
|
150
150
|
* // Client-side usage
|
|
151
|
-
* import { createMCPClient,
|
|
152
|
-
* import { getAnthropicTools } from 'integrate-sdk/
|
|
151
|
+
* import { createMCPClient, githubIntegration } from 'integrate-sdk';
|
|
152
|
+
* import { getAnthropicTools } from 'integrate-sdk/ai/anthropic';
|
|
153
153
|
* import Anthropic from '@anthropic-ai/sdk';
|
|
154
154
|
*
|
|
155
155
|
* const client = createMCPClient({
|
|
156
|
-
*
|
|
156
|
+
* integrations: [githubIntegration({ clientId: '...' })],
|
|
157
157
|
* });
|
|
158
158
|
*
|
|
159
159
|
* const tools = await getAnthropicTools(client);
|
|
@@ -170,11 +170,11 @@ export declare function handleAnthropicToolCalls(client: MCPClient<any>, message
|
|
|
170
170
|
* @example
|
|
171
171
|
* ```typescript
|
|
172
172
|
* // Server-side usage with tokens from client
|
|
173
|
-
* import { createMCPServer,
|
|
174
|
-
* import { getAnthropicTools, handleAnthropicToolCalls } from 'integrate-sdk/
|
|
173
|
+
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
174
|
+
* import { getAnthropicTools, handleAnthropicToolCalls } from 'integrate-sdk/ai/anthropic';
|
|
175
175
|
*
|
|
176
176
|
* const { client: serverClient } = createMCPServer({
|
|
177
|
-
*
|
|
177
|
+
* integrations: [githubIntegration({
|
|
178
178
|
* clientId: '...',
|
|
179
179
|
* clientSecret: '...'
|
|
180
180
|
* })],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/ai/anthropic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAA+C,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE9F;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,cAAc;CAAI;AAEjE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,E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Aa,EAAE,CAAC,CAG1B"}
|
|
@@ -96,13 +96,13 @@ export declare function executeCloudflareToolCall(client: MCPClient<any>, toolCa
|
|
|
96
96
|
* @example
|
|
97
97
|
* ```typescript
|
|
98
98
|
* // Cloudflare Worker usage
|
|
99
|
-
* import { createMCPClient,
|
|
100
|
-
* import { getCloudflareTools, executeCloudflareToolCall } from 'integrate-sdk/
|
|
99
|
+
* import { createMCPClient, githubIntegration } from 'integrate-sdk';
|
|
100
|
+
* import { getCloudflareTools, executeCloudflareToolCall } from 'integrate-sdk/ai/cloudflare';
|
|
101
101
|
*
|
|
102
102
|
* export default {
|
|
103
103
|
* async fetch(request: Request, env: Env): Promise<Response> {
|
|
104
104
|
* const client = createMCPClient({
|
|
105
|
-
*
|
|
105
|
+
* integrations: [githubIntegration({ clientId: env.GITHUB_CLIENT_ID })],
|
|
106
106
|
* });
|
|
107
107
|
*
|
|
108
108
|
* const tools = await getCloudflareTools(client);
|
|
@@ -121,11 +121,11 @@ export declare function executeCloudflareToolCall(client: MCPClient<any>, toolCa
|
|
|
121
121
|
* @example
|
|
122
122
|
* ```typescript
|
|
123
123
|
* // Server-side usage with tokens from client
|
|
124
|
-
* import { createMCPServer,
|
|
125
|
-
* import { getCloudflareTools, executeCloudflareToolCall } from 'integrate-sdk/
|
|
124
|
+
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
125
|
+
* import { getCloudflareTools, executeCloudflareToolCall } from 'integrate-sdk/ai/cloudflare';
|
|
126
126
|
*
|
|
127
127
|
* const { client: serverClient } = createMCPServer({
|
|
128
|
-
*
|
|
128
|
+
* integrations: [githubIntegration({
|
|
129
129
|
* clientId: '...',
|
|
130
130
|
* clientSecret: '...'
|
|
131
131
|
* })],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare.d.ts","sourceRoot":"","sources":["../../../src/ai/cloudflare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAGzC"}
|
|
@@ -95,12 +95,12 @@ export declare function executeGoogleFunctionCall(client: MCPClient<any>, functi
|
|
|
95
95
|
* @example
|
|
96
96
|
* ```typescript
|
|
97
97
|
* // Client-side usage
|
|
98
|
-
* import { createMCPClient,
|
|
99
|
-
* import { getGoogleTools } from 'integrate-sdk/
|
|
98
|
+
* import { createMCPClient, githubIntegration } from 'integrate-sdk';
|
|
99
|
+
* import { getGoogleTools } from 'integrate-sdk/ai/google';
|
|
100
100
|
* import { GoogleGenerativeAI } from '@google/generative-ai';
|
|
101
101
|
*
|
|
102
102
|
* const client = createMCPClient({
|
|
103
|
-
*
|
|
103
|
+
* integrations: [githubIntegration({ clientId: '...' })],
|
|
104
104
|
* });
|
|
105
105
|
*
|
|
106
106
|
* const tools = await getGoogleTools(client);
|
|
@@ -118,11 +118,11 @@ export declare function executeGoogleFunctionCall(client: MCPClient<any>, functi
|
|
|
118
118
|
* @example
|
|
119
119
|
* ```typescript
|
|
120
120
|
* // Server-side usage with tokens from client
|
|
121
|
-
* import { createMCPServer,
|
|
122
|
-
* import { getGoogleTools, executeGoogleFunctionCall } from 'integrate-sdk/
|
|
121
|
+
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
122
|
+
* import { getGoogleTools, executeGoogleFunctionCall } from 'integrate-sdk/ai/google';
|
|
123
123
|
*
|
|
124
124
|
* const { client: serverClient } = createMCPServer({
|
|
125
|
-
*
|
|
125
|
+
* integrations: [githubIntegration({
|
|
126
126
|
* clientId: '...',
|
|
127
127
|
* clientSecret: '...'
|
|
128
128
|
* })],
|
|
@@ -0,0 +1 @@
|
|
|
1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kBAAkB,EAChC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAGjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,UAAU,EAAE,CAAC,CAGvB"}
|
|
@@ -33,11 +33,11 @@ export type AIProviderName = "vercel-ai" | "openai" | "openai-agents" | "anthrop
|
|
|
33
33
|
* @example
|
|
34
34
|
* ```typescript
|
|
35
35
|
* // Dynamic provider selection
|
|
36
|
-
* import { createMCPClient,
|
|
36
|
+
* import { createMCPClient, githubIntegration } from 'integrate-sdk';
|
|
37
37
|
* import { getAITools } from 'integrate-sdk/integrations';
|
|
38
38
|
*
|
|
39
39
|
* const client = createMCPClient({
|
|
40
|
-
*
|
|
40
|
+
* integrations: [githubIntegration({ clientId: '...' })],
|
|
41
41
|
* });
|
|
42
42
|
*
|
|
43
43
|
* // Choose provider at runtime
|
|
@@ -48,11 +48,11 @@ export type AIProviderName = "vercel-ai" | "openai" | "openai-agents" | "anthrop
|
|
|
48
48
|
* @example
|
|
49
49
|
* ```typescript
|
|
50
50
|
* // Server-side with provider tokens
|
|
51
|
-
* import { createMCPServer,
|
|
51
|
+
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
52
52
|
* import { getAITools } from 'integrate-sdk/integrations';
|
|
53
53
|
*
|
|
54
54
|
* const { client: serverClient } = createMCPServer({
|
|
55
|
-
*
|
|
55
|
+
* integrations: [githubIntegration({
|
|
56
56
|
* clientId: '...',
|
|
57
57
|
* clientSecret: '...'
|
|
58
58
|
* })],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ai/index.ts"],"names":[],"mappings":"AAA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OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEvB,wBAAsB,UAAU,CAC9B,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEvB,wBAAsB,UAAU,CAC9B,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE,YAAY,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AAEhC,wBAAsB,UAAU,CAC9B,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEvB,wBAAsB,UAAU,CAC9B,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE,YAAY,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAEvB,wBAAsB,UAAU,CAC9B,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC"}
|
|
@@ -68,14 +68,14 @@ export declare function convertMCPToolsToLangChain(client: MCPClient<any>, optio
|
|
|
68
68
|
* @example
|
|
69
69
|
* ```typescript
|
|
70
70
|
* // Client-side usage
|
|
71
|
-
* import { createMCPClient,
|
|
72
|
-
* import { getLangChainTools } from 'integrate-sdk/
|
|
71
|
+
* import { createMCPClient, githubIntegration } from 'integrate-sdk';
|
|
72
|
+
* import { getLangChainTools } from 'integrate-sdk/ai/langchain';
|
|
73
73
|
* import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
74
74
|
* import { ChatOpenAI } from '@langchain/openai';
|
|
75
75
|
* import { AgentExecutor, createOpenAIFunctionsAgent } from 'langchain/agents';
|
|
76
76
|
*
|
|
77
77
|
* const client = createMCPClient({
|
|
78
|
-
*
|
|
78
|
+
* integrations: [githubIntegration({ clientId: '...' })],
|
|
79
79
|
* });
|
|
80
80
|
*
|
|
81
81
|
* const toolConfigs = await getLangChainTools(client);
|
|
@@ -100,11 +100,11 @@ export declare function convertMCPToolsToLangChain(client: MCPClient<any>, optio
|
|
|
100
100
|
* @example
|
|
101
101
|
* ```typescript
|
|
102
102
|
* // Server-side usage with tokens from client
|
|
103
|
-
* import { createMCPServer,
|
|
104
|
-
* import { getLangChainTools } from 'integrate-sdk/
|
|
103
|
+
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
104
|
+
* import { getLangChainTools } from 'integrate-sdk/ai/langchain';
|
|
105
105
|
*
|
|
106
106
|
* const { client: serverClient } = createMCPServer({
|
|
107
|
-
*
|
|
107
|
+
* integrations: [githubIntegration({
|
|
108
108
|
* clientId: '...',
|
|
109
109
|
* clientSecret: '...'
|
|
110
110
|
* })],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain.d.ts","sourceRoot":"","sources":["../../../src/ai/langchain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,M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