integrate-sdk 0.3.7 → 0.3.8

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 (40) hide show
  1. package/dist/index.js +40 -0
  2. package/dist/server.js +15 -0
  3. package/dist/src/adapters/nextjs-oauth-redirect.d.ts +34 -0
  4. package/dist/src/adapters/nextjs-oauth-redirect.d.ts.map +1 -0
  5. package/dist/src/index.d.ts +3 -1
  6. package/dist/src/index.d.ts.map +1 -1
  7. package/dist/src/oauth/types.d.ts +0 -9
  8. package/dist/src/oauth/types.d.ts.map +1 -1
  9. package/dist/src/oauth/window-manager.d.ts +1 -1
  10. package/dist/src/oauth/window-manager.d.ts.map +1 -1
  11. package/package.json +3 -15
  12. package/dist/src/adapters/nextjs-callback.d.ts +0 -44
  13. package/dist/src/adapters/nextjs-callback.d.ts.map +0 -1
  14. package/src/adapters/auto-routes.ts +0 -217
  15. package/src/adapters/base-handler.ts +0 -212
  16. package/src/adapters/nextjs-callback.tsx +0 -160
  17. package/src/adapters/nextjs.ts +0 -318
  18. package/src/adapters/tanstack-start.ts +0 -264
  19. package/src/client.ts +0 -952
  20. package/src/config/types.ts +0 -180
  21. package/src/errors.ts +0 -207
  22. package/src/index.ts +0 -110
  23. package/src/integrations/vercel-ai.ts +0 -104
  24. package/src/oauth/manager.ts +0 -307
  25. package/src/oauth/pkce.ts +0 -127
  26. package/src/oauth/types.ts +0 -101
  27. package/src/oauth/window-manager.ts +0 -322
  28. package/src/plugins/generic.ts +0 -119
  29. package/src/plugins/github-client.ts +0 -345
  30. package/src/plugins/github.ts +0 -122
  31. package/src/plugins/gmail-client.ts +0 -114
  32. package/src/plugins/gmail.ts +0 -108
  33. package/src/plugins/server-client.ts +0 -20
  34. package/src/plugins/types.ts +0 -89
  35. package/src/protocol/jsonrpc.ts +0 -88
  36. package/src/protocol/messages.ts +0 -145
  37. package/src/server.ts +0 -117
  38. package/src/transport/http-session.ts +0 -322
  39. package/src/transport/http-stream.ts +0 -331
  40. package/src/utils/naming.ts +0 -52
