integrate-sdk 0.7.18 → 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.
Files changed (79) hide show
  1. package/README.md +30 -30
  2. package/dist/adapters/solid-start.js +56 -56
  3. package/dist/adapters/svelte-kit.js +56 -56
  4. package/dist/index.d.ts +4 -4
  5. package/dist/index.js +85 -85
  6. package/dist/server.d.ts +1 -1
  7. package/dist/server.js +83 -83
  8. package/dist/src/adapters/svelte-kit.d.ts +6 -6
  9. package/dist/src/adapters/tanstack-start.d.ts +3 -3
  10. package/dist/src/{integrations → ai}/anthropic.d.ts +6 -6
  11. package/dist/src/ai/anthropic.d.ts.map +1 -0
  12. package/dist/src/{integrations → ai}/cloudflare.d.ts +6 -6
  13. package/dist/src/ai/cloudflare.d.ts.map +1 -0
  14. package/dist/src/{integrations → ai}/google.d.ts +6 -6
  15. package/dist/src/ai/google.d.ts.map +1 -0
  16. package/dist/src/{integrations → ai}/index.d.ts +4 -4
  17. package/dist/src/ai/index.d.ts.map +1 -0
  18. package/dist/src/{integrations → ai}/langchain.d.ts +6 -6
  19. package/dist/src/ai/langchain.d.ts.map +1 -0
  20. package/dist/src/{integrations → ai}/llamaindex.d.ts +6 -6
  21. package/dist/src/ai/llamaindex.d.ts.map +1 -0
  22. package/dist/src/{integrations → ai}/mastra.d.ts +6 -6
  23. package/dist/src/ai/mastra.d.ts.map +1 -0
  24. package/dist/src/{integrations → ai}/openai-agents.d.ts +6 -6
  25. package/dist/src/ai/openai-agents.d.ts.map +1 -0
  26. package/dist/src/{integrations → ai}/openai.d.ts +6 -6
  27. package/dist/src/ai/openai.d.ts.map +1 -0
  28. package/dist/src/{integrations → ai}/utils.d.ts +1 -1
  29. package/dist/src/ai/utils.d.ts.map +1 -0
  30. package/dist/src/{integrations → ai}/vercel-ai.d.ts +4 -4
  31. package/dist/src/ai/vercel-ai.d.ts.map +1 -0
  32. package/dist/src/client.d.ts +39 -39
  33. package/dist/src/client.d.ts.map +1 -1
  34. package/dist/src/config/types.d.ts +24 -24
  35. package/dist/src/config/types.d.ts.map +1 -1
  36. package/dist/src/index.d.ts +10 -10
  37. package/dist/src/index.d.ts.map +1 -1
  38. package/dist/src/{plugins → integrations}/generic.d.ts +14 -14
  39. package/dist/src/integrations/generic.d.ts.map +1 -0
  40. package/dist/src/{plugins → integrations}/github-client.d.ts +4 -4
  41. package/dist/src/integrations/github-client.d.ts.map +1 -0
  42. package/dist/src/{plugins → integrations}/github.d.ts +17 -17
  43. package/dist/src/integrations/github.d.ts.map +1 -0
  44. package/dist/src/{plugins → integrations}/gmail-client.d.ts +4 -4
  45. package/dist/src/integrations/gmail-client.d.ts.map +1 -0
  46. package/dist/src/{plugins → integrations}/gmail.d.ts +17 -17
  47. package/dist/src/integrations/gmail.d.ts.map +1 -0
  48. package/dist/src/{plugins → integrations}/server-client.d.ts +4 -4
  49. package/dist/src/integrations/server-client.d.ts.map +1 -0
  50. package/dist/src/{plugins → integrations}/types.d.ts +15 -15
  51. package/dist/src/integrations/types.d.ts.map +1 -0
  52. package/dist/src/oauth/manager.d.ts +1 -1
  53. package/dist/src/oauth/manager.d.ts.map +1 -1
  54. package/dist/src/react/hooks.d.ts +5 -5
  55. package/dist/src/server.d.ts +25 -25
  56. package/dist/src/server.d.ts.map +1 -1
  57. package/dist/src/utils/naming.d.ts +3 -3
  58. package/dist/src/utils/naming.d.ts.map +1 -1
  59. package/index.ts +4 -4
  60. package/package.json +27 -27
  61. package/server.ts +1 -1
  62. package/dist/src/integrations/anthropic.d.ts.map +0 -1
  63. package/dist/src/integrations/cloudflare.d.ts.map +0 -1
  64. package/dist/src/integrations/google.d.ts.map +0 -1
  65. package/dist/src/integrations/index.d.ts.map +0 -1
  66. package/dist/src/integrations/langchain.d.ts.map +0 -1
  67. package/dist/src/integrations/llamaindex.d.ts.map +0 -1
  68. package/dist/src/integrations/mastra.d.ts.map +0 -1
  69. package/dist/src/integrations/openai-agents.d.ts.map +0 -1
  70. package/dist/src/integrations/openai.d.ts.map +0 -1
  71. package/dist/src/integrations/utils.d.ts.map +0 -1
  72. package/dist/src/integrations/vercel-ai.d.ts.map +0 -1
  73. package/dist/src/plugins/generic.d.ts.map +0 -1
  74. package/dist/src/plugins/github-client.d.ts.map +0 -1
  75. package/dist/src/plugins/github.d.ts.map +0 -1
  76. package/dist/src/plugins/gmail-client.d.ts.map +0 -1
  77. package/dist/src/plugins/gmail.d.ts.map +0 -1
  78. package/dist/src/plugins/server-client.d.ts.map +0 -1
  79. package/dist/src/plugins/types.d.ts.map +0 -1
