Integrate
Integrations

GitHub

Manage GitHub repositories, issues, and pull requests

The GitHub integration provides access to GitHub's API through the Integrate MCP server.

Installation

The GitHub integration is included with the SDK:

import { githubIntegration } from "integrate-sdk/server";

Setup

1. Create a GitHub OAuth App

  1. Go to GitHub Developer Settings
  2. Click "New OAuth App"
  3. Fill in the application details
  4. Note your Client ID and Client Secret

2. Configure the Integration on Your Server

Add the GitHub integration to your server configuration. The integration automatically reads GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET from your environment variables:

import { createMCPServer, githubIntegration } from "integrate-sdk/server";

export const { client: serverClient } = createMCPServer({
  apiKey: process.env.INTEGRATE_API_KEY,
  integrations: [
    githubIntegration({
      scopes: ["repo", "user", "read:org"], // Optional
    }),
  ],
});

You can override the environment variables by passing explicit values:

githubIntegration({
  clientId: process.env.CUSTOM_GITHUB_ID,
  clientSecret: process.env.CUSTOM_GITHUB_SECRET,
  scopes: ["repo", "user", "read:org"],
});

3. Client-Side Usage

The default client automatically includes all integrations. You can use it directly:

import { client } from "integrate-sdk";

await client.authorize("github");
const repos = await client.github.listOwnRepos({});

If you're using a custom client, add the integration to the integrations array:

import { createMCPClient, githubIntegration } from "integrate-sdk";

const customClient = createMCPClient({
  integrations: [githubIntegration()],
});

Configuration Options

Prop

Type

Available Tools

Issues

  • github_create_issue - Create a new issue
  • github_list_issues - List issues in a repository
  • github_get_issue - Get a specific issue
  • github_update_issue - Update an issue
  • github_close_issue - Close an issue

Pull Requests

  • github_create_pull_request - Create a new pull request
  • github_list_pull_requests - List pull requests
  • github_get_pull_request - Get a specific pull request
  • github_merge_pull_request - Merge a pull request

Repositories

  • github_list_repos - List repositories for a user/org
  • github_list_own_repos - List your repositories
  • github_get_repo - Get repository details
  • github_create_repo - Create a new repository

And More...

The integration provides access to many more GitHub tools. Use client.getEnabledTools() to see all available tools.

Examples

Create an Issue

const result = await client.github.createIssue({
  owner: "username",
  repo: "repository",
  title: "Bug: App crashes on startup",
  body: "When I start the app, it immediately crashes with error XYZ",
  labels: ["bug", "priority:high"],
  assignees: ["username"],
});

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

List Pull Requests

const result = await client.github.listPullRequests({
  owner: "username",
  repo: "repository",
  state: "open",
  sort: "created",
  direction: "desc",
});

console.log("Open PRs:", result);

Create a Repository

const result = await client.github.createRepo({
  name: "my-new-project",
  description: "A new project",
  private: false,
  autoInit: true,
});

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

Merge a Pull Request

const result = await client.github.mergePullRequest({
  owner: "username",
  repo: "repository",
  pullNumber: 42,
  mergeMethod: "squash",
  commitTitle: "Feature: Add new functionality",
});

console.log("PR merged:", result);

OAuth Scopes

The default scopes are ['repo', 'user']. You may need additional scopes depending on what tools you use:

  • repo - Full control of private repositories
  • user - Read/write access to profile info
  • read:org - Read organization data
  • write:org - Manage organization data
  • admin:repo_hook - Manage repository webhooks
  • gist - Create and manage gists

Error Handling

try {
  const result = await client.github.createIssue({
    owner: "username",
    repo: "repository",
    title: "New issue",
  });
} catch (error) {
  if (error.message.includes("not found")) {
    console.error("Repository not found");
  } else if (error.message.includes("authentication")) {
    console.error("Authentication failed");
  } else {
    console.error("Unexpected error:", error);
  }
}

Next Steps