integrate-sdk 0.8.36 → 0.8.39

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 (76) hide show
  1. package/dist/adapters/auto-routes.js +371 -71
  2. package/dist/adapters/base-handler.js +561 -0
  3. package/dist/adapters/index.js +371 -71
  4. package/dist/adapters/nextjs.js +371 -71
  5. package/dist/adapters/node.js +371 -71
  6. package/dist/adapters/svelte-kit.js +371 -71
  7. package/dist/adapters/tanstack-start.js +371 -71
  8. package/dist/ai/anthropic.d.ts +3 -0
  9. package/dist/ai/anthropic.d.ts.map +1 -1
  10. package/dist/ai/anthropic.js +255 -2
  11. package/dist/ai/cloudflare.d.ts +158 -0
  12. package/dist/ai/cloudflare.d.ts.map +1 -0
  13. package/dist/ai/cloudflare.js +4249 -0
  14. package/dist/ai/google.d.ts +3 -0
  15. package/dist/ai/google.d.ts.map +1 -1
  16. package/dist/ai/google.js +256 -2
  17. package/dist/ai/index.d.ts +1 -0
  18. package/dist/ai/index.d.ts.map +1 -1
  19. package/dist/ai/index.js +351 -7
  20. package/dist/ai/langchain.d.ts +139 -0
  21. package/dist/ai/langchain.d.ts.map +1 -0
  22. package/dist/ai/langchain.js +4237 -0
  23. package/dist/ai/llamaindex.d.ts +125 -0
  24. package/dist/ai/llamaindex.d.ts.map +1 -0
  25. package/dist/ai/llamaindex.js +4236 -0
  26. package/dist/ai/mastra.d.ts +138 -0
  27. package/dist/ai/mastra.d.ts.map +1 -0
  28. package/dist/ai/mastra.js +4240 -0
  29. package/dist/ai/openai.d.ts +3 -0
  30. package/dist/ai/openai.d.ts.map +1 -1
  31. package/dist/ai/openai.js +257 -2
  32. package/dist/ai/trigger-tools.d.ts +206 -0
  33. package/dist/ai/trigger-tools.d.ts.map +1 -0
  34. package/dist/ai/trigger-tools.js +4198 -0
  35. package/dist/ai/vercel-ai.d.ts.map +1 -1
  36. package/dist/ai/vercel-ai.js +217 -0
  37. package/dist/index.js +359 -59
  38. package/dist/oauth.js +371 -71
  39. package/dist/server.js +372 -71
  40. package/dist/src/ai/anthropic.d.ts +3 -0
  41. package/dist/src/ai/anthropic.d.ts.map +1 -1
  42. package/dist/src/ai/cloudflare.d.ts +158 -0
  43. package/dist/src/ai/cloudflare.d.ts.map +1 -0
  44. package/dist/src/ai/google.d.ts +3 -0
  45. package/dist/src/ai/google.d.ts.map +1 -1
  46. package/dist/src/ai/index.d.ts +1 -0
  47. package/dist/src/ai/index.d.ts.map +1 -1
  48. package/dist/src/ai/langchain.d.ts +139 -0
  49. package/dist/src/ai/langchain.d.ts.map +1 -0
  50. package/dist/src/ai/llamaindex.d.ts +125 -0
  51. package/dist/src/ai/llamaindex.d.ts.map +1 -0
  52. package/dist/src/ai/mastra.d.ts +138 -0
  53. package/dist/src/ai/mastra.d.ts.map +1 -0
  54. package/dist/src/ai/openai.d.ts +3 -0
  55. package/dist/src/ai/openai.d.ts.map +1 -1
  56. package/dist/src/ai/trigger-tools.d.ts +206 -0
  57. package/dist/src/ai/trigger-tools.d.ts.map +1 -0
  58. package/dist/src/ai/vercel-ai.d.ts.map +1 -1
  59. package/dist/src/integrations/vercel-ai.d.ts +127 -0
  60. package/dist/src/integrations/vercel-ai.d.ts.map +1 -0
  61. package/dist/src/plugins/generic.d.ts +99 -0
  62. package/dist/src/plugins/generic.d.ts.map +1 -0
  63. package/dist/src/plugins/github-client.d.ts +320 -0
  64. package/dist/src/plugins/github-client.d.ts.map +1 -0
  65. package/dist/src/plugins/github.d.ts +89 -0
  66. package/dist/src/plugins/github.d.ts.map +1 -0
  67. package/dist/src/plugins/gmail-client.d.ts +106 -0
  68. package/dist/src/plugins/gmail-client.d.ts.map +1 -0
  69. package/dist/src/plugins/gmail.d.ts +87 -0
  70. package/dist/src/plugins/gmail.d.ts.map +1 -0
  71. package/dist/src/plugins/server-client.d.ts +18 -0
  72. package/dist/src/plugins/server-client.d.ts.map +1 -0
  73. package/dist/src/plugins/types.d.ts +70 -0
  74. package/dist/src/plugins/types.d.ts.map +1 -0
  75. package/dist/src/server.d.ts.map +1 -1
  76. package/package.json +2 -2
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Trigger Management Tools for AI
3
+ *
4
+ * SDK-level tools that call trigger callbacks directly
5
+ * Automatically included in AI provider helpers when triggers are configured
6
+ */
7
+ import { z } from "zod";
8
+ import type { MCPContext } from "../config/types.js";
9
+ import type { TriggerCallbacks } from "../triggers/types.js";
10
+ /**
11
+ * Configuration for trigger tools
12
+ */
13
+ export interface TriggerToolsConfig {
14
+ /** Trigger storage callbacks */
15
+ callbacks: TriggerCallbacks;
16
+ /** Session context extraction function */
17
+ getSessionContext?: (request: Request) => Promise<MCPContext | undefined> | MCPContext | undefined;
18
+ }
19
+ /**
20
+ * Create trigger management tools for AI providers
21
+ * These tools call the trigger callbacks directly with pre-processing
22
+ *
23
+ * @param config - Trigger configuration including callbacks
24
+ * @param context - Optional user context for multi-tenant support
25
+ * @returns Object containing trigger management tools
26
+ */
27
+ export declare function createTriggerTools(config: TriggerToolsConfig, context?: MCPContext): {
28
+ create_trigger: {
29
+ description: string;
30
+ inputSchema: z.ZodObject<{
31
+ name: z.ZodOptional<z.ZodString>;
32
+ description: z.ZodOptional<z.ZodString>;
33
+ toolName: z.ZodString;
34
+ toolArguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
35
+ schedule: z.ZodUnion<[z.ZodObject<{
36
+ type: z.ZodLiteral<"once">;
37
+ runAt: z.ZodString;
38
+ }, "strip", z.ZodTypeAny, {
39
+ type: "once";
40
+ runAt: string;
41
+ }, {
42
+ type: "once";
43
+ runAt: string;
44
+ }>, z.ZodObject<{
45
+ type: z.ZodLiteral<"cron">;
46
+ expression: z.ZodString;
47
+ }, "strip", z.ZodTypeAny, {
48
+ type: "cron";
49
+ expression: string;
50
+ }, {
51
+ type: "cron";
52
+ expression: string;
53
+ }>]>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ toolName: string;
56
+ toolArguments: Record<string, unknown>;
57
+ schedule: {
58
+ type: "once";
59
+ runAt: string;
60
+ } | {
61
+ type: "cron";
62
+ expression: string;
63
+ };
64
+ name?: string | undefined;
65
+ description?: string | undefined;
66
+ }, {
67
+ toolName: string;
68
+ toolArguments: Record<string, unknown>;
69
+ schedule: {
70
+ type: "once";
71
+ runAt: string;
72
+ } | {
73
+ type: "cron";
74
+ expression: string;
75
+ };
76
+ name?: string | undefined;
77
+ description?: string | undefined;
78
+ }>;
79
+ execute: (args: any) => Promise<import("../index.js").Trigger>;
80
+ };
81
+ list_triggers: {
82
+ description: string;
83
+ inputSchema: z.ZodObject<{
84
+ status: z.ZodOptional<z.ZodEnum<["active", "paused", "completed", "failed"]>>;
85
+ toolName: z.ZodOptional<z.ZodString>;
86
+ limit: z.ZodOptional<z.ZodNumber>;
87
+ offset: z.ZodOptional<z.ZodNumber>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ toolName?: string | undefined;
90
+ status?: "active" | "paused" | "completed" | "failed" | undefined;
91
+ limit?: number | undefined;
92
+ offset?: number | undefined;
93
+ }, {
94
+ toolName?: string | undefined;
95
+ status?: "active" | "paused" | "completed" | "failed" | undefined;
96
+ limit?: number | undefined;
97
+ offset?: number | undefined;
98
+ }>;
99
+ execute: (args: any) => Promise<{
100
+ triggers: import("../index.js").Trigger[];
101
+ total: number;
102
+ hasMore: boolean;
103
+ }>;
104
+ };
105
+ get_trigger: {
106
+ description: string;
107
+ inputSchema: z.ZodObject<{
108
+ triggerId: z.ZodString;
109
+ }, "strip", z.ZodTypeAny, {
110
+ triggerId: string;
111
+ }, {
112
+ triggerId: string;
113
+ }>;
114
+ execute: (args: any) => Promise<import("../index.js").Trigger>;
115
+ };
116
+ update_trigger: {
117
+ description: string;
118
+ inputSchema: z.ZodObject<{
119
+ triggerId: z.ZodString;
120
+ name: z.ZodOptional<z.ZodString>;
121
+ description: z.ZodOptional<z.ZodString>;
122
+ toolArguments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
123
+ schedule: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
124
+ type: z.ZodLiteral<"once">;
125
+ runAt: z.ZodString;
126
+ }, "strip", z.ZodTypeAny, {
127
+ type: "once";
128
+ runAt: string;
129
+ }, {
130
+ type: "once";
131
+ runAt: string;
132
+ }>, z.ZodObject<{
133
+ type: z.ZodLiteral<"cron">;
134
+ expression: z.ZodString;
135
+ }, "strip", z.ZodTypeAny, {
136
+ type: "cron";
137
+ expression: string;
138
+ }, {
139
+ type: "cron";
140
+ expression: string;
141
+ }>]>>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ triggerId: string;
144
+ name?: string | undefined;
145
+ description?: string | undefined;
146
+ toolArguments?: Record<string, unknown> | undefined;
147
+ schedule?: {
148
+ type: "once";
149
+ runAt: string;
150
+ } | {
151
+ type: "cron";
152
+ expression: string;
153
+ } | undefined;
154
+ }, {
155
+ triggerId: string;
156
+ name?: string | undefined;
157
+ description?: string | undefined;
158
+ toolArguments?: Record<string, unknown> | undefined;
159
+ schedule?: {
160
+ type: "once";
161
+ runAt: string;
162
+ } | {
163
+ type: "cron";
164
+ expression: string;
165
+ } | undefined;
166
+ }>;
167
+ execute: (args: any) => Promise<import("../index.js").Trigger>;
168
+ };
169
+ delete_trigger: {
170
+ description: string;
171
+ inputSchema: z.ZodObject<{
172
+ triggerId: z.ZodString;
173
+ }, "strip", z.ZodTypeAny, {
174
+ triggerId: string;
175
+ }, {
176
+ triggerId: string;
177
+ }>;
178
+ execute: (args: any) => Promise<{
179
+ success: boolean;
180
+ message: string;
181
+ }>;
182
+ };
183
+ pause_trigger: {
184
+ description: string;
185
+ inputSchema: z.ZodObject<{
186
+ triggerId: z.ZodString;
187
+ }, "strip", z.ZodTypeAny, {
188
+ triggerId: string;
189
+ }, {
190
+ triggerId: string;
191
+ }>;
192
+ execute: (args: any) => Promise<import("../index.js").Trigger>;
193
+ };
194
+ resume_trigger: {
195
+ description: string;
196
+ inputSchema: z.ZodObject<{
197
+ triggerId: z.ZodString;
198
+ }, "strip", z.ZodTypeAny, {
199
+ triggerId: string;
200
+ }, {
201
+ triggerId: string;
202
+ }>;
203
+ execute: (args: any) => Promise<import("../index.js").Trigger>;
204
+ };
205
+ };
206
+ //# sourceMappingURL=trigger-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger-tools.d.ts","sourceRoot":"","sources":["../../../src/ai/trigger-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQ7D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,GAAG,UAAU,GAAG,SAAS,CAAC;CACpG;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsBvD,GAAG;;;;;;;;;;;;;;;;;;;;wBA4BH,GAAG;;;;;;;;;;;;;;;wBA2BH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6BH,GAAG;;;;;;;;;;;wBAkBH,GAAG;;;;;;;;;;;;;;wBAWH,GAAG;;;;;;;;;;;wBA+BH,GAAG;;EA0B9B"}
@@ -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,KA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E,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,kDAAkD;IAClD,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,oBAAoB,gCAiC/B"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Vercel AI SDK Integration
3
+ *
4
+ * Helper functions to convert MCP tools to Vercel AI SDK v5 format
5
+ */
6
+ import { z } from "zod";
7
+ import type { MCPClient } from "../client.js";
8
+ import type { MCPTool } from "../protocol/messages.js";
9
+ /**
10
+ * Tool definition compatible with Vercel AI SDK v5
11
+ * This matches the CoreTool interface from 'ai' package v5
12
+ */
13
+ export interface VercelAITool {
14
+ description?: string;
15
+ inputSchema: z.ZodType<any>;
16
+ execute: (args: any, options?: any) => Promise<any>;
17
+ }
18
+ /**
19
+ * Options for converting MCP tools to Vercel AI SDK format
20
+ */
21
+ export interface VercelAIToolsOptions {
22
+ /**
23
+ * Provider tokens for server-side usage
24
+ * Maps provider names (e.g., 'github', 'gmail') to their access tokens
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * const tools = getVercelAITools(serverClient, {
29
+ * providerTokens: {
30
+ * github: 'ghp_...',
31
+ * gmail: 'ya29...'
32
+ * }
33
+ * });
34
+ * ```
35
+ */
36
+ providerTokens?: Record<string, string>;
37
+ }
38
+ /**
39
+ * Convert a single MCP tool to Vercel AI SDK format
40
+ *
41
+ * @param mcpTool - The MCP tool definition
42
+ * @param client - The MCP client instance (used for executing the tool)
43
+ * @param options - Optional configuration including provider tokens
44
+ * @returns Vercel AI SDK compatible tool definition
45
+ */
46
+ export declare function convertMCPToolToVercelAI(mcpTool: MCPTool, client: MCPClient<any>, options?: VercelAIToolsOptions): VercelAITool;
47
+ /**
48
+ * Convert all enabled MCP tools to Vercel AI SDK v5 format
49
+ *
50
+ * @param client - The MCP client instance (must be connected)
51
+ * @param options - Optional configuration including provider tokens for server-side usage
52
+ * @returns Object mapping tool names to Vercel AI SDK v5 tool definitions (compatible with CoreTool from 'ai' package v5)
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * // Client-side usage
57
+ * import { createMCPClient, githubPlugin } from 'integrate-sdk';
58
+ * import { convertMCPToolsToVercelAI } from 'integrate-sdk/vercel-ai';
59
+ * import { generateText } from 'ai';
60
+ *
61
+ * const mcpClient = createMCPClient({
62
+ * plugins: [githubPlugin({ clientId: '...', clientSecret: '...' })],
63
+ * });
64
+ *
65
+ * await mcpClient.connect();
66
+ *
67
+ * const tools = convertMCPToolsToVercelAI(mcpClient);
68
+ *
69
+ * const result = await generateText({
70
+ * model: openai('gpt-5'),
71
+ * prompt: 'Create a GitHub issue in my repo',
72
+ * tools,
73
+ * });
74
+ * ```
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * // Server-side usage with token passing
79
+ * import { createMCPServer, githubPlugin } from 'integrate-sdk/server';
80
+ * import { convertMCPToolsToVercelAI } from 'integrate-sdk/vercel-ai';
81
+ *
82
+ * const { client: serverClient } = createMCPServer({
83
+ * plugins: [githubPlugin({ clientId: '...', clientSecret: '...' })],
84
+ * });
85
+ *
86
+ * // In your API route handler
87
+ * export async function POST(req: Request) {
88
+ * const providerTokens = JSON.parse(req.headers.get('x-integrate-tokens') || '{}');
89
+ *
90
+ * const tools = convertMCPToolsToVercelAI(serverClient, { providerTokens });
91
+ *
92
+ * const result = await generateText({
93
+ * model: openai('gpt-4'),
94
+ * prompt: 'Create a GitHub issue',
95
+ * tools,
96
+ * });
97
+ *
98
+ * return Response.json(result);
99
+ * }
100
+ * ```
101
+ */
102
+ export declare function convertMCPToolsToVercelAI(client: MCPClient<any>, options?: VercelAIToolsOptions): Record<string, any>;
103
+ /**
104
+ * Get tools in a format compatible with Vercel AI SDK v5's tools parameter
105
+ *
106
+ * This returns the tools in the exact format expected by ai.generateText() and ai.streamText()
107
+ * Automatically connects the client if not already connected.
108
+ *
109
+ * @param client - The MCP client instance
110
+ * @param options - Optional configuration including provider tokens for server-side usage
111
+ * @returns Tools object ready to pass to generateText({ tools: ... }) or streamText({ tools: ... })
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * // Client-side usage
116
+ * const tools = await getVercelAITools(mcpClient);
117
+ * ```
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * // Server-side usage with tokens from client
122
+ * const providerTokens = JSON.parse(req.headers.get('x-integrate-tokens') || '{}');
123
+ * const tools = await getVercelAITools(serverClient, { providerTokens });
124
+ * ```
125
+ */
126
+ export declare function getVercelAITools(client: MCPClient<any>, options?: VercelAIToolsOptions): Promise<Record<string, any>>;
127
+ //# sourceMappingURL=vercel-ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../../src/integrations/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;AAEvD;;;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,OAAO,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;;OAaG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAmKD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,YAAY,CAsCd;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;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,oBAAoB,gCAQ/B"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Generic OAuth Plugin
3
+ * Configure OAuth and enable tools for any integration supported by the server
4
+ */
5
+ import type { MCPPlugin } from "./types.js";
6
+ /**
7
+ * Generic OAuth plugin configuration
8
+ */
9
+ export interface GenericOAuthPluginConfig {
10
+ /** Plugin unique identifier (must match the integration ID on the server) */
11
+ id: string;
12
+ /** OAuth provider name */
13
+ provider: string;
14
+ /** OAuth client ID (defaults to {PROVIDER}_CLIENT_ID env var) */
15
+ clientId?: string;
16
+ /** OAuth client secret (defaults to {PROVIDER}_CLIENT_SECRET env var) */
17
+ clientSecret?: string;
18
+ /** OAuth scopes */
19
+ scopes: string[];
20
+ /** Tool names to enable from the server (must exist on the server) */
21
+ tools: string[];
22
+ /** OAuth redirect URI */
23
+ redirectUri?: string;
24
+ /** Additional provider-specific configuration */
25
+ config?: Record<string, unknown>;
26
+ /** Optional initialization callback */
27
+ onInit?: (client: any) => Promise<void> | void;
28
+ /** Optional after connect callback */
29
+ onAfterConnect?: (client: any) => Promise<void> | void;
30
+ /** Optional disconnect callback */
31
+ onDisconnect?: (client: any) => Promise<void> | void;
32
+ }
33
+ /**
34
+ * Generic OAuth Plugin
35
+ *
36
+ * Configure OAuth and enable tools for any integration supported by the Integrate MCP server.
37
+ * Note: This does NOT create new tools - it only configures access to existing server-side tools.
38
+ * All tools must be implemented on the server and exposed via the MCP protocol.
39
+ *
40
+ * By default, reads {PROVIDER}_CLIENT_ID and {PROVIDER}_CLIENT_SECRET from environment variables
41
+ * (e.g., SLACK_CLIENT_ID, SLACK_CLIENT_SECRET). You can override these by providing explicit values.
42
+ *
43
+ * @example Minimal (uses env vars):
44
+ * ```typescript
45
+ * // Automatically uses SLACK_CLIENT_ID and SLACK_CLIENT_SECRET from env
46
+ * const slackPlugin = genericOAuthPlugin({
47
+ * id: 'slack',
48
+ * provider: 'slack',
49
+ * scopes: ['chat:write', 'channels:read'],
50
+ * tools: [
51
+ * 'slack_send_message', // Must exist on server
52
+ * 'slack_list_channels', // Must exist on server
53
+ * ],
54
+ * });
55
+ *
56
+ * const client = createMCPClient({
57
+ * plugins: [slackPlugin],
58
+ * });
59
+ *
60
+ * await client.connect();
61
+ * // Call server tools using _callToolByName
62
+ * await client._callToolByName('slack_send_message', { channel: '#general', text: 'Hello' });
63
+ * ```
64
+ *
65
+ * @example With explicit override:
66
+ * ```typescript
67
+ * const slackPlugin = genericOAuthPlugin({
68
+ * id: 'slack',
69
+ * provider: 'slack',
70
+ * clientId: process.env.CUSTOM_SLACK_ID!,
71
+ * clientSecret: process.env.CUSTOM_SLACK_SECRET!,
72
+ * scopes: ['chat:write', 'channels:read'],
73
+ * tools: ['slack_send_message', 'slack_list_channels'],
74
+ * });
75
+ * ```
76
+ */
77
+ export declare function genericOAuthPlugin(config: GenericOAuthPluginConfig): MCPPlugin;
78
+ /**
79
+ * Create a simple plugin without OAuth
80
+ * Enable server-provided tools that don't require authentication
81
+ * Note: Tools must exist on the server - this does not create new tools
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * // Enable server-provided math tools (if they exist on the server)
86
+ * const mathPlugin = createSimplePlugin({
87
+ * id: 'math',
88
+ * tools: ['math_add', 'math_subtract', 'math_multiply', 'math_divide'],
89
+ * });
90
+ * ```
91
+ */
92
+ export declare function createSimplePlugin(config: {
93
+ id: string;
94
+ tools: string[];
95
+ onInit?: (client: any) => Promise<void> | void;
96
+ onAfterConnect?: (client: any) => Promise<void> | void;
97
+ onDisconnect?: (client: any) => Promise<void> | void;
98
+ }): MCPPlugin;
99
+ //# sourceMappingURL=generic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../../src/plugins/generic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,sEAAsE;IACtE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,uCAAuC;IACvC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/C,sCAAsC;IACtC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvD,mCAAmC;IACnC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;C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