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
- Go to GitHub Developer Settings
- Click "New OAuth App"
- Fill in the application details
- 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 issuegithub_list_issues- List issues in a repositorygithub_get_issue- Get a specific issuegithub_update_issue- Update an issuegithub_close_issue- Close an issue
Pull Requests
github_create_pull_request- Create a new pull requestgithub_list_pull_requests- List pull requestsgithub_get_pull_request- Get a specific pull requestgithub_merge_pull_request- Merge a pull request
Repositories
github_list_repos- List repositories for a user/orggithub_list_own_repos- List your repositoriesgithub_get_repo- Get repository detailsgithub_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 repositoriesuser- Read/write access to profile inforead:org- Read organization datawrite:org- Manage organization dataadmin:repo_hook- Manage repository webhooksgist- 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
- Explore the Gmail Integration
- Configure Additional Integrations
- See Advanced Usage for more examples