integrate-sdk 0.7.52 → 0.7.53

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.
@@ -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;CACtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,wBAAwB,GAC/B,SAAS,CAqBX;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC/C,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACvD,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACtD,GAAG,SAAS,CAQZ"}
@@ -0,0 +1,320 @@
1
+ /**
2
+ * GitHub Plugin Client Types
3
+ * Fully typed interface for GitHub plugin methods
4
+ */
5
+ import type { MCPToolCallResponse } from "../protocol/messages.js";
6
+ /**
7
+ * GitHub Issue
8
+ */
9
+ export interface GitHubIssue {
10
+ number: number;
11
+ title: string;
12
+ body?: string;
13
+ state: "open" | "closed";
14
+ html_url: string;
15
+ user?: {
16
+ login: string;
17
+ avatar_url: string;
18
+ };
19
+ created_at: string;
20
+ updated_at: string;
21
+ closed_at?: string;
22
+ labels?: Array<{
23
+ name: string;
24
+ color: string;
25
+ }>;
26
+ }
27
+ /**
28
+ * GitHub Pull Request
29
+ */
30
+ export interface GitHubPullRequest {
31
+ number: number;
32
+ title: string;
33
+ body?: string;
34
+ state: "open" | "closed" | "merged";
35
+ html_url: string;
36
+ user?: {
37
+ login: string;
38
+ avatar_url: string;
39
+ };
40
+ created_at: string;
41
+ updated_at: string;
42
+ merged_at?: string;
43
+ head: {
44
+ ref: string;
45
+ sha: string;
46
+ };
47
+ base: {
48
+ ref: string;
49
+ sha: string;
50
+ };
51
+ }
52
+ /**
53
+ * GitHub Repository
54
+ */
55
+ export interface GitHubRepository {
56
+ id: number;
57
+ name: string;
58
+ full_name: string;
59
+ description?: string;
60
+ html_url: string;
61
+ private: boolean;
62
+ owner: {
63
+ login: string;
64
+ avatar_url: string;
65
+ };
66
+ created_at: string;
67
+ updated_at: string;
68
+ pushed_at: string;
69
+ stargazers_count: number;
70
+ watchers_count: number;
71
+ forks_count: number;
72
+ language?: string;
73
+ default_branch: string;
74
+ }
75
+ /**
76
+ * GitHub Branch
77
+ */
78
+ export interface GitHubBranch {
79
+ name: string;
80
+ commit: {
81
+ sha: string;
82
+ url: string;
83
+ };
84
+ protected: boolean;
85
+ }
86
+ /**
87
+ * GitHub User
88
+ */
89
+ export interface GitHubUser {
90
+ login: string;
91
+ id: number;
92
+ avatar_url: string;
93
+ html_url: string;
94
+ name?: string;
95
+ email?: string;
96
+ bio?: string;
97
+ public_repos: number;
98
+ followers: number;
99
+ following: number;
100
+ created_at: string;
101
+ }
102
+ /**
103
+ * GitHub Commit
104
+ */
105
+ export interface GitHubCommit {
106
+ sha: string;
107
+ commit: {
108
+ message: string;
109
+ author: {
110
+ name: string;
111
+ email: string;
112
+ date: string;
113
+ };
114
+ committer: {
115
+ name: string;
116
+ email: string;
117
+ date: string;
118
+ };
119
+ };
120
+ html_url: string;
121
+ author?: {
122
+ login: string;
123
+ avatar_url: string;
124
+ };
125
+ committer?: {
126
+ login: string;
127
+ avatar_url: string;
128
+ };
129
+ }
130
+ /**
131
+ * GitHub Plugin Client Interface
132
+ * Provides type-safe methods for all GitHub operations
133
+ */
134
+ export interface GitHubPluginClient {
135
+ /**
136
+ * Create a new issue in a repository
137
+ */
138
+ createIssue(params: {
139
+ owner: string;
140
+ repo: string;
141
+ title: string;
142
+ body?: string;
143
+ labels?: string[];
144
+ assignees?: string[];
145
+ }): Promise<MCPToolCallResponse>;
146
+ /**
147
+ * List issues in a repository
148
+ */
149
+ listIssues(params: {
150
+ owner: string;
151
+ repo: string;
152
+ state?: "open" | "closed" | "all";
153
+ labels?: string[];
154
+ sort?: "created" | "updated" | "comments";
155
+ direction?: "asc" | "desc";
156
+ per_page?: number;
157
+ page?: number;
158
+ }): Promise<MCPToolCallResponse>;
159
+ /**
160
+ * Get a specific issue
161
+ */
162
+ getIssue(params: {
163
+ owner: string;
164
+ repo: string;
165
+ issue_number: number;
166
+ }): Promise<MCPToolCallResponse>;
167
+ /**
168
+ * Update an existing issue
169
+ */
170
+ updateIssue(params: {
171
+ owner: string;
172
+ repo: string;
173
+ issue_number: number;
174
+ title?: string;
175
+ body?: string;
176
+ state?: "open" | "closed";
177
+ labels?: string[];
178
+ assignees?: string[];
179
+ }): Promise<MCPToolCallResponse>;
180
+ /**
181
+ * Close an issue
182
+ */
183
+ closeIssue(params: {
184
+ owner: string;
185
+ repo: string;
186
+ issue_number: number;
187
+ }): Promise<MCPToolCallResponse>;
188
+ /**
189
+ * Create a pull request
190
+ */
191
+ createPullRequest(params: {
192
+ owner: string;
193
+ repo: string;
194
+ title: string;
195
+ head: string;
196
+ base: string;
197
+ body?: string;
198
+ draft?: boolean;
199
+ }): Promise<MCPToolCallResponse>;
200
+ /**
201
+ * List pull requests in a repository
202
+ */
203
+ listPullRequests(params: {
204
+ owner: string;
205
+ repo: string;
206
+ state?: "open" | "closed" | "all";
207
+ sort?: "created" | "updated" | "popularity" | "long-running";
208
+ direction?: "asc" | "desc";
209
+ per_page?: number;
210
+ page?: number;
211
+ }): Promise<MCPToolCallResponse>;
212
+ /**
213
+ * Get a specific pull request
214
+ */
215
+ getPullRequest(params: {
216
+ owner: string;
217
+ repo: string;
218
+ pull_number: number;
219
+ }): Promise<MCPToolCallResponse>;
220
+ /**
221
+ * Merge a pull request
222
+ */
223
+ mergePullRequest(params: {
224
+ owner: string;
225
+ repo: string;
226
+ pull_number: number;
227
+ commit_title?: string;
228
+ commit_message?: string;
229
+ merge_method?: "merge" | "squash" | "rebase";
230
+ }): Promise<MCPToolCallResponse>;
231
+ /**
232
+ * List repositories (for a user or organization)
233
+ */
234
+ listRepos(params: {
235
+ owner: string;
236
+ type?: "all" | "owner" | "member";
237
+ sort?: "created" | "updated" | "pushed" | "full_name";
238
+ direction?: "asc" | "desc";
239
+ per_page?: number;
240
+ page?: number;
241
+ }): Promise<MCPToolCallResponse>;
242
+ /**
243
+ * List repositories for the authenticated user
244
+ */
245
+ listOwnRepos(params?: {
246
+ visibility?: "all" | "public" | "private";
247
+ affiliation?: string;
248
+ type?: "all" | "owner" | "public" | "private" | "member";
249
+ sort?: "created" | "updated" | "pushed" | "full_name";
250
+ direction?: "asc" | "desc";
251
+ per_page?: number;
252
+ page?: number;
253
+ }): Promise<MCPToolCallResponse>;
254
+ /**
255
+ * Get a specific repository
256
+ */
257
+ getRepo(params: {
258
+ owner: string;
259
+ repo: string;
260
+ }): Promise<MCPToolCallResponse>;
261
+ /**
262
+ * Create a new repository
263
+ */
264
+ createRepo(params: {
265
+ name: string;
266
+ description?: string;
267
+ private?: boolean;
268
+ auto_init?: boolean;
269
+ gitignore_template?: string;
270
+ license_template?: string;
271
+ }): Promise<MCPToolCallResponse>;
272
+ /**
273
+ * List branches in a repository
274
+ */
275
+ listBranches(params: {
276
+ owner: string;
277
+ repo: string;
278
+ protected?: boolean;
279
+ per_page?: number;
280
+ page?: number;
281
+ }): Promise<MCPToolCallResponse>;
282
+ /**
283
+ * Create a new branch
284
+ */
285
+ createBranch(params: {
286
+ owner: string;
287
+ repo: string;
288
+ branch: string;
289
+ from_branch?: string;
290
+ }): Promise<MCPToolCallResponse>;
291
+ /**
292
+ * Get information about a user
293
+ */
294
+ getUser(params: {
295
+ username: string;
296
+ }): Promise<MCPToolCallResponse>;
297
+ /**
298
+ * List commits in a repository
299
+ */
300
+ listCommits(params: {
301
+ owner: string;
302
+ repo: string;
303
+ sha?: string;
304
+ path?: string;
305
+ author?: string;
306
+ since?: string;
307
+ until?: string;
308
+ per_page?: number;
309
+ page?: number;
310
+ }): Promise<MCPToolCallResponse>;
311
+ /**
312
+ * Get a specific commit
313
+ */
314
+ getCommit(params: {
315
+ owner: string;
316
+ repo: string;
317
+ ref: string;
318
+ }): Promise<MCPToolCallResponse>;
319
+ }
320
+ //# sourceMappingURL=github-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-client.d.ts","sourceRoot":"","sources":["../../../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AAO,CAAC,MAAM,EAAE;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEjC;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEjC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;KACb,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAClC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * GitHub Plugin
3
+ * Enables GitHub tools with OAuth configuration
4
+ */
5
+ import type { MCPPlugin } from "./types.js";
6
+ /**
7
+ * GitHub plugin configuration
8
+ *
9
+ * SERVER-SIDE: Automatically reads GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET from environment.
10
+ * You can override by providing explicit clientId and clientSecret values.
11
+ * CLIENT-SIDE: Omit clientId and clientSecret when using createMCPClient()
12
+ */
13
+ export interface GitHubPluginConfig {
14
+ /** GitHub OAuth client ID (defaults to GITHUB_CLIENT_ID env var) */
15
+ clientId?: string;
16
+ /** GitHub OAuth client secret (defaults to GITHUB_CLIENT_SECRET env var) */
17
+ clientSecret?: string;
18
+ /** Additional OAuth scopes (default: ['repo', 'user']) */
19
+ scopes?: string[];
20
+ /** OAuth redirect URI */
21
+ redirectUri?: string;
22
+ /** GitHub API base URL (default: https://api.github.com) */
23
+ apiBaseUrl?: string;
24
+ }
25
+ /**
26
+ * Default GitHub tools that this plugin enables
27
+ * These should match the tool names exposed by your MCP server
28
+ */
29
+ declare const GITHUB_TOOLS: readonly ["github_create_issue", "github_list_issues", "github_get_issue", "github_update_issue", "github_close_issue", "github_create_pull_request", "github_list_pull_requests", "github_get_pull_request", "github_merge_pull_request", "github_list_repos", "github_list_own_repos", "github_get_repo", "github_create_repo", "github_list_branches", "github_create_branch", "github_get_user", "github_list_commits", "github_get_commit"];
30
+ /**
31
+ * GitHub Plugin
32
+ *
33
+ * Enables GitHub integration with OAuth authentication.
34
+ *
35
+ * By default, reads GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET from environment variables.
36
+ * You can override these by providing explicit values in the config.
37
+ *
38
+ * @example Server-side (minimal - uses env vars):
39
+ * ```typescript
40
+ * import { createMCPServer, githubPlugin } from 'integrate-sdk/server';
41
+ *
42
+ * // Automatically uses GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET from env
43
+ * export const { client } = createMCPServer({
44
+ * plugins: [
45
+ * githubPlugin({
46
+ * scopes: ['repo', 'user', 'read:org'],
47
+ * }),
48
+ * ],
49
+ * });
50
+ * ```
51
+ *
52
+ * @example Server-side (with explicit override):
53
+ * ```typescript
54
+ * import { createMCPServer, githubPlugin } from 'integrate-sdk/server';
55
+ *
56
+ * export const { client } = createMCPServer({
57
+ * plugins: [
58
+ * githubPlugin({
59
+ * clientId: process.env.CUSTOM_GITHUB_ID!,
60
+ * clientSecret: process.env.CUSTOM_GITHUB_SECRET!,
61
+ * scopes: ['repo', 'user', 'read:org'],
62
+ * }),
63
+ * ],
64
+ * });
65
+ * ```
66
+ *
67
+ * @example Client-side (without secrets):
68
+ * ```typescript
69
+ * import { createMCPClient, githubPlugin } from 'integrate-sdk';
70
+ *
71
+ * const client = createMCPClient({
72
+ * plugins: [
73
+ * githubPlugin({
74
+ * scopes: ['repo', 'user', 'read:org'],
75
+ * }),
76
+ * ],
77
+ * });
78
+ * ```
79
+ */
80
+ export declare function githubPlugin(config?: GitHubPluginConfig): MCPPlugin;
81
+ /**
82
+ * Export tool names for type inference
83
+ */
84
+ export type GitHubTools = typeof GITHUB_TOOLS[number];
85
+ /**
86
+ * Export GitHub client types
87
+ */
88
+ export type { GitHubPluginClient } from "./github-client.js";
89
+ //# sourceMappingURL=github.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/plugins/github.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,QAAA,MAAM,YAAY,kbAmBR,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,YAAY,CAAC,MAAM,GAAE,kBAAuB,GAAG,SAAS,CA0BvE;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;AAEtD;;GAEG;AACH,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Gmail Plugin Client Types
3
+ * Fully typed interface for Gmail plugin methods
4
+ */
5
+ import type { MCPToolCallResponse } from "../protocol/messages.js";
6
+ /**
7
+ * Gmail Email Message
8
+ */
9
+ export interface GmailMessage {
10
+ id: string;
11
+ threadId: string;
12
+ labelIds?: string[];
13
+ snippet?: string;
14
+ payload?: {
15
+ headers?: Array<{
16
+ name: string;
17
+ value: string;
18
+ }>;
19
+ body?: {
20
+ data?: string;
21
+ size?: number;
22
+ };
23
+ parts?: Array<{
24
+ mimeType?: string;
25
+ body?: {
26
+ data?: string;
27
+ size?: number;
28
+ };
29
+ }>;
30
+ };
31
+ sizeEstimate?: number;
32
+ historyId?: string;
33
+ internalDate?: string;
34
+ }
35
+ /**
36
+ * Gmail Label
37
+ */
38
+ export interface GmailLabel {
39
+ id: string;
40
+ name: string;
41
+ type?: "system" | "user";
42
+ messageListVisibility?: "show" | "hide";
43
+ labelListVisibility?: "labelShow" | "labelShowIfUnread" | "labelHide";
44
+ color?: {
45
+ textColor?: string;
46
+ backgroundColor?: string;
47
+ };
48
+ }
49
+ /**
50
+ * Gmail Draft
51
+ */
52
+ export interface GmailDraft {
53
+ id: string;
54
+ message: GmailMessage;
55
+ }
56
+ /**
57
+ * Gmail Plugin Client Interface
58
+ * Provides type-safe methods for all Gmail operations
59
+ */
60
+ export interface GmailPluginClient {
61
+ /**
62
+ * Send a message
63
+ */
64
+ sendMessage(params: {
65
+ to: string | string[];
66
+ subject: string;
67
+ body: string;
68
+ cc?: string | string[];
69
+ bcc?: string | string[];
70
+ from?: string;
71
+ replyTo?: string;
72
+ html?: boolean;
73
+ attachments?: Array<{
74
+ filename: string;
75
+ content: string;
76
+ encoding?: string;
77
+ }>;
78
+ }): Promise<MCPToolCallResponse>;
79
+ /**
80
+ * List messages in the mailbox
81
+ */
82
+ listMessages(params?: {
83
+ maxResults?: number;
84
+ pageToken?: string;
85
+ q?: string;
86
+ labelIds?: string[];
87
+ includeSpamTrash?: boolean;
88
+ }): Promise<MCPToolCallResponse>;
89
+ /**
90
+ * Get a specific message by ID
91
+ */
92
+ getMessage(params: {
93
+ id: string;
94
+ format?: "minimal" | "full" | "raw" | "metadata";
95
+ }): Promise<MCPToolCallResponse>;
96
+ /**
97
+ * Search messages with query
98
+ */
99
+ searchMessages(params: {
100
+ query: string;
101
+ maxResults?: number;
102
+ pageToken?: string;
103
+ includeSpamTrash?: boolean;
104
+ }): Promise<MCPToolCallResponse>;
105
+ }
106
+ //# sourceMappingURL=gmail-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gmail-client.d.ts","sourceRoot":"","sources":["../../../src/plugins/gmail-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,KAAK,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;SACf,CAAC,CAAC;QACH,IAAI,CAAC,EAAE;YACL,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CAAC;QACF,KAAK,CAAC,EAAE,KAAK,CAAC;YACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,IAAI,CAAC,EAAE;gBACL,IAAI,CAAC,EAAE,MAAM,CAAC;gBACd,IAAI,CAAC,EAAE,MAAM,CAAC;aACf,CAAC;SACH,CAAC,CAAC;KACJ,CAAC;IACF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,M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,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,UAAU,CAAC;KAClD,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEjC;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;KAC5B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAClC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Gmail Plugin
3
+ * Enables Gmail tools with OAuth configuration
4
+ */
5
+ import type { MCPPlugin } from "./types.js";
6
+ /**
7
+ * Gmail plugin configuration
8
+ *
9
+ * SERVER-SIDE: Automatically reads GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET from environment.
10
+ * You can override by providing explicit clientId and clientSecret values.
11
+ * CLIENT-SIDE: Omit clientId and clientSecret when using createMCPClient()
12
+ */
13
+ export interface GmailPluginConfig {
14
+ /** Google OAuth client ID (defaults to GMAIL_CLIENT_ID env var) */
15
+ clientId?: string;
16
+ /** Google OAuth client secret (defaults to GMAIL_CLIENT_SECRET env var) */
17
+ clientSecret?: string;
18
+ /** Additional OAuth scopes (default: Gmail API scopes) */
19
+ scopes?: string[];
20
+ /** OAuth redirect URI */
21
+ redirectUri?: string;
22
+ }
23
+ /**
24
+ * Default Gmail tools that this plugin enables
25
+ * These should match the tool names exposed by your MCP server
26
+ */
27
+ declare const GMAIL_TOOLS: readonly ["gmail_send_message", "gmail_list_messages", "gmail_get_message", "gmail_search_messages"];
28
+ /**
29
+ * Gmail Plugin
30
+ *
31
+ * Enables Gmail integration with OAuth authentication.
32
+ *
33
+ * By default, reads GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET from environment variables.
34
+ * You can override these by providing explicit values in the config.
35
+ *
36
+ * @example Server-side (minimal - uses env vars):
37
+ * ```typescript
38
+ * import { createMCPServer, gmailPlugin } from 'integrate-sdk/server';
39
+ *
40
+ * // Automatically uses GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET from env
41
+ * export const { client } = createMCPServer({
42
+ * plugins: [
43
+ * gmailPlugin({
44
+ * scopes: ['gmail.send', 'gmail.readonly'],
45
+ * }),
46
+ * ],
47
+ * });
48
+ * ```
49
+ *
50
+ * @example Server-side (with explicit override):
51
+ * ```typescript
52
+ * import { createMCPServer, gmailPlugin } from 'integrate-sdk/server';
53
+ *
54
+ * export const { client } = createMCPServer({
55
+ * plugins: [
56
+ * gmailPlugin({
57
+ * clientId: process.env.CUSTOM_GMAIL_ID!,
58
+ * clientSecret: process.env.CUSTOM_GMAIL_SECRET!,
59
+ * scopes: ['gmail.send', 'gmail.readonly'],
60
+ * }),
61
+ * ],
62
+ * });
63
+ * ```
64
+ *
65
+ * @example Client-side (without secrets):
66
+ * ```typescript
67
+ * import { createMCPClient, gmailPlugin } from 'integrate-sdk';
68
+ *
69
+ * const client = createMCPClient({
70
+ * plugins: [
71
+ * gmailPlugin({
72
+ * scopes: ['gmail.send', 'gmail.readonly'],
73
+ * }),
74
+ * ],
75
+ * });
76
+ * ```
77
+ */
78
+ export declare function gmailPlugin(config?: GmailPluginConfig): MCPPlugin;
79
+ /**
80
+ * Export tool names for type inference
81
+ */
82
+ export type GmailTools = typeof GMAIL_TOOLS[number];
83
+ /**
84
+ * Export Gmail client types
85
+ */
86
+ export type { GmailPluginClient } from "./gmail-client.js";
87
+ //# sourceMappingURL=gmail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gmail.d.ts","sourceRoot":"","sources":["../../../src/plugins/gmail.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,QAAA,MAAM,WAAW,sGAKP,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,WAAW,CAAC,MAAM,GAAE,iBAAsB,GAAG,SAAS,CA4BrE;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC;AAEpD;;GAEG;AACH,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Server Plugin Client Types
3
+ * Fully typed interface for server-level tools that don't belong to a specific plugin
4
+ */
5
+ import type { MCPToolCallResponse } from "../protocol/messages.js";
6
+ /**
7
+ * Server Plugin Client Interface
8
+ * Provides type-safe methods for server-level operations
9
+ */
10
+ export interface ServerPluginClient {
11
+ /**
12
+ * List all tools available for a specific integration
13
+ */
14
+ listToolsByIntegration(params: {
15
+ integration: string;
16
+ }): Promise<MCPToolCallResponse>;
17
+ }
18
+ //# sourceMappingURL=server-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-client.d.ts","sourceRoot":"","sources":["../../../src/plugins/server-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,sBAAsB,CAAC,MAAM,EAAE;QAC7B,WAAW,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAClC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Plugin System Types
3
+ * Inspired by BetterAuth's provider pattern
4
+ */
5
+ import type { MCPClient } from "../client.js";
6
+ /**
7
+ * OAuth Configuration for a plugin
8
+ *
9
+ * CLIENT-SIDE: You no longer need to provide clientId/clientSecret in the browser.
10
+ * These should be kept server-side in your OAuth API routes for security.
11
+ *
12
+ * SERVER-SIDE: OAuth credentials are provided via API route configuration
13
+ * using createNextOAuthHandler() or createTanStackOAuthHandler().
14
+ */
15
+ export interface OAuthConfig {
16
+ /** OAuth provider identifier (e.g., 'github', 'google') */
17
+ provider: string;
18
+ /**
19
+ * OAuth client ID (optional - only needed for legacy direct MCP server calls)
20
+ * @deprecated Keep client ID server-side in OAuth API route configuration
21
+ */
22
+ clientId?: string | undefined;
23
+ /**
24
+ * OAuth client secret (optional - only needed for legacy direct MCP server calls)
25
+ * @deprecated Keep client secret server-side in OAuth API route configuration
26
+ */
27
+ clientSecret?: string | undefined;
28
+ /** Required OAuth scopes */
29
+ scopes: string[];
30
+ /** Redirect URI for OAuth flow */
31
+ redirectUri?: string;
32
+ /** Provider-specific configuration */
33
+ config?: unknown;
34
+ }
35
+ /**
36
+ * MCP Plugin Interface
37
+ *
38
+ * Plugins enable specific tools and configure OAuth providers
39
+ */
40
+ export interface MCPPlugin {
41
+ /** Unique plugin identifier */
42
+ id: string;
43
+ /** List of tool names this plugin enables */
44
+ tools: string[];
45
+ /** OAuth configuration for this plugin */
46
+ oauth?: OAuthConfig;
47
+ /** Called when the plugin is initialized with the client */
48
+ onInit?: (client: MCPClient<any>) => Promise<void> | void;
49
+ /** Called before the client connects to the server */
50
+ onBeforeConnect?: (client: MCPClient<any>) => Promise<void> | void;
51
+ /** Called after the client successfully connects */
52
+ onAfterConnect?: (client: MCPClient<any>) => Promise<void> | void;
53
+ /** Called when the client disconnects */
54
+ onDisconnect?: (client: MCPClient<any>) => Promise<void> | void;
55
+ }
56
+ /**
57
+ * Helper type to extract plugin IDs from an array of plugins
58
+ */
59
+ export type ExtractPluginIds<T extends readonly MCPPlugin[]> = T[number]["id"];
60
+ /**
61
+ * Helper type to extract tools from an array of plugins
62
+ */
63
+ export type ExtractPluginTools<T extends readonly MCPPlugin[]> = T[number]["tools"][number];
64
+ /**
65
+ * Type guard to check if a plugin has OAuth configuration
66
+ */
67
+ export declare function hasOAuthConfig(plugin: MCPPlugin): plugin is MCPPlugin & {
68
+ oauth: OAuthConfig;
69
+ };
70
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAElC,4BAA4B;IAC5B,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IAEX,6CAA6C;IAC7C,KAAK,EAAE,MAAM,EAAE,CAAC;IAEhB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,WAAW,CAAC;IAEpB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAE1D,sDAAsD;IACtD,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAEnE,oDAAoD;IACpD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAElE,yCAAyC;IACzC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACjE;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,SAAS,SAAS,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AAE/E;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,SAAS,SAAS,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5F;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,GAChB,MAAM,IAAI,SAAS,GAAG;IAAE,KAAK,EAAE,WAAW,CAAA;CAAE,CAE9C"}
package/index.ts CHANGED
@@ -34,6 +34,7 @@ export * from './src/index.js';
34
34
  import { createMCPClient } from './src/client.js';
35
35
  import { githubIntegration } from './src/integrations/github.js';
36
36
  import { gmailIntegration } from './src/integrations/gmail.js';
37
+ import { notionIntegration } from './src/integrations/notion.js';
37
38
 
38
39
  /**
39
40
  * Default MCP Client with all integrations pre-configured
@@ -63,6 +64,7 @@ export const client = createMCPClient({
63
64
  integrations: [
64
65
  githubIntegration(),
65
66
  gmailIntegration(),
67
+ notionIntegration(),
66
68
  ],
67
69
  });
68
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "integrate-sdk",
3
- "version": "0.7.52",
3
+ "version": "0.7.53",
4
4
  "description": "Type-safe 3rd party integration SDK for the Integrate MCP server",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",