integrate-sdk 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
# Integrate SDK
|
|
2
2
|
|
|
3
|
-
A type-safe TypeScript SDK for
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
**Server:** `https://mcp.integrate.dev/api/v1/mcp`
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [What is this SDK?](#what-is-this-sdk)
|
|
10
|
+
- [Features](#features)
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Quick Start](#quick-start)
|
|
13
|
+
- [Built-in Plugins](#built-in-plugins)
|
|
14
|
+
- [GitHub Plugin](#github-plugin)
|
|
15
|
+
- [Gmail Plugin](#gmail-plugin)
|
|
16
|
+
- [Creating Custom Plugins](#creating-custom-plugins)
|
|
17
|
+
- [Advanced Usage](#advanced-usage)
|
|
18
|
+
- [API Reference](#api-reference)
|
|
19
|
+
- [Architecture](#architecture)
|
|
20
|
+
- [How It Works](#how-it-works)
|
|
21
|
+
|
|
22
|
+
## What is this SDK?
|
|
23
|
+
|
|
24
|
+
This SDK is a **client library** that connects to the Integrate MCP server to access various third-party integrations.
|
|
25
|
+
|
|
26
|
+
**Key concepts:**
|
|
27
|
+
1. **Connect to the Integrate MCP server** - The SDK connects to `https://mcp.integrate.dev/api/v1/mcp`
|
|
28
|
+
2. **Configure OAuth credentials** - You provide your own OAuth app credentials for each integration (GitHub, Gmail, etc.)
|
|
29
|
+
3. **Call tools** - Execute actions like creating GitHub issues, sending emails, searching Notion pages
|
|
30
|
+
4. **OAuth flow happens server-side** - The SDK sends your OAuth config to the server, which handles the actual authentication flow
|
|
31
|
+
|
|
32
|
+
**Important:** You need to create your own OAuth apps (e.g., GitHub OAuth app, Google OAuth app) and provide the credentials to the SDK. The SDK does not provide OAuth credentials.
|
|
4
33
|
|
|
5
34
|
## Features
|
|
6
35
|
|
|
7
|
-
- 🔌 **Plugin-Based Architecture** - Enable only the
|
|
8
|
-
- 🔒 **Type-Safe
|
|
9
|
-
- 🌊 **
|
|
10
|
-
- 🔐 **OAuth
|
|
11
|
-
- 🛠️ **Extensible** -
|
|
12
|
-
- 📦 **Zero Dependencies** - Lightweight
|
|
36
|
+
- 🔌 **Plugin-Based Architecture** - Enable only the integrations you need
|
|
37
|
+
- 🔒 **Type-Safe** - Full TypeScript support with IntelliSense
|
|
38
|
+
- 🌊 **Real-time Communication** - HTTP streaming with NDJSON
|
|
39
|
+
- 🔐 **OAuth Ready** - Configure OAuth credentials for each provider
|
|
40
|
+
- 🛠️ **Extensible** - Create custom plugins for new integrations
|
|
41
|
+
- 📦 **Zero Dependencies** - Lightweight implementation
|
|
13
42
|
|
|
14
43
|
## Installation
|
|
15
44
|
|
|
16
45
|
```bash
|
|
46
|
+
npm install integrate-sdk
|
|
47
|
+
# or
|
|
17
48
|
bun add integrate-sdk
|
|
18
49
|
```
|
|
19
50
|
|
|
@@ -133,10 +164,10 @@ const slackPlugin = genericOAuthPlugin({
|
|
|
133
164
|
clientSecret: process.env.SLACK_CLIENT_SECRET!,
|
|
134
165
|
scopes: ['chat:write', 'channels:read', 'users:read'],
|
|
135
166
|
tools: [
|
|
136
|
-
'
|
|
137
|
-
'
|
|
138
|
-
'
|
|
139
|
-
'
|
|
167
|
+
'slack_send_message',
|
|
168
|
+
'slack_list_channels',
|
|
169
|
+
'slack_get_channel',
|
|
170
|
+
'slack_invite_user',
|
|
140
171
|
],
|
|
141
172
|
redirectUri: 'https://your-app.com/callback',
|
|
142
173
|
});
|
|
@@ -155,7 +186,7 @@ import { createSimplePlugin } from 'integrate-sdk';
|
|
|
155
186
|
|
|
156
187
|
const mathPlugin = createSimplePlugin({
|
|
157
188
|
id: 'math',
|
|
158
|
-
tools: ['
|
|
189
|
+
tools: ['math_add', 'math_subtract', 'math_multiply', 'math_divide'],
|
|
159
190
|
onInit: async (client) => {
|
|
160
191
|
console.log('Math plugin initialized');
|
|
161
192
|
},
|
|
@@ -170,7 +201,7 @@ import type { MCPPlugin } from 'integrate-sdk';
|
|
|
170
201
|
export function customPlugin(config: CustomConfig): MCPPlugin {
|
|
171
202
|
return {
|
|
172
203
|
id: 'custom',
|
|
173
|
-
tools: ['
|
|
204
|
+
tools: ['custom_tool1', 'custom_tool2'],
|
|
174
205
|
oauth: {
|
|
175
206
|
provider: 'custom-provider',
|
|
176
207
|
clientId: config.clientId,
|
|
@@ -345,29 +376,21 @@ The SDK uses HTTP streaming with newline-delimited JSON (NDJSON) for bidirection
|
|
|
345
376
|
- Automatic heartbeat to keep connection alive
|
|
346
377
|
- Compatible with MCP's `StreamableHTTPServer`
|
|
347
378
|
|
|
348
|
-
##
|
|
379
|
+
## How It Works
|
|
349
380
|
|
|
350
|
-
|
|
381
|
+
1. **Client Configuration**: You configure the SDK with plugins for the integrations you want to use (GitHub, Gmail, etc.)
|
|
382
|
+
2. **Connection**: The SDK connects to `https://mcp.integrate.dev/api/v1/mcp` using HTTP streaming (NDJSON)
|
|
383
|
+
3. **Tool Discovery**: The SDK fetches available tools from the server and filters them based on your enabled plugins
|
|
384
|
+
4. **OAuth Configuration**: Your OAuth credentials are stored in the client configuration (not sent to the server yet)
|
|
385
|
+
5. **Tool Calls**: When you call a tool, the SDK sends a JSON-RPC request to the server
|
|
386
|
+
6. **OAuth Flow**: The server uses your OAuth configuration to authenticate and execute the tool
|
|
351
387
|
|
|
352
|
-
|
|
353
|
-
- Accepts HTTP POST with streaming request body (NDJSON format)
|
|
354
|
-
- Returns streaming response body (NDJSON format)
|
|
355
|
-
- Supports bidirectional communication over a single persistent connection
|
|
356
|
-
- Messages are newline-delimited JSON (one JSON object per line)
|
|
388
|
+
## Server Information
|
|
357
389
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
**Example Go server setup:**
|
|
364
|
-
```go
|
|
365
|
-
httpServer := server.NewStreamableHTTPServer(s,
|
|
366
|
-
server.WithEndpointPath("/api/v1/mcp"),
|
|
367
|
-
server.WithHeartbeatInterval(30*time.Second),
|
|
368
|
-
server.WithStateLess(false),
|
|
369
|
-
)
|
|
370
|
-
```
|
|
390
|
+
**Endpoint:** `https://mcp.integrate.dev/api/v1/mcp`
|
|
391
|
+
**Protocol:** MCP (Model Context Protocol) over HTTP streaming
|
|
392
|
+
**Format:** Newline-delimited JSON (NDJSON)
|
|
393
|
+
**Methods:** `initialize`, `tools/list`, `tools/call`
|
|
371
394
|
|
|
372
395
|
## TypeScript Support
|
|
373
396
|
|
|
@@ -394,9 +417,9 @@ const result: MCPToolCallResponse = await client.callTool('github_create_issue',
|
|
|
394
417
|
});
|
|
395
418
|
```
|
|
396
419
|
|
|
397
|
-
|
|
420
|
+
## Contributing
|
|
398
421
|
|
|
399
|
-
|
|
422
|
+
Contributions are welcome! Please see the tests in the `tests/` directory for examples of how to test new features.
|
|
400
423
|
|
|
401
424
|
## Test Structure
|
|
402
425
|
|