package/README.md CHANGED
@@ -3,19 +3,19 @@
3
3
  [![Tests](https://github.com/Revyo/integrate-sdk/actions/workflows/test.yml/badge.svg)](https://github.com/Revyo/integrate-sdk/actions/workflows/test.yml)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- A type-safe TypeScript SDK for connecting to the Integrate MCP (Model Context Protocol) server. Access GitHub, Gmail, Notion, and other integrations through a simple, plugin-based API.
6
+ A type-safe TypeScript SDK for connecting to the Integrate MCP (Model Context Protocol) server. Access GitHub, Gmail, Notion, and other integrations through a simple, integration-based API.
7
7
 
8
8
  **📚 [Full Documentation](https://integrate.dev)** | **Server:** `https://mcp.integrate.dev/api/v1/mcp`
9
9
 
10
10
  ## Features
11
11
 
12
- - 🔌 **Plugin-Based Architecture** - Enable only the integrations you need
12
+ - 🔌 **Integration-Based Architecture** - Enable only the integrations you need
13
13
  - 🔒 **Fully Typed API** - Type-safe methods with autocomplete (e.g., `client.github.createIssue()`)
14
14
  - 💡 **IntelliSense Support** - Full TypeScript support with parameter hints
15
15
  - ⚡ **Automatic Connection Management** - Lazy connection, auto-cleanup, singleton pattern
16
16
  - 🔐 **Complete OAuth Flow** - Built-in OAuth 2.0 with PKCE (popup/redirect modes)
17
17
  - 🌍 **Universal** - Works in browser and Node.js environments
18
- - 🛠️ **Extensible** - Configure plugins for any server-supported integration
18
+ - 🛠️ **Extensible** - Configure integrations for any server-supported integration
19
19
  - 📦 **Zero Dependencies** - Lightweight implementation
20
20
 
21
21
  ## Installation
@@ -43,24 +43,24 @@ For production, use: `https://yourdomain.com/api/integrate/oauth/callback`
43
43
 
44
44
  ### 1. Create Server Config
45
45
 
46
- Define your OAuth providers once. Plugins automatically read credentials from environment variables:
46
+ Define your OAuth providers once. Integrations automatically read credentials from environment variables:
47
47
 
48
48
  ```typescript
49
49
  // lib/integrate-server.ts (server-side only!)
50
50
  import {
51
51
  createMCPServer,
52
- githubPlugin,
53
- gmailPlugin,
52
+ githubIntegration,
53
+ gmailIntegration,
54
54
  } from "integrate-sdk/server";
55
55
 
56
- // Plugins automatically use GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET,
56
+ // Integrations automatically use GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET,
57
57
  // GMAIL_CLIENT_ID, GMAIL_CLIENT_SECRET from environment
58
58
  export const { client: serverClient } = createMCPServer({
59
- plugins: [
60
- githubPlugin({
59
+ integrations: [
60
+ githubIntegration({
61
61
  scopes: ["repo", "user"],
62
62
  }),
63
- gmailPlugin({
63
+ gmailIntegration({
64
64
  scopes: ["gmail.readonly"],
65
65
  }),
66
66
  ],
@@ -105,11 +105,11 @@ Use in your client components (no secrets needed):
105
105
 
106
106
  ```typescript
107
107
  "use client";
108
- import { createMCPClient, githubPlugin } from "integrate-sdk";
108
+ import { createMCPClient, githubIntegration } from "integrate-sdk";
109
109
 
110
110
  const client = createMCPClient({
111
- plugins: [
112
- githubPlugin({
111
+ integrations: [
112
+ githubIntegration({
113
113
  scopes: ["repo", "user"],
114
114
  // No clientId or clientSecret needed!
115
115
  }),
@@ -150,10 +150,10 @@ The SDK automatically manages connections for you - no manual `connect()` or `di
150
150
 
151
151
  ```typescript
152
152
  // ✅ Default behavior - automatic connection
153
- // Plugins automatically use GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET from environment
153
+ // Integrations automatically use GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET from environment
154
154
  const client = createMCPClient({
155
- plugins: [
156
- githubPlugin({
155
+ integrations: [
156
+ githubIntegration({
157
157
  scopes: ["repo", "user"],
158
158
  }),
159
159
  ],
@@ -165,7 +165,7 @@ await client.github.listRepos({ username: "octocat" });
165
165
 
166
166
  // ✅ Want manual control? Use manual mode
167
167
  const manualClient = createMCPClient({
168
- plugins: [githubPlugin({ scopes: ["repo"] })],
168
+ integrations: [githubIntegration({ scopes: ["repo"] })],
169
169
  connectionMode: "manual",
170
170
  singleton: false,
171
171
  });
@@ -189,7 +189,7 @@ See [Quick Start](#quick-start) above for complete examples.
189
189
 
190
190
  ## Why Use Integrate SDK?
191
191
 
192
- ### Typed Plugin Methods
192
+ ### Typed Integration Methods
193
193
 
194
194
  Instead of generic tool calls, use typed methods with full autocomplete:
195
195
 
@@ -213,7 +213,7 @@ await client.gmail.sendEmail({ to: "user@example.com", subject: "Hello" });
213
213
  ### Three Ways to Call Tools
214
214
 
215
215
  ```typescript
216
- // 1. Typed plugin methods (recommended for built-in plugins like GitHub/Gmail)
216
+ // 1. Typed integration methods (recommended for built-in integrations like GitHub/Gmail)
217
217
  await client.github.createIssue({
218
218
  owner: "user",
219
219
  repo: "project",
@@ -263,9 +263,9 @@ For complete OAuth setup including:
263
263
 
264
264
  See the [`/examples`](/examples) directory or [OAuth documentation](https://integrate.dev/docs/guides/oauth-flow).
265
265
 
266
- ## Built-in Plugins
266
+ ## Built-in Integrations
267
267
 
268
- ### GitHub Plugin
268
+ ### GitHub Integration
269
269
 
270
270
  Access GitHub repositories, issues, pull requests, and more with type-safe methods.
271
271
 
@@ -281,9 +281,9 @@ await client.github.listPullRequests({
281
281
  await client.github.listOwnRepos({});
282
282
  ```
283
283
 
284
- [→ GitHub plugin documentation](https://integrate.dev/docs/plugins/github)
284
+ [→ GitHub integration documentation](https://integrate.dev/docs/integrations/github)
285
285
 
286
- ### Gmail Plugin
286
+ ### Gmail Integration
287
287
 
288
288
  Send emails, manage labels, and search messages with type-safe methods.
289
289
 
@@ -298,17 +298,17 @@ await client.gmail.listEmails({ maxResults: 10, q: "is:unread" });
298
298
  await client.gmail.searchEmails({ query: "from:notifications@github.com" });
299
299
  ```
300
300
 
301
- [→ Gmail plugin documentation](https://integrate.dev/docs/plugins/gmail)
301
+ [→ Gmail integration documentation](https://integrate.dev/docs/integrations/gmail)
302
302
 
303
303
  ### Additional Integrations
304
304
 
305
- Use `genericOAuthPlugin` to configure any server-supported integration:
305
+ Use `genericOAuthIntegration` to configure any server-supported integration:
306
306
 
307
307
  ```typescript
308
- import { genericOAuthPlugin } from "integrate-sdk/server";
308
+ import { genericOAuthIntegration } from "integrate-sdk/server";
309
309
 
310
310
  // Automatically uses SLACK_CLIENT_ID and SLACK_CLIENT_SECRET from environment
311
- const slackPlugin = genericOAuthPlugin({
311
+ const slackIntegration = genericOAuthIntegration({
312
312
  id: "slack",
313
313
  provider: "slack",
314
314
  scopes: ["chat:write", "channels:read"],
@@ -339,7 +339,7 @@ const result = await generateText({
339
339
  });
340
340
  ```
341
341
 
342
- [→ View Vercel AI SDK integration guide](https://integrate.dev/docs/integrations/vercel-ai)
342
+ [→ View Vercel AI SDK integration guide](https://integrate.dev/docs/ai/vercel-ai)
343
343
 
344
344
  ## Documentation
345
345
 
@@ -347,8 +347,8 @@ For detailed guides, API reference, and examples, visit the [complete documentat
347
347
 
348
348
  - **[Getting Started](https://integrate.dev/docs/getting-started/installation)** - Installation and quick start
349
349
  - **[OAuth Flow](https://integrate.dev/docs/guides/oauth-flow)** - OAuth 2.0 authorization guide
350
- - **[Plugins](https://integrate.dev/docs/plugins)** - Built-in plugins and configuration
351
- - **[Vercel AI SDK](https://integrate.dev/docs/integrations/vercel-ai)** - AI model integration
350
+ - **[Integrations](https://integrate.dev/docs/integrations)** - Built-in integrations and configuration
351
+ - **[Vercel AI SDK](https://integrate.dev/docs/ai/vercel-ai)** - AI model integration
352
352
  - **[Advanced Usage](https://integrate.dev/docs/guides/advanced-usage)** - Error handling, retries, and more
353
353
  - **[API Reference](https://integrate.dev/docs/reference/api-reference)** - Complete API documentation
354
354
  - **[Architecture](https://integrate.dev/docs/reference/architecture)** - How the SDK works
@@ -796,9 +796,9 @@ init_errors();
796
796
  function camelToSnake(str) {
797
797
  return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
798
798
  }
799
- function methodToToolName(methodName, pluginId) {
799
+ function methodToToolName(methodName, integrationId) {
800
800
  const snakeCaseMethod = camelToSnake(methodName);
801
- return `${pluginId}_${snakeCaseMethod}`;
801
+ return `${integrationId}_${snakeCaseMethod}`;
802
802
  }
803
803
  // src/oauth/window-manager.ts
804
804
  function isBrowser() {
@@ -1318,7 +1318,7 @@ var clientCache = new Map;
1318
1318
  var cleanupClients = new Set;
1319
1319
  class MCPClient {
1320
1320
  transport;
1321
- plugins;
1321
+ integrations;
1322
1322
  availableTools = new Map;
1323
1323
  enabledToolNames = new Set;
1324
1324
  initialized = false;
@@ -1341,17 +1341,17 @@ class MCPClient {
1341
1341
  const oauthApiBase = config.oauthApiBase || "/api/integrate/oauth";
1342
1342
  const defaultRedirectUri = this.getDefaultRedirectUri(oauthApiBase);
1343
1343
  this.apiRouteBase = config.apiRouteBase || "/api/integrate";
1344
- this.plugins = config.plugins.map((plugin) => {
1345
- if (plugin.oauth && !plugin.oauth.redirectUri) {
1344
+ this.integrations = config.integrations.map((integration) => {
1345
+ if (integration.oauth && !integration.oauth.redirectUri) {
1346
1346
  return {
1347
- ...plugin,
1347
+ ...integration,
1348
1348
  oauth: {
1349
- ...plugin.oauth,
1349
+ ...integration.oauth,
1350
1350
  redirectUri: defaultRedirectUri
1351
1351
  }
1352
1352
  };
1353
1353
  }
1354
- return plugin;
1354
+ return integration;
1355
1355
  });
1356
1356
  this.clientInfo = config.clientInfo || {
1357
1357
  name: "integrate-sdk",
@@ -1360,21 +1360,21 @@ class MCPClient {
1360
1360
  this.onReauthRequired = config.onReauthRequired;
1361
1361
  this.maxReauthRetries = config.maxReauthRetries ?? 1;
1362
1362
  this.oauthManager = new OAuthManager(oauthApiBase, config.oauthFlow);
1363
- const providers = this.plugins.filter((p) => p.oauth).map((p) => p.oauth.provider);
1363
+ const providers = this.integrations.filter((p) => p.oauth).map((p) => p.oauth.provider);
1364
1364
  this.oauthManager.loadAllProviderTokens(providers);
1365
- for (const plugin of this.plugins) {
1366
- for (const toolName of plugin.tools) {
1365
+ for (const integration of this.integrations) {
1366
+ for (const toolName of integration.tools) {
1367
1367
  this.enabledToolNames.add(toolName);
1368
1368
  }
1369
- if (plugin.oauth) {
1370
- const hasToken = this.oauthManager.getProviderToken(plugin.oauth.provider) !== undefined;
1371
- this.authState.set(plugin.oauth.provider, { authenticated: hasToken });
1369
+ if (integration.oauth) {
1370
+ const hasToken = this.oauthManager.getProviderToken(integration.oauth.provider) !== undefined;
1371
+ this.authState.set(integration.oauth.provider, { authenticated: hasToken });
1372
1372
  }
1373
1373
  }
1374
- this.github = this.createPluginProxy("github");
1375
- this.gmail = this.createPluginProxy("gmail");
1374
+ this.github = this.createIntegrationProxy("github");
1375
+ this.gmail = this.createIntegrationProxy("gmail");
1376
1376
  this.server = this.createServerProxy();
1377
- this.initializePlugins();
1377
+ this.initializeIntegrations();
1378
1378
  }
1379
1379
  getDefaultRedirectUri(oauthApiBase) {
1380
1380
  if (typeof window === "undefined" || !window.location) {
@@ -1384,11 +1384,11 @@ class MCPClient {
1384
1384
  const normalizedPath = oauthApiBase.replace(/\/$/, "");
1385
1385
  return `${origin}${normalizedPath}/callback`;
1386
1386
  }
1387
- createPluginProxy(pluginId) {
1387
+ createIntegrationProxy(integrationId) {
1388
1388
  return new Proxy({}, {
1389
1389
  get: (_target, methodName) => {
1390
1390
  return async (args) => {
1391
- const toolName = methodToToolName(methodName, pluginId);
1391
+ const toolName = methodToToolName(methodName, integrationId);
1392
1392
  return await this.callToolWithRetry(toolName, args, 0);
1393
1393
  };
1394
1394
  }
@@ -1414,25 +1414,25 @@ class MCPClient {
1414
1414
  throw parsedError;
1415
1415
  }
1416
1416
  }
1417
- async initializePlugins() {
1418
- for (const plugin of this.plugins) {
1419
- if (plugin.onInit) {
1420
- await plugin.onInit(this);
1417
+ async initializeIntegrations() {
1418
+ for (const integration of this.integrations) {
1419
+ if (integration.onInit) {
1420
+ await integration.onInit(this);
1421
1421
  }
1422
1422
  }
1423
1423
  }
1424
1424
  async connect() {
1425
- for (const plugin of this.plugins) {
1426
- if (plugin.onBeforeConnect) {
1427
- await plugin.onBeforeConnect(this);
1425
+ for (const integration of this.integrations) {
1426
+ if (integration.onBeforeConnect) {
1427
+ await integration.onBeforeConnect(this);
1428
1428
  }
1429
1429
  }
1430
1430
  await this.transport.connect();
1431
1431
  await this.initialize();
1432
1432
  await this.discoverTools();
1433
- for (const plugin of this.plugins) {
1434
- if (plugin.onAfterConnect) {
1435
- await plugin.onAfterConnect(this);
1433
+ for (const integration of this.integrations) {
1434
+ if (integration.onAfterConnect) {
1435
+ await integration.onAfterConnect(this);
1436
1436
  }
1437
1437
  }
1438
1438
  }
@@ -1454,7 +1454,7 @@ class MCPClient {
1454
1454
  this.availableTools.set(tool.name, tool);
1455
1455
  }
1456
1456
  const enabledTools = response.tools.filter((tool) => this.enabledToolNames.has(tool.name));
1457
- console.log(`Discovered ${response.tools.length} tools, ${enabledTools.length} enabled by plugins`);
1457
+ console.log(`Discovered ${response.tools.length} tools, ${enabledTools.length} enabled by integrations`);
1458
1458
  }
1459
1459
  async _callToolByName(name, args) {
1460
1460
  return await this.callToolWithRetry(name, args, 0);
@@ -1514,7 +1514,7 @@ class MCPClient {
1514
1514
  }
1515
1515
  async callToolWithRetry(name, args, retryCount = 0) {
1516
1516
  if (!this.enabledToolNames.has(name)) {
1517
- throw new Error(`Tool "${name}" is not enabled. Enable it by adding the appropriate plugin.`);
1517
+ throw new Error(`Tool "${name}" is not enabled. Enable it by adding the appropriate integration.`);
1518
1518
  }
1519
1519
  const provider = this.getProviderForTool(name);
1520
1520
  try {
@@ -1547,9 +1547,9 @@ class MCPClient {
1547
1547
  }
1548
1548
  }
1549
1549
  getProviderForTool(toolName) {
1550
- for (const plugin of this.plugins) {
1551
- if (plugin.tools.includes(toolName) && plugin.oauth) {
1552
- return plugin.oauth.provider;
1550
+ for (const integration of this.integrations) {
1551
+ if (integration.tools.includes(toolName) && integration.oauth) {
1552
+ return integration.oauth.provider;
1553
1553
  }
1554
1554
  }
1555
1555
  return;
@@ -1566,15 +1566,15 @@ class MCPClient {
1566
1566
  getEnabledTools() {
1567
1567
  return Array.from(this.availableTools.values()).filter((tool) => this.enabledToolNames.has(tool.name));
1568
1568
  }
1569
- getOAuthConfig(pluginId) {
1570
- const plugin = this.plugins.find((p) => p.id === pluginId);
1571
- return plugin?.oauth;
1569
+ getOAuthConfig(integrationId) {
1570
+ const integration = this.integrations.find((p) => p.id === integrationId);
1571
+ return integration?.oauth;
1572
1572
  }
1573
1573
  getAllOAuthConfigs() {
1574
1574
  const configs = new Map;
1575
- for (const plugin of this.plugins) {
1576
- if (plugin.oauth) {
1577
- configs.set(plugin.id, plugin.oauth);
1575
+ for (const integration of this.integrations) {
1576
+ if (integration.oauth) {
1577
+ configs.set(integration.id, integration.oauth);
1578
1578
  }
1579
1579
  }
1580
1580
  return configs;
@@ -1592,8 +1592,8 @@ class MCPClient {
1592
1592
  this.oauthManager.clearAllProviderTokens();
1593
1593
  }
1594
1594
  async disconnectProvider(provider) {
1595
- const plugin = this.plugins.find((p) => p.oauth?.provider === provider);
1596
- if (!plugin?.oauth) {
1595
+ const integration = this.integrations.find((p) => p.oauth?.provider === provider);
1596
+ if (!integration?.oauth) {
1597
1597
  throw new Error(`No OAuth configuration found for provider: ${provider}`);
1598
1598
  }
1599
1599
  try {
@@ -1612,17 +1612,17 @@ class MCPClient {
1612
1612
  this.clearSessionToken();
1613
1613
  this.oauthManager.clearAllPendingAuths();
1614
1614
  this.authState.clear();
1615
- for (const plugin of this.plugins) {
1616
- if (plugin.oauth) {
1617
- this.authState.set(plugin.oauth.provider, { authenticated: false });
1615
+ for (const integration of this.integrations) {
1616
+ if (integration.oauth) {
1617
+ this.authState.set(integration.oauth.provider, { authenticated: false });
1618
1618
  }
1619
1619
  }
1620
1620
  this.eventEmitter.emit("auth:logout", {});
1621
1621
  }
1622
1622
  async disconnect() {
1623
- for (const plugin of this.plugins) {
1624
- if (plugin.onDisconnect) {
1625
- await plugin.onDisconnect(this);
1623
+ for (const integration of this.integrations) {
1624
+ if (integration.onDisconnect) {
1625
+ await integration.onDisconnect(this);
1626
1626
  }
1627
1627
  }
1628
1628
  await this.transport.disconnect();
@@ -1646,11 +1646,11 @@ class MCPClient {
1646
1646
  }
1647
1647
  async authorizedProviders() {
1648
1648
  const authorized = [];
1649
- for (const plugin of this.plugins) {
1650
- if (plugin.oauth) {
1651
- const status = await this.oauthManager.checkAuthStatus(plugin.oauth.provider);
1649
+ for (const integration of this.integrations) {
1650
+ if (integration.oauth) {
1651
+ const status = await this.oauthManager.checkAuthStatus(integration.oauth.provider);
1652
1652
  if (status.authorized) {
1653
- authorized.push(plugin.oauth.provider);
1653
+ authorized.push(integration.oauth.provider);
1654
1654
  }
1655
1655
  }
1656
1656
  }
@@ -1660,15 +1660,15 @@ class MCPClient {
1660
1660
  return await this.oauthManager.checkAuthStatus(provider);
1661
1661
  }
1662
1662
  async authorize(provider, options) {
1663
- const plugin = this.plugins.find((p) => p.oauth?.provider === provider);
1664
- if (!plugin?.oauth) {
1663
+ const integration = this.integrations.find((p) => p.oauth?.provider === provider);
1664
+ if (!integration?.oauth) {
1665
1665
  const error = new Error(`No OAuth configuration found for provider: ${provider}`);
1666
1666
  this.eventEmitter.emit("auth:error", { provider, error });
1667
1667
  throw error;
1668
1668
  }
1669
1669
  this.eventEmitter.emit("auth:started", { provider });
1670
1670
  try {
1671
- await this.oauthManager.initiateFlow(provider, plugin.oauth, options?.returnUrl);
1671
+ await this.oauthManager.initiateFlow(provider, integration.oauth, options?.returnUrl);
1672
1672
  const tokenData = this.oauthManager.getProviderToken(provider);
1673
1673
  if (tokenData) {
1674
1674
  this.eventEmitter.emit("auth:complete", {
@@ -1718,7 +1718,7 @@ class MCPClient {
1718
1718
  async reauthenticate(provider) {
1719
1719
  const state = this.authState.get(provider);
1720
1720
  if (!state) {
1721
- throw new Error(`Provider "${provider}" not found in configured plugins`);
1721
+ throw new Error(`Provider "${provider}" not found in configured integrations`);
1722
1722
  }
1723
1723
  if (!this.onReauthRequired) {
1724
1724
  throw new Error("No re-authentication handler configured. Set onReauthRequired in client config.");