GitHub Plugin
Manage GitHub repositories, issues, and pull requests
GitHub Plugin
The GitHub plugin provides access to GitHub's API through the Integrate MCP server.
Installation
The GitHub plugin is included with the SDK:
import { createMCPClient, githubPlugin } from "integrate-sdk";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 Plugin
const client = createMCPClient({
plugins: [
githubPlugin({
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
scopes: ["repo", "user", "read:org"], // Optional
redirectUri: "http://localhost:3000/callback", // Optional
}),
],
});Configuration Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
clientId | string | Yes | - | GitHub OAuth client ID |
clientSecret | string | Yes | - | GitHub OAuth client secret |
scopes | string[] | No | ['repo', 'user'] | OAuth scopes |
redirectUri | string | No | - | OAuth redirect URI |
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 plugin provides access to many more GitHub tools. Use client.getEnabledTools() to see all available tools.
Examples
Create an Issue
await client.connect();
const result = await client.callTool("github_create_issue", {
repo: "username/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.callTool("github_list_pull_requests", {
repo: "username/repository",
state: "open",
sort: "created",
direction: "desc",
});
console.log("Open PRs:", result);Create a Repository
const result = await client.callTool("github_create_repo", {
name: "my-new-project",
description: "A new project",
private: false,
auto_init: true,
});
console.log("Repository created:", result);Merge a Pull Request
const result = await client.callTool("github_merge_pull_request", {
repo: "username/repository",
pull_number: 42,
merge_method: "squash",
commit_title: "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.callTool("github_create_issue", {
repo: "username/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 Plugin
- Learn about Custom Plugins
- See Advanced Usage for more examples