Integrate
Getting started

Quick Start

Get up and running with Integrate SDK in minutes

Quick Start

This guide will help you create your first integration with the Integrate SDK.

Basic Example

Here's a complete example that connects to the MCP server and calls a GitHub tool:

import { createMCPClient, githubPlugin, gmailPlugin } from "integrate-sdk";

// Create a client with plugins
const client = createMCPClient({
  plugins: [
    githubPlugin({
      clientId: process.env.GITHUB_CLIENT_ID!,
      clientSecret: process.env.GITHUB_CLIENT_SECRET!,
      scopes: ["repo", "user"],
    }),
    gmailPlugin({
      clientId: process.env.GMAIL_CLIENT_ID!,
      clientSecret: process.env.GMAIL_CLIENT_SECRET!,
    }),
  ],
});

// Connect to the server
await client.connect();

// Call tools
const result = await client.callTool("github_create_issue", {
  repo: "owner/repo",
  title: "Bug report",
  body: "Description of the bug",
});

console.log("Issue created:", result);

// Disconnect when done
await client.disconnect();

Step-by-Step Breakdown

1. Import the SDK

import { createMCPClient, githubPlugin, gmailPlugin } from "integrate-sdk";

2. Set Up OAuth Credentials

Before using the SDK, you need to create OAuth apps for the services you want to integrate:

Store your credentials in environment variables:

GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
GMAIL_CLIENT_ID=your_gmail_client_id
GMAIL_CLIENT_SECRET=your_gmail_client_secret

3. Create the Client

const client = createMCPClient({
  plugins: [
    githubPlugin({
      clientId: process.env.GITHUB_CLIENT_ID!,
      clientSecret: process.env.GITHUB_CLIENT_SECRET!,
      scopes: ["repo", "user"],
    }),
  ],
});

4. Connect to the Server

await client.connect();

This establishes an HTTP streaming connection to https://mcp.integrate.dev/api/v1/mcp.

5. Call Tools

const result = await client.callTool("github_create_issue", {
  repo: "owner/repo",
  title: "Bug report",
  body: "Description of the bug",
});

6. Disconnect

await client.disconnect();

Always disconnect when you're done to clean up resources.

List Available Tools

To see what tools are available:

await client.connect();

const tools = client.getEnabledTools();
console.log(
  "Available tools:",
  tools.map((t) => t.name)
);

Error Handling

Wrap your code in try-catch blocks to handle errors:

try {
  await client.connect();
  const result = await client.callTool("github_create_issue", {
    repo: "owner/repo",
    title: "Bug report",
  });
  console.log("Success:", result);
} catch (error) {
  console.error("Error:", error.message);
} finally {
  await client.disconnect();
}

Next Steps