integrate-sdk 0.7.44 → 0.7.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/index.js +23 -23
- package/dist/adapters/solid-start.js +23 -23
- package/dist/adapters/svelte-kit.js +23 -23
- package/dist/ai/index.js +4 -1
- package/dist/ai/vercel-ai.d.ts +6 -2
- package/dist/ai/vercel-ai.d.ts.map +1 -1
- package/dist/ai/vercel-ai.js +4 -1
- package/dist/index.js +23 -23
- package/dist/server.js +27 -24
- package/dist/src/ai/vercel-ai.d.ts +6 -2
- package/dist/src/ai/vercel-ai.d.ts.map +1 -1
- package/dist/src/client.d.ts +6 -4
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +50 -8
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/oauth/manager.d.ts +13 -4
- package/dist/src/oauth/manager.d.ts.map +1 -1
- package/dist/src/server.d.ts +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/adapters/index.js
CHANGED
|
@@ -1226,10 +1226,10 @@ class OAuthManager {
|
|
|
1226
1226
|
this.providerTokens.delete(provider);
|
|
1227
1227
|
this.clearProviderToken(provider);
|
|
1228
1228
|
}
|
|
1229
|
-
async getProviderToken(provider) {
|
|
1229
|
+
async getProviderToken(provider, context) {
|
|
1230
1230
|
if (this.getTokenCallback) {
|
|
1231
1231
|
try {
|
|
1232
|
-
const tokenData = await this.getTokenCallback(provider);
|
|
1232
|
+
const tokenData = await this.getTokenCallback(provider, context);
|
|
1233
1233
|
if (tokenData) {
|
|
1234
1234
|
this.providerTokens.set(provider, tokenData);
|
|
1235
1235
|
}
|
|
@@ -1244,9 +1244,9 @@ class OAuthManager {
|
|
|
1244
1244
|
getAllProviderTokens() {
|
|
1245
1245
|
return new Map(this.providerTokens);
|
|
1246
1246
|
}
|
|
1247
|
-
async setProviderToken(provider, tokenData) {
|
|
1247
|
+
async setProviderToken(provider, tokenData, context) {
|
|
1248
1248
|
this.providerTokens.set(provider, tokenData);
|
|
1249
|
-
await this.saveProviderToken(provider, tokenData);
|
|
1249
|
+
await this.saveProviderToken(provider, tokenData, context);
|
|
1250
1250
|
}
|
|
1251
1251
|
clearProviderToken(provider) {
|
|
1252
1252
|
this.providerTokens.delete(provider);
|
|
@@ -1289,10 +1289,10 @@ class OAuthManager {
|
|
|
1289
1289
|
}
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
|
-
async saveProviderToken(provider, tokenData) {
|
|
1292
|
+
async saveProviderToken(provider, tokenData, context) {
|
|
1293
1293
|
if (this.setTokenCallback) {
|
|
1294
1294
|
try {
|
|
1295
|
-
await this.setTokenCallback(provider, tokenData);
|
|
1295
|
+
await this.setTokenCallback(provider, tokenData, context);
|
|
1296
1296
|
} catch (error) {
|
|
1297
1297
|
console.error(`Failed to save token for ${provider} via callback:`, error);
|
|
1298
1298
|
throw error;
|
|
@@ -1579,9 +1579,9 @@ class MCPClientBase {
|
|
|
1579
1579
|
}
|
|
1580
1580
|
return new Proxy({}, {
|
|
1581
1581
|
get: (_target, methodName) => {
|
|
1582
|
-
return async (args) => {
|
|
1582
|
+
return async (args, options) => {
|
|
1583
1583
|
const toolName = methodToToolName(methodName, integrationId);
|
|
1584
|
-
return await this.callToolWithRetry(toolName, args, 0);
|
|
1584
|
+
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
1585
1585
|
};
|
|
1586
1586
|
}
|
|
1587
1587
|
});
|
|
@@ -1589,17 +1589,17 @@ class MCPClientBase {
|
|
|
1589
1589
|
createServerProxy() {
|
|
1590
1590
|
return new Proxy({}, {
|
|
1591
1591
|
get: (_target, methodName) => {
|
|
1592
|
-
return async (args) => {
|
|
1592
|
+
return async (args, options) => {
|
|
1593
1593
|
const toolName = methodToToolName(methodName, "");
|
|
1594
1594
|
const finalToolName = toolName.startsWith("_") ? toolName.substring(1) : toolName;
|
|
1595
|
-
return await this.callServerToolInternal(finalToolName, args);
|
|
1595
|
+
return await this.callServerToolInternal(finalToolName, args, options);
|
|
1596
1596
|
};
|
|
1597
1597
|
}
|
|
1598
1598
|
});
|
|
1599
1599
|
}
|
|
1600
|
-
async callServerToolInternal(name, args) {
|
|
1600
|
+
async callServerToolInternal(name, args, options) {
|
|
1601
1601
|
try {
|
|
1602
|
-
const response = await this.callToolThroughHandler(name, args);
|
|
1602
|
+
const response = await this.callToolThroughHandler(name, args, undefined, options);
|
|
1603
1603
|
return response;
|
|
1604
1604
|
} catch (error) {
|
|
1605
1605
|
const parsedError = parseServerError(error, { toolName: name });
|
|
@@ -1648,8 +1648,8 @@ class MCPClientBase {
|
|
|
1648
1648
|
const enabledTools = response.tools.filter((tool) => this.enabledToolNames.has(tool.name));
|
|
1649
1649
|
console.log(`Discovered ${response.tools.length} tools, ${enabledTools.length} enabled by integrations`);
|
|
1650
1650
|
}
|
|
1651
|
-
async _callToolByName(name, args) {
|
|
1652
|
-
return await this.callToolWithRetry(name, args, 0);
|
|
1651
|
+
async _callToolByName(name, args, options) {
|
|
1652
|
+
return await this.callToolWithRetry(name, args, 0, options);
|
|
1653
1653
|
}
|
|
1654
1654
|
async callServerTool(name, args) {
|
|
1655
1655
|
try {
|
|
@@ -1660,12 +1660,12 @@ class MCPClientBase {
|
|
|
1660
1660
|
throw parsedError;
|
|
1661
1661
|
}
|
|
1662
1662
|
}
|
|
1663
|
-
async callToolThroughHandler(name, args, provider) {
|
|
1663
|
+
async callToolThroughHandler(name, args, provider, options) {
|
|
1664
1664
|
const transportHeaders = this.transport.headers || {};
|
|
1665
1665
|
const hasApiKey = !!transportHeaders["X-API-KEY"];
|
|
1666
1666
|
if (hasApiKey) {
|
|
1667
1667
|
if (provider) {
|
|
1668
|
-
const tokenData = await this.oauthManager.getProviderToken(provider);
|
|
1668
|
+
const tokenData = await this.oauthManager.getProviderToken(provider, options?.context);
|
|
1669
1669
|
if (tokenData && this.transport.setHeader) {
|
|
1670
1670
|
const previousAuthHeader = transportHeaders["Authorization"];
|
|
1671
1671
|
try {
|
|
@@ -1695,7 +1695,7 @@ class MCPClientBase {
|
|
|
1695
1695
|
"Content-Type": "application/json"
|
|
1696
1696
|
};
|
|
1697
1697
|
if (provider) {
|
|
1698
|
-
const tokenData = await this.oauthManager.getProviderToken(provider);
|
|
1698
|
+
const tokenData = await this.oauthManager.getProviderToken(provider, options?.context);
|
|
1699
1699
|
if (tokenData) {
|
|
1700
1700
|
headers["Authorization"] = `Bearer ${tokenData.accessToken}`;
|
|
1701
1701
|
}
|
|
@@ -1733,13 +1733,13 @@ class MCPClientBase {
|
|
|
1733
1733
|
const result = await response.json();
|
|
1734
1734
|
return result;
|
|
1735
1735
|
}
|
|
1736
|
-
async callToolWithRetry(name, args, retryCount = 0) {
|
|
1736
|
+
async callToolWithRetry(name, args, retryCount = 0, options) {
|
|
1737
1737
|
if (!this.enabledToolNames.has(name)) {
|
|
1738
1738
|
throw new Error(`Tool "${name}" is not enabled. Enable it by adding the appropriate integration.`);
|
|
1739
1739
|
}
|
|
1740
1740
|
const provider = this.getProviderForTool(name);
|
|
1741
1741
|
try {
|
|
1742
|
-
const response = await this.callToolThroughHandler(name, args, provider);
|
|
1742
|
+
const response = await this.callToolThroughHandler(name, args, provider, options);
|
|
1743
1743
|
if (provider) {
|
|
1744
1744
|
this.authState.set(provider, { authenticated: true });
|
|
1745
1745
|
}
|
|
@@ -1921,11 +1921,11 @@ class MCPClientBase {
|
|
|
1921
1921
|
throw error;
|
|
1922
1922
|
}
|
|
1923
1923
|
}
|
|
1924
|
-
async getProviderToken(provider) {
|
|
1925
|
-
return await this.oauthManager.getProviderToken(provider);
|
|
1924
|
+
async getProviderToken(provider, context) {
|
|
1925
|
+
return await this.oauthManager.getProviderToken(provider, context);
|
|
1926
1926
|
}
|
|
1927
|
-
async setProviderToken(provider, tokenData) {
|
|
1928
|
-
await this.oauthManager.setProviderToken(provider, tokenData);
|
|
1927
|
+
async setProviderToken(provider, tokenData, context) {
|
|
1928
|
+
await this.oauthManager.setProviderToken(provider, tokenData, context);
|
|
1929
1929
|
this.authState.set(provider, { authenticated: true });
|
|
1930
1930
|
}
|
|
1931
1931
|
getAllProviderTokens() {
|
|
@@ -1091,10 +1091,10 @@ class OAuthManager {
|
|
|
1091
1091
|
this.providerTokens.delete(provider);
|
|
1092
1092
|
this.clearProviderToken(provider);
|
|
1093
1093
|
}
|
|
1094
|
-
async getProviderToken(provider) {
|
|
1094
|
+
async getProviderToken(provider, context) {
|
|
1095
1095
|
if (this.getTokenCallback) {
|
|
1096
1096
|
try {
|
|
1097
|
-
const tokenData = await this.getTokenCallback(provider);
|
|
1097
|
+
const tokenData = await this.getTokenCallback(provider, context);
|
|
1098
1098
|
if (tokenData) {
|
|
1099
1099
|
this.providerTokens.set(provider, tokenData);
|
|
1100
1100
|
}
|
|
@@ -1109,9 +1109,9 @@ class OAuthManager {
|
|
|
1109
1109
|
getAllProviderTokens() {
|
|
1110
1110
|
return new Map(this.providerTokens);
|
|
1111
1111
|
}
|
|
1112
|
-
async setProviderToken(provider, tokenData) {
|
|
1112
|
+
async setProviderToken(provider, tokenData, context) {
|
|
1113
1113
|
this.providerTokens.set(provider, tokenData);
|
|
1114
|
-
await this.saveProviderToken(provider, tokenData);
|
|
1114
|
+
await this.saveProviderToken(provider, tokenData, context);
|
|
1115
1115
|
}
|
|
1116
1116
|
clearProviderToken(provider) {
|
|
1117
1117
|
this.providerTokens.delete(provider);
|
|
@@ -1154,10 +1154,10 @@ class OAuthManager {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
1156
|
}
|
|
1157
|
-
async saveProviderToken(provider, tokenData) {
|
|
1157
|
+
async saveProviderToken(provider, tokenData, context) {
|
|
1158
1158
|
if (this.setTokenCallback) {
|
|
1159
1159
|
try {
|
|
1160
|
-
await this.setTokenCallback(provider, tokenData);
|
|
1160
|
+
await this.setTokenCallback(provider, tokenData, context);
|
|
1161
1161
|
} catch (error) {
|
|
1162
1162
|
console.error(`Failed to save token for ${provider} via callback:`, error);
|
|
1163
1163
|
throw error;
|
|
@@ -1444,9 +1444,9 @@ class MCPClientBase {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
return new Proxy({}, {
|
|
1446
1446
|
get: (_target, methodName) => {
|
|
1447
|
-
return async (args) => {
|
|
1447
|
+
return async (args, options) => {
|
|
1448
1448
|
const toolName = methodToToolName(methodName, integrationId);
|
|
1449
|
-
return await this.callToolWithRetry(toolName, args, 0);
|
|
1449
|
+
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
1450
1450
|
};
|
|
1451
1451
|
}
|
|
1452
1452
|
});
|
|
@@ -1454,17 +1454,17 @@ class MCPClientBase {
|
|
|
1454
1454
|
createServerProxy() {
|
|
1455
1455
|
return new Proxy({}, {
|
|
1456
1456
|
get: (_target, methodName) => {
|
|
1457
|
-
return async (args) => {
|
|
1457
|
+
return async (args, options) => {
|
|
1458
1458
|
const toolName = methodToToolName(methodName, "");
|
|
1459
1459
|
const finalToolName = toolName.startsWith("_") ? toolName.substring(1) : toolName;
|
|
1460
|
-
return await this.callServerToolInternal(finalToolName, args);
|
|
1460
|
+
return await this.callServerToolInternal(finalToolName, args, options);
|
|
1461
1461
|
};
|
|
1462
1462
|
}
|
|
1463
1463
|
});
|
|
1464
1464
|
}
|
|
1465
|
-
async callServerToolInternal(name, args) {
|
|
1465
|
+
async callServerToolInternal(name, args, options) {
|
|
1466
1466
|
try {
|
|
1467
|
-
const response = await this.callToolThroughHandler(name, args);
|
|
1467
|
+
const response = await this.callToolThroughHandler(name, args, undefined, options);
|
|
1468
1468
|
return response;
|
|
1469
1469
|
} catch (error) {
|
|
1470
1470
|
const parsedError = parseServerError(error, { toolName: name });
|
|
@@ -1513,8 +1513,8 @@ class MCPClientBase {
|
|
|
1513
1513
|
const enabledTools = response.tools.filter((tool) => this.enabledToolNames.has(tool.name));
|
|
1514
1514
|
console.log(`Discovered ${response.tools.length} tools, ${enabledTools.length} enabled by integrations`);
|
|
1515
1515
|
}
|
|
1516
|
-
async _callToolByName(name, args) {
|
|
1517
|
-
return await this.callToolWithRetry(name, args, 0);
|
|
1516
|
+
async _callToolByName(name, args, options) {
|
|
1517
|
+
return await this.callToolWithRetry(name, args, 0, options);
|
|
1518
1518
|
}
|
|
1519
1519
|
async callServerTool(name, args) {
|
|
1520
1520
|
try {
|
|
@@ -1525,12 +1525,12 @@ class MCPClientBase {
|
|
|
1525
1525
|
throw parsedError;
|
|
1526
1526
|
}
|
|
1527
1527
|
}
|
|
1528
|
-
async callToolThroughHandler(name, args, provider) {
|
|
1528
|
+
async callToolThroughHandler(name, args, provider, options) {
|
|
1529
1529
|
const transportHeaders = this.transport.headers || {};
|
|
1530
1530
|
const hasApiKey = !!transportHeaders["X-API-KEY"];
|
|
1531
1531
|
if (hasApiKey) {
|
|
1532
1532
|
if (provider) {
|
|
1533
|
-
const tokenData = await this.oauthManager.getProviderToken(provider);
|
|
1533
|
+
const tokenData = await this.oauthManager.getProviderToken(provider, options?.context);
|
|
1534
1534
|
if (tokenData && this.transport.setHeader) {
|
|
1535
1535
|
const previousAuthHeader = transportHeaders["Authorization"];
|
|
1536
1536
|
try {
|
|
@@ -1560,7 +1560,7 @@ class MCPClientBase {
|
|
|
1560
1560
|
"Content-Type": "application/json"
|
|
1561
1561
|
};
|
|
1562
1562
|
if (provider) {
|
|
1563
|
-
const tokenData = await this.oauthManager.getProviderToken(provider);
|
|
1563
|
+
const tokenData = await this.oauthManager.getProviderToken(provider, options?.context);
|
|
1564
1564
|
if (tokenData) {
|
|
1565
1565
|
headers["Authorization"] = `Bearer ${tokenData.accessToken}`;
|
|
1566
1566
|
}
|
|
@@ -1598,13 +1598,13 @@ class MCPClientBase {
|
|
|
1598
1598
|
const result = await response.json();
|
|
1599
1599
|
return result;
|
|
1600
1600
|
}
|
|
1601
|
-
async callToolWithRetry(name, args, retryCount = 0) {
|
|
1601
|
+
async callToolWithRetry(name, args, retryCount = 0, options) {
|
|
1602
1602
|
if (!this.enabledToolNames.has(name)) {
|
|
1603
1603
|
throw new Error(`Tool "${name}" is not enabled. Enable it by adding the appropriate integration.`);
|
|
1604
1604
|
}
|
|
1605
1605
|
const provider = this.getProviderForTool(name);
|
|
1606
1606
|
try {
|
|
1607
|
-
const response = await this.callToolThroughHandler(name, args, provider);
|
|
1607
|
+
const response = await this.callToolThroughHandler(name, args, provider, options);
|
|
1608
1608
|
if (provider) {
|
|
1609
1609
|
this.authState.set(provider, { authenticated: true });
|
|
1610
1610
|
}
|
|
@@ -1786,11 +1786,11 @@ class MCPClientBase {
|
|
|
1786
1786
|
throw error;
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
|
-
async getProviderToken(provider) {
|
|
1790
|
-
return await this.oauthManager.getProviderToken(provider);
|
|
1789
|
+
async getProviderToken(provider, context) {
|
|
1790
|
+
return await this.oauthManager.getProviderToken(provider, context);
|
|
1791
1791
|
}
|
|
1792
|
-
async setProviderToken(provider, tokenData) {
|
|
1793
|
-
await this.oauthManager.setProviderToken(provider, tokenData);
|
|
1792
|
+
async setProviderToken(provider, tokenData, context) {
|
|
1793
|
+
await this.oauthManager.setProviderToken(provider, tokenData, context);
|
|
1794
1794
|
this.authState.set(provider, { authenticated: true });
|
|
1795
1795
|
}
|
|
1796
1796
|
getAllProviderTokens() {
|
|
@@ -1091,10 +1091,10 @@ class OAuthManager {
|
|
|
1091
1091
|
this.providerTokens.delete(provider);
|
|
1092
1092
|
this.clearProviderToken(provider);
|
|
1093
1093
|
}
|
|
1094
|
-
async getProviderToken(provider) {
|
|
1094
|
+
async getProviderToken(provider, context) {
|
|
1095
1095
|
if (this.getTokenCallback) {
|
|
1096
1096
|
try {
|
|
1097
|
-
const tokenData = await this.getTokenCallback(provider);
|
|
1097
|
+
const tokenData = await this.getTokenCallback(provider, context);
|
|
1098
1098
|
if (tokenData) {
|
|
1099
1099
|
this.providerTokens.set(provider, tokenData);
|
|
1100
1100
|
}
|
|
@@ -1109,9 +1109,9 @@ class OAuthManager {
|
|
|
1109
1109
|
getAllProviderTokens() {
|
|
1110
1110
|
return new Map(this.providerTokens);
|
|
1111
1111
|
}
|
|
1112
|
-
async setProviderToken(provider, tokenData) {
|
|
1112
|
+
async setProviderToken(provider, tokenData, context) {
|
|
1113
1113
|
this.providerTokens.set(provider, tokenData);
|
|
1114
|
-
await this.saveProviderToken(provider, tokenData);
|
|
1114
|
+
await this.saveProviderToken(provider, tokenData, context);
|
|
1115
1115
|
}
|
|
1116
1116
|
clearProviderToken(provider) {
|
|
1117
1117
|
this.providerTokens.delete(provider);
|
|
@@ -1154,10 +1154,10 @@ class OAuthManager {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
1156
|
}
|
|
1157
|
-
async saveProviderToken(provider, tokenData) {
|
|
1157
|
+
async saveProviderToken(provider, tokenData, context) {
|
|
1158
1158
|
if (this.setTokenCallback) {
|
|
1159
1159
|
try {
|
|
1160
|
-
await this.setTokenCallback(provider, tokenData);
|
|
1160
|
+
await this.setTokenCallback(provider, tokenData, context);
|
|
1161
1161
|
} catch (error) {
|
|
1162
1162
|
console.error(`Failed to save token for ${provider} via callback:`, error);
|
|
1163
1163
|
throw error;
|
|
@@ -1444,9 +1444,9 @@ class MCPClientBase {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
return new Proxy({}, {
|
|
1446
1446
|
get: (_target, methodName) => {
|
|
1447
|
-
return async (args) => {
|
|
1447
|
+
return async (args, options) => {
|
|
1448
1448
|
const toolName = methodToToolName(methodName, integrationId);
|
|
1449
|
-
return await this.callToolWithRetry(toolName, args, 0);
|
|
1449
|
+
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
1450
1450
|
};
|
|
1451
1451
|
}
|
|
1452
1452
|
});
|
|
@@ -1454,17 +1454,17 @@ class MCPClientBase {
|
|
|
1454
1454
|
createServerProxy() {
|
|
1455
1455
|
return new Proxy({}, {
|
|
1456
1456
|
get: (_target, methodName) => {
|
|
1457
|
-
return async (args) => {
|
|
1457
|
+
return async (args, options) => {
|
|
1458
1458
|
const toolName = methodToToolName(methodName, "");
|
|
1459
1459
|
const finalToolName = toolName.startsWith("_") ? toolName.substring(1) : toolName;
|
|
1460
|
-
return await this.callServerToolInternal(finalToolName, args);
|
|
1460
|
+
return await this.callServerToolInternal(finalToolName, args, options);
|
|
1461
1461
|
};
|
|
1462
1462
|
}
|
|
1463
1463
|
});
|
|
1464
1464
|
}
|
|
1465
|
-
async callServerToolInternal(name, args) {
|
|
1465
|
+
async callServerToolInternal(name, args, options) {
|
|
1466
1466
|
try {
|
|
1467
|
-
const response = await this.callToolThroughHandler(name, args);
|
|
1467
|
+
const response = await this.callToolThroughHandler(name, args, undefined, options);
|
|
1468
1468
|
return response;
|
|
1469
1469
|
} catch (error) {
|
|
1470
1470
|
const parsedError = parseServerError(error, { toolName: name });
|
|
@@ -1513,8 +1513,8 @@ class MCPClientBase {
|
|
|
1513
1513
|
const enabledTools = response.tools.filter((tool) => this.enabledToolNames.has(tool.name));
|
|
1514
1514
|
console.log(`Discovered ${response.tools.length} tools, ${enabledTools.length} enabled by integrations`);
|
|
1515
1515
|
}
|
|
1516
|
-
async _callToolByName(name, args) {
|
|
1517
|
-
return await this.callToolWithRetry(name, args, 0);
|
|
1516
|
+
async _callToolByName(name, args, options) {
|
|
1517
|
+
return await this.callToolWithRetry(name, args, 0, options);
|
|
1518
1518
|
}
|
|
1519
1519
|
async callServerTool(name, args) {
|
|
1520
1520
|
try {
|
|
@@ -1525,12 +1525,12 @@ class MCPClientBase {
|
|
|
1525
1525
|
throw parsedError;
|
|
1526
1526
|
}
|
|
1527
1527
|
}
|
|
1528
|
-
async callToolThroughHandler(name, args, provider) {
|
|
1528
|
+
async callToolThroughHandler(name, args, provider, options) {
|
|
1529
1529
|
const transportHeaders = this.transport.headers || {};
|
|
1530
1530
|
const hasApiKey = !!transportHeaders["X-API-KEY"];
|
|
1531
1531
|
if (hasApiKey) {
|
|
1532
1532
|
if (provider) {
|
|
1533
|
-
const tokenData = await this.oauthManager.getProviderToken(provider);
|
|
1533
|
+
const tokenData = await this.oauthManager.getProviderToken(provider, options?.context);
|
|
1534
1534
|
if (tokenData && this.transport.setHeader) {
|
|
1535
1535
|
const previousAuthHeader = transportHeaders["Authorization"];
|
|
1536
1536
|
try {
|
|
@@ -1560,7 +1560,7 @@ class MCPClientBase {
|
|
|
1560
1560
|
"Content-Type": "application/json"
|
|
1561
1561
|
};
|
|
1562
1562
|
if (provider) {
|
|
1563
|
-
const tokenData = await this.oauthManager.getProviderToken(provider);
|
|
1563
|
+
const tokenData = await this.oauthManager.getProviderToken(provider, options?.context);
|
|
1564
1564
|
if (tokenData) {
|
|
1565
1565
|
headers["Authorization"] = `Bearer ${tokenData.accessToken}`;
|
|
1566
1566
|
}
|
|
@@ -1598,13 +1598,13 @@ class MCPClientBase {
|
|
|
1598
1598
|
const result = await response.json();
|
|
1599
1599
|
return result;
|
|
1600
1600
|
}
|
|
1601
|
-
async callToolWithRetry(name, args, retryCount = 0) {
|
|
1601
|
+
async callToolWithRetry(name, args, retryCount = 0, options) {
|
|
1602
1602
|
if (!this.enabledToolNames.has(name)) {
|
|
1603
1603
|
throw new Error(`Tool "${name}" is not enabled. Enable it by adding the appropriate integration.`);
|
|
1604
1604
|
}
|
|
1605
1605
|
const provider = this.getProviderForTool(name);
|
|
1606
1606
|
try {
|
|
1607
|
-
const response = await this.callToolThroughHandler(name, args, provider);
|
|
1607
|
+
const response = await this.callToolThroughHandler(name, args, provider, options);
|
|
1608
1608
|
if (provider) {
|
|
1609
1609
|
this.authState.set(provider, { authenticated: true });
|
|
1610
1610
|
}
|
|
@@ -1786,11 +1786,11 @@ class MCPClientBase {
|
|
|
1786
1786
|
throw error;
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
|
-
async getProviderToken(provider) {
|
|
1790
|
-
return await this.oauthManager.getProviderToken(provider);
|
|
1789
|
+
async getProviderToken(provider, context) {
|
|
1790
|
+
return await this.oauthManager.getProviderToken(provider, context);
|
|
1791
1791
|
}
|
|
1792
|
-
async setProviderToken(provider, tokenData) {
|
|
1793
|
-
await this.oauthManager.setProviderToken(provider, tokenData);
|
|
1792
|
+
async setProviderToken(provider, tokenData, context) {
|
|
1793
|
+
await this.oauthManager.setProviderToken(provider, tokenData, context);
|
|
1794
1794
|
this.authState.set(provider, { authenticated: true });
|
|
1795
1795
|
}
|
|
1796
1796
|
getAllProviderTokens() {
|
package/dist/ai/index.js
CHANGED
|
@@ -4426,7 +4426,10 @@ function convertMCPToolToVercelAI(mcpTool, client, options) {
|
|
|
4426
4426
|
description: mcpTool.description || `Execute ${mcpTool.name}`,
|
|
4427
4427
|
inputSchema: jsonSchemaToZod(mcpTool.inputSchema),
|
|
4428
4428
|
execute: async (args) => {
|
|
4429
|
-
|
|
4429
|
+
if (options?.providerTokens) {
|
|
4430
|
+
return await executeToolWithToken(client, mcpTool.name, args, options);
|
|
4431
|
+
}
|
|
4432
|
+
return await client._callToolByName(mcpTool.name, args, options?.context ? { context: options.context } : undefined);
|
|
4430
4433
|
}
|
|
4431
4434
|
};
|
|
4432
4435
|
}
|
package/dist/ai/vercel-ai.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import type { MCPClient } from "../client.js";
|
|
8
8
|
import type { MCPTool } from "../protocol/messages.js";
|
|
9
|
+
import type { MCPContext } from "../config/types.js";
|
|
9
10
|
import { type AIToolsOptions } from "./utils.js";
|
|
10
11
|
/**
|
|
11
12
|
* Tool definition compatible with Vercel AI SDK v5
|
|
@@ -20,13 +21,15 @@ export interface VercelAITool {
|
|
|
20
21
|
* Options for converting MCP tools to Vercel AI SDK format
|
|
21
22
|
*/
|
|
22
23
|
export interface VercelAIToolsOptions extends AIToolsOptions {
|
|
24
|
+
/** User context for multi-tenant token storage */
|
|
25
|
+
context?: MCPContext;
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* Convert a single MCP tool to Vercel AI SDK format
|
|
26
29
|
*
|
|
27
30
|
* @param mcpTool - The MCP tool definition
|
|
28
31
|
* @param client - The MCP client instance (used for executing the tool)
|
|
29
|
-
* @param options - Optional configuration including provider tokens
|
|
32
|
+
* @param options - Optional configuration including provider tokens and context
|
|
30
33
|
* @returns Vercel AI SDK compatible tool definition
|
|
31
34
|
*/
|
|
32
35
|
export declare function convertMCPToolToVercelAI(mcpTool: MCPTool, client: MCPClient<any>, options?: VercelAIToolsOptions): VercelAITool;
|
|
@@ -109,11 +112,12 @@ export declare function convertMCPToolsToVercelAI(client: MCPClient<any>, option
|
|
|
109
112
|
*
|
|
110
113
|
* export async function POST(req: Request) {
|
|
111
114
|
* const { messages } = await req.json();
|
|
115
|
+
* const userId = await getUserIdFromSession(req);
|
|
112
116
|
*
|
|
113
117
|
* const result = streamText({
|
|
114
118
|
* model: "openai/gpt-4",
|
|
115
119
|
* messages,
|
|
116
|
-
* tools: await getVercelAITools(serverClient), //
|
|
120
|
+
* tools: await getVercelAITools(serverClient, { context: { userId } }), // Pass user context
|
|
117
121
|
* });
|
|
118
122
|
*
|
|
119
123
|
* return result.toUIMessageStreamResponse();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../../src/ai/vercel-ai.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,EAKL,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,OA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AED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,oBAAoB,gCAkB/B"}
|
package/dist/ai/vercel-ai.js
CHANGED
|
@@ -4208,7 +4208,10 @@ function convertMCPToolToVercelAI(mcpTool, client, options) {
|
|
|
4208
4208
|
description: mcpTool.description || `Execute ${mcpTool.name}`,
|
|
4209
4209
|
inputSchema: jsonSchemaToZod(mcpTool.inputSchema),
|
|
4210
4210
|
execute: async (args) => {
|
|
4211
|
-
|
|
4211
|
+
if (options?.providerTokens) {
|
|
4212
|
+
return await executeToolWithToken(client, mcpTool.name, args, options);
|
|
4213
|
+
}
|
|
4214
|
+
return await client._callToolByName(mcpTool.name, args, options?.context ? { context: options.context } : undefined);
|
|
4212
4215
|
}
|
|
4213
4216
|
};
|
|
4214
4217
|
}
|
package/dist/index.js
CHANGED
|
@@ -938,10 +938,10 @@ class OAuthManager {
|
|
|
938
938
|
this.providerTokens.delete(provider);
|
|
939
939
|
this.clearProviderToken(provider);
|
|
940
940
|
}
|
|
941
|
-
async getProviderToken(provider) {
|
|
941
|
+
async getProviderToken(provider, context) {
|
|
942
942
|
if (this.getTokenCallback) {
|
|
943
943
|
try {
|
|
944
|
-
const tokenData = await this.getTokenCallback(provider);
|
|
944
|
+
const tokenData = await this.getTokenCallback(provider, context);
|
|
945
945
|
if (tokenData) {
|
|
946
946
|
this.providerTokens.set(provider, tokenData);
|
|
947
947
|
}
|
|
@@ -956,9 +956,9 @@ class OAuthManager {
|
|
|
956
956
|
getAllProviderTokens() {
|
|
957
957
|
return new Map(this.providerTokens);
|
|
958
958
|
}
|
|
959
|
-
async setProviderToken(provider, tokenData) {
|
|
959
|
+
async setProviderToken(provider, tokenData, context) {
|
|
960
960
|
this.providerTokens.set(provider, tokenData);
|
|
961
|
-
await this.saveProviderToken(provider, tokenData);
|
|
961
|
+
await this.saveProviderToken(provider, tokenData, context);
|
|
962
962
|
}
|
|
963
963
|
clearProviderToken(provider) {
|
|
964
964
|
this.providerTokens.delete(provider);
|
|
@@ -1001,10 +1001,10 @@ class OAuthManager {
|
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
1003
|
}
|
|
1004
|
-
async saveProviderToken(provider, tokenData) {
|
|
1004
|
+
async saveProviderToken(provider, tokenData, context) {
|
|
1005
1005
|
if (this.setTokenCallback) {
|
|
1006
1006
|
try {
|
|
1007
|
-
await this.setTokenCallback(provider, tokenData);
|
|
1007
|
+
await this.setTokenCallback(provider, tokenData, context);
|
|
1008
1008
|
} catch (error) {
|
|
1009
1009
|
console.error(`Failed to save token for ${provider} via callback:`, error);
|
|
1010
1010
|
throw error;
|
|
@@ -1293,9 +1293,9 @@ class MCPClientBase {
|
|
|
1293
1293
|
}
|
|
1294
1294
|
return new Proxy({}, {
|
|
1295
1295
|
get: (_target, methodName) => {
|
|
1296
|
-
return async (args) => {
|
|
1296
|
+
return async (args, options) => {
|
|
1297
1297
|
const toolName = methodToToolName(methodName, integrationId);
|
|
1298
|
-
return await this.callToolWithRetry(toolName, args, 0);
|
|
1298
|
+
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
1299
1299
|
};
|
|
1300
1300
|
}
|
|
1301
1301
|
});
|
|
@@ -1303,17 +1303,17 @@ class MCPClientBase {
|
|
|
1303
1303
|
createServerProxy() {
|
|
1304
1304
|
return new Proxy({}, {
|
|
1305
1305
|
get: (_target, methodName) => {
|
|
1306
|
-
return async (args) => {
|
|
1306
|
+
return async (args, options) => {
|
|
1307
1307
|
const toolName = methodToToolName(methodName, "");
|
|
1308
1308
|
const finalToolName = toolName.startsWith("_") ? toolName.substring(1) : toolName;
|
|
1309
|
-
return await this.callServerToolInternal(finalToolName, args);
|
|
1309
|
+
return await this.callServerToolInternal(finalToolName, args, options);
|
|
1310
1310
|
};
|
|
1311
1311
|
}
|
|
1312
1312
|
});
|
|
1313
1313
|
}
|
|
1314
|
-
async callServerToolInternal(name, args) {
|
|
1314
|
+
async callServerToolInternal(name, args, options) {
|
|
1315
1315
|
try {
|
|
1316
|
-
const response = await this.callToolThroughHandler(name, args);
|
|
1316
|
+
const response = await this.callToolThroughHandler(name, args, undefined, options);
|
|
1317
1317
|
return response;
|
|
1318
1318
|
} catch (error) {
|
|
1319
1319
|
const parsedError = parseServerError(error, { toolName: name });
|
|
@@ -1362,8 +1362,8 @@ class MCPClientBase {
|
|
|
1362
1362
|
const enabledTools = response.tools.filter((tool) => this.enabledToolNames.has(tool.name));
|
|
1363
1363
|
console.log(`Discovered ${response.tools.length} tools, ${enabledTools.length} enabled by integrations`);
|
|
1364
1364
|
}
|
|
1365
|
-
async _callToolByName(name, args) {
|
|
1366
|
-
return await this.callToolWithRetry(name, args, 0);
|
|
1365
|
+
async _callToolByName(name, args, options) {
|
|
1366
|
+
return await this.callToolWithRetry(name, args, 0, options);
|
|
1367
1367
|
}
|
|
1368
1368
|
async callServerTool(name, args) {
|
|
1369
1369
|
try {
|
|
@@ -1374,12 +1374,12 @@ class MCPClientBase {
|
|
|
1374
1374
|
throw parsedError;
|
|
1375
1375
|
}
|
|
1376
1376
|
}
|
|
1377
|
-
async callToolThroughHandler(name, args, provider) {
|
|
1377
|
+
async callToolThroughHandler(name, args, provider, options) {
|
|
1378
1378
|
const transportHeaders = this.transport.headers || {};
|
|
1379
1379
|
const hasApiKey = !!transportHeaders["X-API-KEY"];
|
|
1380
1380
|
if (hasApiKey) {
|
|
1381
1381
|
if (provider) {
|
|
1382
|
-
const tokenData = await this.oauthManager.getProviderToken(provider);
|
|
1382
|
+
const tokenData = await this.oauthManager.getProviderToken(provider, options?.context);
|
|
1383
1383
|
if (tokenData && this.transport.setHeader) {
|
|
1384
1384
|
const previousAuthHeader = transportHeaders["Authorization"];
|
|
1385
1385
|
try {
|
|
@@ -1409,7 +1409,7 @@ class MCPClientBase {
|
|
|
1409
1409
|
"Content-Type": "application/json"
|
|
1410
1410
|
};
|
|
1411
1411
|
if (provider) {
|
|
1412
|
-
const tokenData = await this.oauthManager.getProviderToken(provider);
|
|
1412
|
+
const tokenData = await this.oauthManager.getProviderToken(provider, options?.context);
|
|
1413
1413
|
if (tokenData) {
|
|
1414
1414
|
headers["Authorization"] = `Bearer ${tokenData.accessToken}`;
|
|
1415
1415
|
}
|
|
@@ -1447,13 +1447,13 @@ class MCPClientBase {
|
|
|
1447
1447
|
const result = await response.json();
|
|
1448
1448
|
return result;
|
|
1449
1449
|
}
|
|
1450
|
-
async callToolWithRetry(name, args, retryCount = 0) {
|
|
1450
|
+
async callToolWithRetry(name, args, retryCount = 0, options) {
|
|
1451
1451
|
if (!this.enabledToolNames.has(name)) {
|
|
1452
1452
|
throw new Error(`Tool "${name}" is not enabled. Enable it by adding the appropriate integration.`);
|
|
1453
1453
|
}
|
|
1454
1454
|
const provider = this.getProviderForTool(name);
|
|
1455
1455
|
try {
|
|
1456
|
-
const response = await this.callToolThroughHandler(name, args, provider);
|
|
1456
|
+
const response = await this.callToolThroughHandler(name, args, provider, options);
|
|
1457
1457
|
if (provider) {
|
|
1458
1458
|
this.authState.set(provider, { authenticated: true });
|
|
1459
1459
|
}
|
|
@@ -1635,11 +1635,11 @@ class MCPClientBase {
|
|
|
1635
1635
|
throw error;
|
|
1636
1636
|
}
|
|
1637
1637
|
}
|
|
1638
|
-
async getProviderToken(provider) {
|
|
1639
|
-
return await this.oauthManager.getProviderToken(provider);
|
|
1638
|
+
async getProviderToken(provider, context) {
|
|
1639
|
+
return await this.oauthManager.getProviderToken(provider, context);
|
|
1640
1640
|
}
|
|
1641
|
-
async setProviderToken(provider, tokenData) {
|
|
1642
|
-
await this.oauthManager.setProviderToken(provider, tokenData);
|
|
1641
|
+
async setProviderToken(provider, tokenData, context) {
|
|
1642
|
+
await this.oauthManager.setProviderToken(provider, tokenData, context);
|
|
1643
1643
|
this.authState.set(provider, { authenticated: true });
|
|
1644
1644
|
}
|
|
1645
1645
|
getAllProviderTokens() {
|
package/dist/server.js
CHANGED
|
@@ -931,10 +931,10 @@ class OAuthManager {
|
|
|
931
931
|
this.providerTokens.delete(provider);
|
|
932
932
|
this.clearProviderToken(provider);
|
|
933
933
|
}
|
|
934
|
-
async getProviderToken(provider) {
|
|
934
|
+
async getProviderToken(provider, context) {
|
|
935
935
|
if (this.getTokenCallback) {
|
|
936
936
|
try {
|
|
937
|
-
const tokenData = await this.getTokenCallback(provider);
|
|
937
|
+
const tokenData = await this.getTokenCallback(provider, context);
|
|
938
938
|
if (tokenData) {
|
|
939
939
|
this.providerTokens.set(provider, tokenData);
|
|
940
940
|
}
|
|
@@ -949,9 +949,9 @@ class OAuthManager {
|
|
|
949
949
|
getAllProviderTokens() {
|
|
950
950
|
return new Map(this.providerTokens);
|
|
951
951
|
}
|
|
952
|
-
async setProviderToken(provider, tokenData) {
|
|
952
|
+
async setProviderToken(provider, tokenData, context) {
|
|
953
953
|
this.providerTokens.set(provider, tokenData);
|
|
954
|
-
await this.saveProviderToken(provider, tokenData);
|
|
954
|
+
await this.saveProviderToken(provider, tokenData, context);
|
|
955
955
|
}
|
|
956
956
|
clearProviderToken(provider) {
|
|
957
957
|
this.providerTokens.delete(provider);
|
|
@@ -994,10 +994,10 @@ class OAuthManager {
|
|
|
994
994
|
}
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
|
-
async saveProviderToken(provider, tokenData) {
|
|
997
|
+
async saveProviderToken(provider, tokenData, context) {
|
|
998
998
|
if (this.setTokenCallback) {
|
|
999
999
|
try {
|
|
1000
|
-
await this.setTokenCallback(provider, tokenData);
|
|
1000
|
+
await this.setTokenCallback(provider, tokenData, context);
|
|
1001
1001
|
} catch (error) {
|
|
1002
1002
|
console.error(`Failed to save token for ${provider} via callback:`, error);
|
|
1003
1003
|
throw error;
|
|
@@ -1284,9 +1284,9 @@ class MCPClientBase {
|
|
|
1284
1284
|
}
|
|
1285
1285
|
return new Proxy({}, {
|
|
1286
1286
|
get: (_target, methodName) => {
|
|
1287
|
-
return async (args) => {
|
|
1287
|
+
return async (args, options) => {
|
|
1288
1288
|
const toolName = methodToToolName(methodName, integrationId);
|
|
1289
|
-
return await this.callToolWithRetry(toolName, args, 0);
|
|
1289
|
+
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
1290
1290
|
};
|
|
1291
1291
|
}
|
|
1292
1292
|
});
|
|
@@ -1294,17 +1294,17 @@ class MCPClientBase {
|
|
|
1294
1294
|
createServerProxy() {
|
|
1295
1295
|
return new Proxy({}, {
|
|
1296
1296
|
get: (_target, methodName) => {
|
|
1297
|
-
return async (args) => {
|
|
1297
|
+
return async (args, options) => {
|
|
1298
1298
|
const toolName = methodToToolName(methodName, "");
|
|
1299
1299
|
const finalToolName = toolName.startsWith("_") ? toolName.substring(1) : toolName;
|
|
1300
|
-
return await this.callServerToolInternal(finalToolName, args);
|
|
1300
|
+
return await this.callServerToolInternal(finalToolName, args, options);
|
|
1301
1301
|
};
|
|
1302
1302
|
}
|
|
1303
1303
|
});
|
|
1304
1304
|
}
|
|
1305
|
-
async callServerToolInternal(name, args) {
|
|
1305
|
+
async callServerToolInternal(name, args, options) {
|
|
1306
1306
|
try {
|
|
1307
|
-
const response = await this.callToolThroughHandler(name, args);
|
|
1307
|
+
const response = await this.callToolThroughHandler(name, args, undefined, options);
|
|
1308
1308
|
return response;
|
|
1309
1309
|
} catch (error) {
|
|
1310
1310
|
const parsedError = parseServerError(error, { toolName: name });
|
|
@@ -1353,8 +1353,8 @@ class MCPClientBase {
|
|
|
1353
1353
|
const enabledTools = response.tools.filter((tool) => this.enabledToolNames.has(tool.name));
|
|
1354
1354
|
console.log(`Discovered ${response.tools.length} tools, ${enabledTools.length} enabled by integrations`);
|
|
1355
1355
|
}
|
|
1356
|
-
async _callToolByName(name, args) {
|
|
1357
|
-
return await this.callToolWithRetry(name, args, 0);
|
|
1356
|
+
async _callToolByName(name, args, options) {
|
|
1357
|
+
return await this.callToolWithRetry(name, args, 0, options);
|
|
1358
1358
|
}
|
|
1359
1359
|
async callServerTool(name, args) {
|
|
1360
1360
|
try {
|
|
@@ -1365,12 +1365,12 @@ class MCPClientBase {
|
|
|
1365
1365
|
throw parsedError;
|
|
1366
1366
|
}
|
|
1367
1367
|
}
|
|
1368
|
-
async callToolThroughHandler(name, args, provider) {
|
|
1368
|
+
async callToolThroughHandler(name, args, provider, options) {
|
|
1369
1369
|
const transportHeaders = this.transport.headers || {};
|
|
1370
1370
|
const hasApiKey = !!transportHeaders["X-API-KEY"];
|
|
1371
1371
|
if (hasApiKey) {
|
|
1372
1372
|
if (provider) {
|
|
1373
|
-
const tokenData = await this.oauthManager.getProviderToken(provider);
|
|
1373
|
+
const tokenData = await this.oauthManager.getProviderToken(provider, options?.context);
|
|
1374
1374
|
if (tokenData && this.transport.setHeader) {
|
|
1375
1375
|
const previousAuthHeader = transportHeaders["Authorization"];
|
|
1376
1376
|
try {
|
|
@@ -1400,7 +1400,7 @@ class MCPClientBase {
|
|
|
1400
1400
|
"Content-Type": "application/json"
|
|
1401
1401
|
};
|
|
1402
1402
|
if (provider) {
|
|
1403
|
-
const tokenData = await this.oauthManager.getProviderToken(provider);
|
|
1403
|
+
const tokenData = await this.oauthManager.getProviderToken(provider, options?.context);
|
|
1404
1404
|
if (tokenData) {
|
|
1405
1405
|
headers["Authorization"] = `Bearer ${tokenData.accessToken}`;
|
|
1406
1406
|
}
|
|
@@ -1438,13 +1438,13 @@ class MCPClientBase {
|
|
|
1438
1438
|
const result = await response.json();
|
|
1439
1439
|
return result;
|
|
1440
1440
|
}
|
|
1441
|
-
async callToolWithRetry(name, args, retryCount = 0) {
|
|
1441
|
+
async callToolWithRetry(name, args, retryCount = 0, options) {
|
|
1442
1442
|
if (!this.enabledToolNames.has(name)) {
|
|
1443
1443
|
throw new Error(`Tool "${name}" is not enabled. Enable it by adding the appropriate integration.`);
|
|
1444
1444
|
}
|
|
1445
1445
|
const provider = this.getProviderForTool(name);
|
|
1446
1446
|
try {
|
|
1447
|
-
const response = await this.callToolThroughHandler(name, args, provider);
|
|
1447
|
+
const response = await this.callToolThroughHandler(name, args, provider, options);
|
|
1448
1448
|
if (provider) {
|
|
1449
1449
|
this.authState.set(provider, { authenticated: true });
|
|
1450
1450
|
}
|
|
@@ -1626,11 +1626,11 @@ class MCPClientBase {
|
|
|
1626
1626
|
throw error;
|
|
1627
1627
|
}
|
|
1628
1628
|
}
|
|
1629
|
-
async getProviderToken(provider) {
|
|
1630
|
-
return await this.oauthManager.getProviderToken(provider);
|
|
1629
|
+
async getProviderToken(provider, context) {
|
|
1630
|
+
return await this.oauthManager.getProviderToken(provider, context);
|
|
1631
1631
|
}
|
|
1632
|
-
async setProviderToken(provider, tokenData) {
|
|
1633
|
-
await this.oauthManager.setProviderToken(provider, tokenData);
|
|
1632
|
+
async setProviderToken(provider, tokenData, context) {
|
|
1633
|
+
await this.oauthManager.setProviderToken(provider, tokenData, context);
|
|
1634
1634
|
this.authState.set(provider, { authenticated: true });
|
|
1635
1635
|
}
|
|
1636
1636
|
getAllProviderTokens() {
|
|
@@ -6523,7 +6523,10 @@ function convertMCPToolToVercelAI(mcpTool, client, options) {
|
|
|
6523
6523
|
description: mcpTool.description || `Execute ${mcpTool.name}`,
|
|
6524
6524
|
inputSchema: jsonSchemaToZod(mcpTool.inputSchema),
|
|
6525
6525
|
execute: async (args) => {
|
|
6526
|
-
|
|
6526
|
+
if (options?.providerTokens) {
|
|
6527
|
+
return await executeToolWithToken(client, mcpTool.name, args, options);
|
|
6528
|
+
}
|
|
6529
|
+
return await client._callToolByName(mcpTool.name, args, options?.context ? { context: options.context } : undefined);
|
|
6527
6530
|
}
|
|
6528
6531
|
};
|
|
6529
6532
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import type { MCPClient } from "../client.js";
|
|
8
8
|
import type { MCPTool } from "../protocol/messages.js";
|
|
9
|
+
import type { MCPContext } from "../config/types.js";
|
|
9
10
|
import { type AIToolsOptions } from "./utils.js";
|
|
10
11
|
/**
|
|
11
12
|
* Tool definition compatible with Vercel AI SDK v5
|
|
@@ -20,13 +21,15 @@ export interface VercelAITool {
|
|
|
20
21
|
* Options for converting MCP tools to Vercel AI SDK format
|
|
21
22
|
*/
|
|
22
23
|
export interface VercelAIToolsOptions extends AIToolsOptions {
|
|
24
|
+
/** User context for multi-tenant token storage */
|
|
25
|
+
context?: MCPContext;
|
|
23
26
|
}
|
|
24
27
|
/**
|
|
25
28
|
* Convert a single MCP tool to Vercel AI SDK format
|
|
26
29
|
*
|
|
27
30
|
* @param mcpTool - The MCP tool definition
|
|
28
31
|
* @param client - The MCP client instance (used for executing the tool)
|
|
29
|
-
* @param options - Optional configuration including provider tokens
|
|
32
|
+
* @param options - Optional configuration including provider tokens and context
|
|
30
33
|
* @returns Vercel AI SDK compatible tool definition
|
|
31
34
|
*/
|
|
32
35
|
export declare function convertMCPToolToVercelAI(mcpTool: MCPTool, client: MCPClient<any>, options?: VercelAIToolsOptions): VercelAITool;
|
|
@@ -109,11 +112,12 @@ export declare function convertMCPToolsToVercelAI(client: MCPClient<any>, option
|
|
|
109
112
|
*
|
|
110
113
|
* export async function POST(req: Request) {
|
|
111
114
|
* const { messages } = await req.json();
|
|
115
|
+
* const userId = await getUserIdFromSession(req);
|
|
112
116
|
*
|
|
113
117
|
* const result = streamText({
|
|
114
118
|
* model: "openai/gpt-4",
|
|
115
119
|
* messages,
|
|
116
|
-
* tools: await getVercelAITools(serverClient), //
|
|
120
|
+
* tools: await getVercelAITools(serverClient, { context: { userId } }), // Pass user context
|
|
117
121
|
* });
|
|
118
122
|
*
|
|
119
123
|
* return result.toUIMessageStreamResponse();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../../src/ai/vercel-ai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,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,EAChB,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,YAAY,CAcd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CASrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,oBAAoB,gCAkB/B"}
|
package/dist/src/client.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { MCPTool, MCPToolCallResponse } from "./protocol/messages.js";
|
|
6
6
|
import type { MCPIntegration, OAuthConfig } from "./integrations/types.js";
|
|
7
|
-
import type { MCPClientConfig } from "./config/types.js";
|
|
7
|
+
import type { MCPClientConfig, ToolCallOptions, MCPContext } from "./config/types.js";
|
|
8
8
|
import { type AuthenticationError } from "./errors.js";
|
|
9
9
|
import type { GitHubIntegrationClient } from "./integrations/github-client.js";
|
|
10
10
|
import type { GmailIntegrationClient } from "./integrations/gmail-client.js";
|
|
@@ -104,7 +104,7 @@ export declare class MCPClientBase<TIntegrations extends readonly MCPIntegration
|
|
|
104
104
|
* Used by integrations like Vercel AI that need to map from tool names
|
|
105
105
|
* @internal
|
|
106
106
|
*/
|
|
107
|
-
_callToolByName(name: string, args?: Record<string, unknown
|
|
107
|
+
_callToolByName(name: string, args?: Record<string, unknown>, options?: ToolCallOptions): Promise<MCPToolCallResponse>;
|
|
108
108
|
/**
|
|
109
109
|
* Call any available tool on the server by name, bypassing integration restrictions
|
|
110
110
|
* Useful for server-level tools like 'list_tools_by_integration' that don't belong to a specific integration
|
|
@@ -353,17 +353,19 @@ export declare class MCPClientBase<TIntegrations extends readonly MCPIntegration
|
|
|
353
353
|
* Useful for making direct API calls or storing tokens
|
|
354
354
|
*
|
|
355
355
|
* @param provider - Provider name (e.g., 'github', 'gmail')
|
|
356
|
+
* @param context - Optional user context (userId, organizationId, etc.) for multi-tenant apps
|
|
356
357
|
* @returns Provider token data or undefined if not authorized
|
|
357
358
|
*/
|
|
358
|
-
getProviderToken(provider: string): Promise<import('./oauth/types.js').ProviderTokenData | undefined>;
|
|
359
|
+
getProviderToken(provider: string, context?: MCPContext): Promise<import('./oauth/types.js').ProviderTokenData | undefined>;
|
|
359
360
|
/**
|
|
360
361
|
* Set provider token manually
|
|
361
362
|
* Use this if you have an existing provider token
|
|
362
363
|
*
|
|
363
364
|
* @param provider - Provider name
|
|
364
365
|
* @param tokenData - Provider token data
|
|
366
|
+
* @param context - Optional user context (userId, organizationId, etc.) for multi-tenant apps
|
|
365
367
|
*/
|
|
366
|
-
setProviderToken(provider: string, tokenData: import('./oauth/types.js').ProviderTokenData): Promise<void>;
|
|
368
|
+
setProviderToken(provider: string, tokenData: import('./oauth/types.js').ProviderTokenData, context?: MCPContext): Promise<void>;
|
|
367
369
|
/**
|
|
368
370
|
* Get all provider tokens
|
|
369
371
|
* Returns a map of provider names to access tokens
|
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,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names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GAWG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAetD"}
|
|
@@ -22,6 +22,40 @@ export interface ReauthContext {
|
|
|
22
22
|
* Should return true if re-authentication was successful, false otherwise
|
|
23
23
|
*/
|
|
24
24
|
export type ReauthHandler = (context: ReauthContext) => Promise<boolean> | boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Context passed through tool calls for multi-tenant token storage
|
|
27
|
+
* Contains user-specific identifiers and metadata
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const context: MCPContext = {
|
|
32
|
+
* userId: 'user123',
|
|
33
|
+
* organizationId: 'org456',
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* await client.github.listOwnRepos({ per_page: 5 }, { context });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export interface MCPContext {
|
|
40
|
+
/** Primary user identifier */
|
|
41
|
+
userId?: string;
|
|
42
|
+
/** Organization identifier for multi-org apps */
|
|
43
|
+
organizationId?: string;
|
|
44
|
+
/** Session identifier for session-based tracking */
|
|
45
|
+
sessionId?: string;
|
|
46
|
+
/** Tenant identifier (alternative to organizationId) */
|
|
47
|
+
tenantId?: string;
|
|
48
|
+
/** Allow custom context fields */
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Options passed to tool calls
|
|
53
|
+
* Contains context and other metadata for request processing
|
|
54
|
+
*/
|
|
55
|
+
export interface ToolCallOptions {
|
|
56
|
+
/** User context for multi-tenant token storage */
|
|
57
|
+
context?: MCPContext;
|
|
58
|
+
}
|
|
25
59
|
/**
|
|
26
60
|
* Server-side configuration (extends client config with API key)
|
|
27
61
|
*
|
|
@@ -57,9 +91,10 @@ export interface MCPServerConfig<TIntegrations extends readonly MCPIntegration[]
|
|
|
57
91
|
* Allows storing OAuth provider tokens in your database instead of localStorage
|
|
58
92
|
*
|
|
59
93
|
* When provided, this callback is used exclusively for token retrieval (no localStorage fallback).
|
|
60
|
-
* The callback receives the provider name and
|
|
94
|
+
* The callback receives the provider name and optional context with user identifiers.
|
|
61
95
|
*
|
|
62
96
|
* @param provider - Provider name (e.g., 'github', 'gmail')
|
|
97
|
+
* @param context - Optional user context (userId, organizationId, etc.) for multi-tenant apps
|
|
63
98
|
* @returns Provider token data from your database, or undefined if not found
|
|
64
99
|
*
|
|
65
100
|
* @example
|
|
@@ -69,9 +104,12 @@ export interface MCPServerConfig<TIntegrations extends readonly MCPIntegration[]
|
|
|
69
104
|
*
|
|
70
105
|
* createMCPServer({
|
|
71
106
|
* integrations: [...],
|
|
72
|
-
* getProviderToken: async (provider) => {
|
|
107
|
+
* getProviderToken: async (provider, context) => {
|
|
108
|
+
* const userId = context?.userId;
|
|
109
|
+
* if (!userId) return undefined;
|
|
110
|
+
*
|
|
73
111
|
* const token = await db.tokens.findFirst({
|
|
74
|
-
* where: { provider, userId
|
|
112
|
+
* where: { provider, userId }
|
|
75
113
|
* });
|
|
76
114
|
* return token ? {
|
|
77
115
|
* accessToken: token.accessToken,
|
|
@@ -85,7 +123,7 @@ export interface MCPServerConfig<TIntegrations extends readonly MCPIntegration[]
|
|
|
85
123
|
* });
|
|
86
124
|
* ```
|
|
87
125
|
*/
|
|
88
|
-
getProviderToken?: (provider: string) => Promise<ProviderTokenData | undefined> | ProviderTokenData | undefined;
|
|
126
|
+
getProviderToken?: (provider: string, context?: MCPContext) => Promise<ProviderTokenData | undefined> | ProviderTokenData | undefined;
|
|
89
127
|
/**
|
|
90
128
|
* Custom token storage callback (SERVER-SIDE ONLY)
|
|
91
129
|
* Allows saving OAuth provider tokens to your database
|
|
@@ -95,6 +133,7 @@ export interface MCPServerConfig<TIntegrations extends readonly MCPIntegration[]
|
|
|
95
133
|
*
|
|
96
134
|
* @param provider - Provider name (e.g., 'github', 'gmail')
|
|
97
135
|
* @param tokenData - Token data to store in your database
|
|
136
|
+
* @param context - Optional user context (userId, organizationId, etc.) for multi-tenant apps
|
|
98
137
|
*
|
|
99
138
|
* @example
|
|
100
139
|
* ```typescript
|
|
@@ -103,17 +142,20 @@ export interface MCPServerConfig<TIntegrations extends readonly MCPIntegration[]
|
|
|
103
142
|
*
|
|
104
143
|
* createMCPServer({
|
|
105
144
|
* integrations: [...],
|
|
106
|
-
* setProviderToken: async (provider, tokenData) => {
|
|
145
|
+
* setProviderToken: async (provider, tokenData, context) => {
|
|
146
|
+
* const userId = context?.userId;
|
|
147
|
+
* if (!userId) return;
|
|
148
|
+
*
|
|
107
149
|
* await db.tokens.upsert({
|
|
108
|
-
* where: { provider_userId: { provider, userId
|
|
109
|
-
* create: { provider, userId
|
|
150
|
+
* where: { provider_userId: { provider, userId } },
|
|
151
|
+
* create: { provider, userId, ...tokenData },
|
|
110
152
|
* update: tokenData,
|
|
111
153
|
* });
|
|
112
154
|
* }
|
|
113
155
|
* });
|
|
114
156
|
* ```
|
|
115
157
|
*/
|
|
116
|
-
setProviderToken?: (provider: string, tokenData: ProviderTokenData) => Promise<void> | void;
|
|
158
|
+
setProviderToken?: (provider: string, tokenData: ProviderTokenData, context?: MCPContext) => Promise<void> | void;
|
|
117
159
|
}
|
|
118
160
|
/**
|
|
119
161
|
* Main client configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,KAAK,EAAE,mBAAmB,CAAC;IAC3B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,C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AAC,aAAa,SAAS,SAAS,cAAc,EAAE,IAC3E,aAAa,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,aAAa,SAAS,SAAS,cAAc,EAAE,IAAI;KAC7E,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,IAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;CACnD,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { toNodeHandler, fromNodeHeaders } from "./adapters/node.js";
|
|
|
18
18
|
export { toSolidStartHandler } from "./adapters/solid-start.js";
|
|
19
19
|
export { toSvelteKitHandler, svelteKitHandler } from "./adapters/svelte-kit.js";
|
|
20
20
|
export { toTanStackStartHandler, createTanStackOAuthHandler } from "./adapters/tanstack-start.js";
|
|
21
|
-
export type { MCPClientConfig, ReauthContext, ReauthHandler } from "./config/types.js";
|
|
21
|
+
export type { MCPClientConfig, ReauthContext, ReauthHandler, MCPContext, ToolCallOptions } from "./config/types.js";
|
|
22
22
|
export { IntegrateSDKError, AuthenticationError, AuthorizationError, TokenExpiredError, ConnectionError, ToolCallError, isAuthError, isTokenExpiredError, isAuthorizationError, parseServerError, } from "./errors.js";
|
|
23
23
|
export type { MCPIntegration, OAuthConfig, ExtractIntegrationIds, ExtractIntegrationTools, } from "./integrations/types.js";
|
|
24
24
|
export { githubIntegration } from "./integrations/github.js";
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/E,YAAY,EAAE,qBAAqB,EAAE,MAA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
5
5
|
import type { OAuthConfig } from "../integrations/types.js";
|
|
6
6
|
import type { OAuthFlowConfig, AuthStatus, ProviderTokenData } from "./types.js";
|
|
7
|
+
import type { MCPContext } from "../config/types.js";
|
|
7
8
|
/**
|
|
8
9
|
* OAuth Manager
|
|
9
10
|
* Handles OAuth authorization flows and token management
|
|
@@ -18,8 +19,8 @@ export declare class OAuthManager {
|
|
|
18
19
|
private getTokenCallback?;
|
|
19
20
|
private setTokenCallback?;
|
|
20
21
|
constructor(oauthApiBase: string, flowConfig?: Partial<OAuthFlowConfig>, apiBaseUrl?: string, tokenCallbacks?: {
|
|
21
|
-
getProviderToken?: (provider: string) => Promise<ProviderTokenData | undefined> | ProviderTokenData | undefined;
|
|
22
|
-
setProviderToken?: (provider: string, tokenData: ProviderTokenData) => Promise<void> | void;
|
|
22
|
+
getProviderToken?: (provider: string, context?: MCPContext) => Promise<ProviderTokenData | undefined> | ProviderTokenData | undefined;
|
|
23
|
+
setProviderToken?: (provider: string, tokenData: ProviderTokenData, context?: MCPContext) => Promise<void> | void;
|
|
23
24
|
});
|
|
24
25
|
/**
|
|
25
26
|
* Initiate OAuth authorization flow
|
|
@@ -102,8 +103,10 @@ export declare class OAuthManager {
|
|
|
102
103
|
/**
|
|
103
104
|
* Get provider token data
|
|
104
105
|
* Uses callback if provided, otherwise checks in-memory cache
|
|
106
|
+
* @param provider - Provider name (e.g., 'github', 'gmail')
|
|
107
|
+
* @param context - Optional user context (userId, organizationId, etc.) for multi-tenant apps
|
|
105
108
|
*/
|
|
106
|
-
getProviderToken(provider: string): Promise<ProviderTokenData | undefined>;
|
|
109
|
+
getProviderToken(provider: string, context?: MCPContext): Promise<ProviderTokenData | undefined>;
|
|
107
110
|
/**
|
|
108
111
|
* Get all provider tokens
|
|
109
112
|
*/
|
|
@@ -111,8 +114,11 @@ export declare class OAuthManager {
|
|
|
111
114
|
/**
|
|
112
115
|
* Set provider token (for manual token management)
|
|
113
116
|
* Uses callback if provided, otherwise uses localStorage
|
|
117
|
+
* @param provider - Provider name (e.g., 'github', 'gmail')
|
|
118
|
+
* @param tokenData - Token data to store
|
|
119
|
+
* @param context - Optional user context (userId, organizationId, etc.) for multi-tenant apps
|
|
114
120
|
*/
|
|
115
|
-
setProviderToken(provider: string, tokenData: ProviderTokenData): Promise<void>;
|
|
121
|
+
setProviderToken(provider: string, tokenData: ProviderTokenData, context?: MCPContext): Promise<void>;
|
|
116
122
|
/**
|
|
117
123
|
* Clear specific provider token
|
|
118
124
|
* Note: When using database callbacks, this only clears the in-memory cache.
|
|
@@ -132,6 +138,9 @@ export declare class OAuthManager {
|
|
|
132
138
|
clearAllPendingAuths(): void;
|
|
133
139
|
/**
|
|
134
140
|
* Save provider token to database (via callback) or localStorage
|
|
141
|
+
* @param provider - Provider name (e.g., 'github', 'gmail')
|
|
142
|
+
* @param tokenData - Token data to store
|
|
143
|
+
* @param context - Optional user context (userId, organizationId, etc.) for multi-tenant apps
|
|
135
144
|
*/
|
|
136
145
|
private saveProviderToken;
|
|
137
146
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/oauth/manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EACV,eAAe,EAEf,UAAU,EAGV,iBAAiB,EAClB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/oauth/manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EACV,eAAe,EAEf,UAAU,EAGV,iBAAiB,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAA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AAC;IAYzD;;;;;OAKG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAoBtG;;OAEG;IACH,oBAAoB,IAAI,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAItD;;;;;;OAMG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3G;;;;OAIG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAa1C;;;;OAIG;IACH,sBAAsB,IAAI,IAAI;IAgB9B;;;OAGG;IACH,oBAAoB,IAAI,IAAI;IAwB5B;;;;;OAKG;YACW,iBAAiB;IAuB/B;;;OAGG;YACW,iBAAiB;IA0B/B;;OAEG;IACG,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/D;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAWhC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAelC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAWpC;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAoClC;;;OAGG;YACW,mBAAmB;IAoCjC;;;OAGG;YACW,oBAAoB;IAkClC;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
|
package/dist/src/server.d.ts
CHANGED
|
@@ -114,7 +114,7 @@ export declare function createMCPServer<TIntegrations extends readonly MCPIntegr
|
|
|
114
114
|
}) => Promise<any>;
|
|
115
115
|
};
|
|
116
116
|
export type { MCPIntegration } from './integrations/types.js';
|
|
117
|
-
export type { MCPClientConfig } from './config/types.js';
|
|
117
|
+
export type { MCPClientConfig, MCPContext, ToolCallOptions } from './config/types.js';
|
|
118
118
|
export type { ProviderTokenData } from './oauth/types.js';
|
|
119
119
|
export { githubIntegration } from './integrations/github.js';
|
|
120
120
|
export { gmailIntegration } from './integrations/gmail.js';
|
package/dist/src/server.d.ts.map
CHANGED
|
@@ -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;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAI9D;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,aAAa,SAAS,SAAS,cAAc,EAAE,IAAI,SAAS,CAAC,aAAa,CAAC,GAAG;IACxG,uEAAuE;IACvE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;SAAE,CAAA;KAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtH,qDAAqD;IACrD,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE;QAAE,MAAM,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7G,oDAAoD;IACpD,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE;QAAE,MAAM,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG,OAAO,CAAC;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC7G,CAAC;AA4CF;;;;;;;;;;;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