@@ -1,345 +0,0 @@
1
- /**
2
- * GitHub Plugin Client Types
3
- * Fully typed interface for GitHub plugin methods
4
- */
5
-
6
- import type { MCPToolCallResponse } from "../protocol/messages.js";
7
-
8
- /**
9
- * GitHub Issue
10
- */
11
- export interface GitHubIssue {
12
- number: number;
13
- title: string;
14
- body?: string;
15
- state: "open" | "closed";
16
- html_url: string;
17
- user?: {
18
- login: string;
19
- avatar_url: string;
20
- };
21
- created_at: string;
22
- updated_at: string;
23
- closed_at?: string;
24
- labels?: Array<{
25
- name: string;
26
- color: string;
27
- }>;
28
- }
29
-
30
- /**
31
- * GitHub Pull Request
32
- */
33
- export interface GitHubPullRequest {
34
- number: number;
35
- title: string;
36
- body?: string;
37
- state: "open" | "closed" | "merged";
38
- html_url: string;
39
- user?: {
40
- login: string;
41
- avatar_url: string;
42
- };
43
- created_at: string;
44
- updated_at: string;
45
- merged_at?: string;
46
- head: {
47
- ref: string;
48
- sha: string;
49
- };
50
- base: {
51
- ref: string;
52
- sha: string;
53
- };
54
- }
55
-
56
- /**
57
- * GitHub Repository
58
- */
59
- export interface GitHubRepository {
60
- id: number;
61
- name: string;
62
- full_name: string;
63
- description?: string;
64
- html_url: string;
65
- private: boolean;
66
- owner: {
67
- login: string;
68
- avatar_url: string;
69
- };
70
- created_at: string;
71
- updated_at: string;
72
- pushed_at: string;
73
- stargazers_count: number;
74
- watchers_count: number;
75
- forks_count: number;
76
- language?: string;
77
- default_branch: string;
78
- }
79
-
80
- /**
81
- * GitHub Branch
82
- */
83
- export interface GitHubBranch {
84
- name: string;
85
- commit: {
86
- sha: string;
87
- url: string;
88
- };
89
- protected: boolean;
90
- }
91
-
92
- /**
93
- * GitHub User
94
- */
95
- export interface GitHubUser {
96
- login: string;
97
- id: number;
98
- avatar_url: string;
99
- html_url: string;
100
- name?: string;
101
- email?: string;
102
- bio?: string;
103
- public_repos: number;
104
- followers: number;
105
- following: number;
106
- created_at: string;
107
- }
108
-
109
- /**
110
- * GitHub Commit
111
- */
112
- export interface GitHubCommit {
113
- sha: string;
114
- commit: {
115
- message: string;
116
- author: {
117
- name: string;
118
- email: string;
119
- date: string;
120
- };
121
- committer: {
122
- name: string;
123
- email: string;
124
- date: string;
125
- };
126
- };
127
- html_url: string;
128
- author?: {
129
- login: string;
130
- avatar_url: string;
131
- };
132
- committer?: {
133
- login: string;
134
- avatar_url: string;
135
- };
136
- }
137
-
138
- /**
139
- * GitHub Plugin Client Interface
140
- * Provides type-safe methods for all GitHub operations
141
- */
142
- export interface GitHubPluginClient {
143
- /**
144
- * Create a new issue in a repository
145
- */
146
- createIssue(params: {
147
- owner: string;
148
- repo: string;
149
- title: string;
150
- body?: string;
151
- labels?: string[];
152
- assignees?: string[];
153
- }): Promise<MCPToolCallResponse>;
154
-
155
- /**
156
- * List issues in a repository
157
- */
158
- listIssues(params: {
159
- owner: string;
160
- repo: string;
161
- state?: "open" | "closed" | "all";
162
- labels?: string[];
163
- sort?: "created" | "updated" | "comments";
164
- direction?: "asc" | "desc";
165
- per_page?: number;
166
- page?: number;
167
- }): Promise<MCPToolCallResponse>;
168
-
169
- /**
170
- * Get a specific issue
171
- */
172
- getIssue(params: {
173
- owner: string;
174
- repo: string;
175
- issue_number: number;
176
- }): Promise<MCPToolCallResponse>;
177
-
178
- /**
179
- * Update an existing issue
180
- */
181
- updateIssue(params: {
182
- owner: string;
183
- repo: string;
184
- issue_number: number;
185
- title?: string;
186
- body?: string;
187
- state?: "open" | "closed";
188
- labels?: string[];
189
- assignees?: string[];
190
- }): Promise<MCPToolCallResponse>;
191
-
192
- /**
193
- * Close an issue
194
- */
195
- closeIssue(params: {
196
- owner: string;
197
- repo: string;
198
- issue_number: number;
199
- }): Promise<MCPToolCallResponse>;
200
-
201
- /**
202
- * Create a pull request
203
- */
204
- createPullRequest(params: {
205
- owner: string;
206
- repo: string;
207
- title: string;
208
- head: string;
209
- base: string;
210
- body?: string;
211
- draft?: boolean;
212
- }): Promise<MCPToolCallResponse>;
213
-
214
- /**
215
- * List pull requests in a repository
216
- */
217
- listPullRequests(params: {
218
- owner: string;
219
- repo: string;
220
- state?: "open" | "closed" | "all";
221
- sort?: "created" | "updated" | "popularity" | "long-running";
222
- direction?: "asc" | "desc";
223
- per_page?: number;
224
- page?: number;
225
- }): Promise<MCPToolCallResponse>;
226
-
227
- /**
228
- * Get a specific pull request
229
- */
230
- getPullRequest(params: {
231
- owner: string;
232
- repo: string;
233
- pull_number: number;
234
- }): Promise<MCPToolCallResponse>;
235
-
236
- /**
237
- * Merge a pull request
238
- */
239
- mergePullRequest(params: {
240
- owner: string;
241
- repo: string;
242
- pull_number: number;
243
- commit_title?: string;
244
- commit_message?: string;
245
- merge_method?: "merge" | "squash" | "rebase";
246
- }): Promise<MCPToolCallResponse>;
247
-
248
- /**
249
- * List repositories (for a user or organization)
250
- */
251
- listRepos(params: {
252
- owner: string;
253
- type?: "all" | "owner" | "member";
254
- sort?: "created" | "updated" | "pushed" | "full_name";
255
- direction?: "asc" | "desc";
256
- per_page?: number;
257
- page?: number;
258
- }): Promise<MCPToolCallResponse>;
259
-
260
- /**
261
- * List repositories for the authenticated user
262
- */
263
- listOwnRepos(params?: {
264
- visibility?: "all" | "public" | "private";
265
- affiliation?: string;
266
- type?: "all" | "owner" | "public" | "private" | "member";
267
- sort?: "created" | "updated" | "pushed" | "full_name";
268
- direction?: "asc" | "desc";
269
- per_page?: number;
270
- page?: number;
271
- }): Promise<MCPToolCallResponse>;
272
-
273
- /**
274
- * Get a specific repository
275
- */
276
- getRepo(params: {
277
- owner: string;
278
- repo: string;
279
- }): Promise<MCPToolCallResponse>;
280
-
281
- /**
282
- * Create a new repository
283
- */
284
- createRepo(params: {
285
- name: string;
286
- description?: string;
287
- private?: boolean;
288
- auto_init?: boolean;
289
- gitignore_template?: string;
290
- license_template?: string;
291
- }): Promise<MCPToolCallResponse>;
292
-
293
- /**
294
- * List branches in a repository
295
- */
296
- listBranches(params: {
297
- owner: string;
298
- repo: string;
299
- protected?: boolean;
300
- per_page?: number;
301
- page?: number;
302
- }): Promise<MCPToolCallResponse>;
303
-
304
- /**
305
- * Create a new branch
306
- */
307
- createBranch(params: {
308
- owner: string;
309
- repo: string;
310
- branch: string;
311
- from_branch?: string;
312
- }): Promise<MCPToolCallResponse>;
313
-
314
- /**
315
- * Get information about a user
316
- */
317
- getUser(params: {
318
- username: string;
319
- }): Promise<MCPToolCallResponse>;
320
-
321
- /**
322
- * List commits in a repository
323
- */
324
- listCommits(params: {
325
- owner: string;
326
- repo: string;
327
- sha?: string;
328
- path?: string;
329
- author?: string;
330
- since?: string;
331
- until?: string;
332
- per_page?: number;
333
- page?: number;
334
- }): Promise<MCPToolCallResponse>;
335
-
336
- /**
337
- * Get a specific commit
338
- */
339
- getCommit(params: {
340
- owner: string;
341
- repo: string;
342
- ref: string;
343
- }): Promise<MCPToolCallResponse>;
344
- }
345
-
@@ -1,122 +0,0 @@
1
- /**
2
- * GitHub Plugin
3
- * Enables GitHub tools with OAuth configuration
4
- */
5
-
6
- import type { MCPPlugin, OAuthConfig } from "./types.js";
7
-
8
- /**
9
- * GitHub plugin configuration
10
- *
11
- * SERVER-SIDE: Include clientId and clientSecret when using createMCPServer()
12
- * CLIENT-SIDE: Omit clientId and clientSecret when using createMCPClient()
13
- */
14
- export interface GitHubPluginConfig {
15
- /** GitHub OAuth client ID (required on server, omit on client) */
16
- clientId?: string;
17
- /** GitHub OAuth client secret (required on server, omit on client) */
18
- clientSecret?: string;
19
- /** Additional OAuth scopes (default: ['repo', 'user']) */
20
- scopes?: string[];
21
- /** OAuth redirect URI */
22
- redirectUri?: string;
23
- /** GitHub API base URL (default: https://api.github.com) */
24
- apiBaseUrl?: string;
25
- }
26
-
27
- /**
28
- * Default GitHub tools that this plugin enables
29
- * These should match the tool names exposed by your MCP server
30
- */
31
- const GITHUB_TOOLS = [
32
- "github_create_issue",
33
- "github_list_issues",
34
- "github_get_issue",
35
- "github_update_issue",
36
- "github_close_issue",
37
- "github_create_pull_request",
38
- "github_list_pull_requests",
39
- "github_get_pull_request",
40
- "github_merge_pull_request",
41
- "github_list_repos",
42
- "github_list_own_repos",
43
- "github_get_repo",
44
- "github_create_repo",
45
- "github_list_branches",
46
- "github_create_branch",
47
- "github_get_user",
48
- "github_list_commits",
49
- "github_get_commit",
50
- ] as const;
51
-
52
- /**
53
- * GitHub Plugin
54
- *
55
- * Enables GitHub integration with OAuth authentication
56
- *
57
- * @example Server-side (with secrets):
58
- * ```typescript
59
- * import { createMCPServer, githubPlugin } from 'integrate-sdk/server';
60
- *
61
- * export const { client } = createMCPServer({
62
- * plugins: [
63
- * githubPlugin({
64
- * clientId: process.env.GITHUB_CLIENT_ID!,
65
- * clientSecret: process.env.GITHUB_CLIENT_SECRET!,
66
- * scopes: ['repo', 'user', 'read:org'],
67
- * }),
68
- * ],
69
- * });
70
- * ```
71
- *
72
- * @example Client-side (without secrets):
73
- * ```typescript
74
- * import { createMCPClient, githubPlugin } from 'integrate-sdk';
75
- *
76
- * const client = createMCPClient({
77
- * plugins: [
78
- * githubPlugin({
79
- * scopes: ['repo', 'user', 'read:org'],
80
- * }),
81
- * ],
82
- * });
83
- * ```
84
- */
85
- export function githubPlugin(config: GitHubPluginConfig): MCPPlugin {
86
- const oauth: OAuthConfig = {
87
- provider: "github",
88
- clientId: config.clientId,
89
- clientSecret: config.clientSecret,
90
- scopes: config.scopes || ["repo", "user"],
91
- redirectUri: config.redirectUri,
92
- config: {
93
- apiBaseUrl: config.apiBaseUrl || "https://api.github.com",
94
- ...config,
95
- },
96
- };
97
-
98
- return {
99
- id: "github",
100
- tools: [...GITHUB_TOOLS],
101
- oauth,
102
-
103
- async onInit(_client) {
104
- console.log("GitHub plugin initialized");
105
- },
106
-
107
- async onAfterConnect(_client) {
108
- console.log("GitHub plugin connected");
109
- },
110
- };
111
- }
112
-
113
- /**
114
- * Export tool names for type inference
115
- */
116
- export type GitHubTools = typeof GITHUB_TOOLS[number];
117
-
118
- /**
119
- * Export GitHub client types
120
- */
121
- export type { GitHubPluginClient } from "./github-client.js";
122
-
@@ -1,114 +0,0 @@
1
- /**
2
- * Gmail Plugin Client Types
3
- * Fully typed interface for Gmail plugin methods
4
- */
5
-
6
- import type { MCPToolCallResponse } from "../protocol/messages.js";
7
-
8
- /**
9
- * Gmail Email Message
10
- */
11
- export interface GmailMessage {
12
- id: string;
13
- threadId: string;
14
- labelIds?: string[];
15
- snippet?: string;
16
- payload?: {
17
- headers?: Array<{
18
- name: string;
19
- value: string;
20
- }>;
21
- body?: {
22
- data?: string;
23
- size?: number;
24
- };
25
- parts?: Array<{
26
- mimeType?: string;
27
- body?: {
28
- data?: string;
29
- size?: number;
30
- };
31
- }>;
32
- };
33
- sizeEstimate?: number;
34
- historyId?: string;
35
- internalDate?: string;
36
- }
37
-
38
- /**
39
- * Gmail Label
40
- */
41
- export interface GmailLabel {
42
- id: string;
43
- name: string;
44
- type?: "system" | "user";
45
- messageListVisibility?: "show" | "hide";
46
- labelListVisibility?: "labelShow" | "labelShowIfUnread" | "labelHide";
47
- color?: {
48
- textColor?: string;
49
- backgroundColor?: string;
50
- };
51
- }
52
-
53
- /**
54
- * Gmail Draft
55
- */
56
- export interface GmailDraft {
57
- id: string;
58
- message: GmailMessage;
59
- }
60
-
61
- /**
62
- * Gmail Plugin Client Interface
63
- * Provides type-safe methods for all Gmail operations
64
- */
65
- export interface GmailPluginClient {
66
- /**
67
- * Send a message
68
- */
69
- sendMessage(params: {
70
- to: string | string[];
71
- subject: string;
72
- body: string;
73
- cc?: string | string[];
74
- bcc?: string | string[];
75
- from?: string;
76
- replyTo?: string;
77
- html?: boolean;
78
- attachments?: Array<{
79
- filename: string;
80
- content: string;
81
- encoding?: string;
82
- }>;
83
- }): Promise<MCPToolCallResponse>;
84
-
85
- /**
86
- * List messages in the mailbox
87
- */
88
- listMessages(params?: {
89
- maxResults?: number;
90
- pageToken?: string;
91
- q?: string;
92
- labelIds?: string[];
93
- includeSpamTrash?: boolean;
94
- }): Promise<MCPToolCallResponse>;
95
-
96
- /**
97
- * Get a specific message by ID
98
- */
99
- getMessage(params: {
100
- id: string;
101
- format?: "minimal" | "full" | "raw" | "metadata";
102
- }): Promise<MCPToolCallResponse>;
103
-
104
- /**
105
- * Search messages with query
106
- */
107
- searchMessages(params: {
108
- query: string;
109
- maxResults?: number;
110
- pageToken?: string;
111
- includeSpamTrash?: boolean;
112
- }): Promise<MCPToolCallResponse>;
113
- }
114
-
@@ -1,108 +0,0 @@
1
- /**
2
- * Gmail Plugin
3
- * Enables Gmail tools with OAuth configuration
4
- */
5
-
6
- import type { MCPPlugin, OAuthConfig } from "./types.js";
7
-
8
- /**
9
- * Gmail plugin configuration
10
- *
11
- * SERVER-SIDE: Include clientId and clientSecret when using createMCPServer()
12
- * CLIENT-SIDE: Omit clientId and clientSecret when using createMCPClient()
13
- */
14
- export interface GmailPluginConfig {
15
- /** Google OAuth client ID (required on server, omit on client) */
16
- clientId?: string;
17
- /** Google OAuth client secret (required on server, omit on client) */
18
- clientSecret?: string;
19
- /** Additional OAuth scopes (default: Gmail API scopes) */
20
- scopes?: string[];
21
- /** OAuth redirect URI */
22
- redirectUri?: string;
23
- }
24
-
25
- /**
26
- * Default Gmail tools that this plugin enables
27
- * These should match the tool names exposed by your MCP server
28
- */
29
- const GMAIL_TOOLS = [
30
- "gmail_send_message",
31
- "gmail_list_messages",
32
- "gmail_get_message",
33
- "gmail_search_messages",
34
- ] as const;
35
-
36
- /**
37
- * Gmail Plugin
38
- *
39
- * Enables Gmail integration with OAuth authentication
40
- *
41
- * @example Server-side (with secrets):
42
- * ```typescript
43
- * import { createMCPServer, gmailPlugin } from 'integrate-sdk/server';
44
- *
45
- * export const { client } = createMCPServer({
46
- * plugins: [
47
- * gmailPlugin({
48
- * clientId: process.env.GMAIL_CLIENT_ID!,
49
- * clientSecret: process.env.GMAIL_CLIENT_SECRET!,
50
- * scopes: ['gmail.send', 'gmail.readonly'],
51
- * }),
52
- * ],
53
- * });
54
- * ```
55
- *
56
- * @example Client-side (without secrets):
57
- * ```typescript
58
- * import { createMCPClient, gmailPlugin } from 'integrate-sdk';
59
- *
60
- * const client = createMCPClient({
61
- * plugins: [
62
- * gmailPlugin({
63
- * scopes: ['gmail.send', 'gmail.readonly'],
64
- * }),
65
- * ],
66
- * });
67
- * ```
68
- */
69
- export function gmailPlugin(config: GmailPluginConfig): MCPPlugin {
70
- const oauth: OAuthConfig = {
71
- provider: "google",
72
- clientId: config.clientId,
73
- clientSecret: config.clientSecret,
74
- scopes: config.scopes || [
75
- "https://www.googleapis.com/auth/gmail.send",
76
- "https://www.googleapis.com/auth/gmail.readonly",
77
- "https://www.googleapis.com/auth/gmail.modify",
78
- "https://www.googleapis.com/auth/gmail.labels",
79
- ],
80
- redirectUri: config.redirectUri,
81
- config,
82
- };
83
-
84
- return {
85
- id: "gmail",
86
- tools: [...GMAIL_TOOLS],
87
- oauth,
88
-
89
- async onInit(_client) {
90
- console.log("Gmail plugin initialized");
91
- },
92
-
93
- async onAfterConnect(_client) {
94
- console.log("Gmail plugin connected");
95
- },
96
- };
97
- }
98
-
99
- /**
100
- * Export tool names for type inference
101
- */
102
- export type GmailTools = typeof GMAIL_TOOLS[number];
103
-
104
- /**
105
- * Export Gmail client types
106
- */
107
- export type { GmailPluginClient } from "./gmail-client.js";
108
-
@@ -1,20 +0,0 @@
1
- /**
2
- * Server Plugin Client Types
3
- * Fully typed interface for server-level tools that don't belong to a specific plugin
4
- */
5
-
6
- import type { MCPToolCallResponse } from "../protocol/messages.js";
7
-
8
- /**
9
- * Server Plugin Client Interface
10
- * Provides type-safe methods for server-level operations
11
- */
12
- export interface ServerPluginClient {
13
- /**
14
- * List all tools available for a specific integration
15
- */
16
- listToolsByIntegration(params: {
17
- integration: string;
18
- }): Promise<MCPToolCallResponse>;
19
- }
20
-