GitHub Project Manager
STDIOMCP implementation for managing GitHub projects, issues, pull requests, and repositories.
MCP implementation for managing GitHub projects, issues, pull requests, and repositories.
A Model Context Protocol (MCP) implementation for managing GitHub projects and issues. This package provides a seamless interface for AI assistants and applications to interact with GitHub repositories, issues, pull requests, and projects.
npm install @monsoft/mcp-github-project-manager
The quickest way to use the GitHub Project Manager is directly with npx:
npx -y @monsoft/mcp-github-project-manager --GITHUB_PERSONAL_TOKEN=your_github_token_here
This starts the MCP server which can then be connected to by MCP clients.
The GitHub Project Manager supports two transport methods:
This is the default transport, ideal for direct CLI integrations and local usage:
# Start with default Stdio transport npx -y @monsoft/mcp-github-project-manager --GITHUB_PERSONAL_TOKEN=your_github_token_here
For remote setups and web integrations, you can use the SSE transport which starts an HTTP server:
# Start with SSE transport on default port (3010) npx -y @monsoft/mcp-github-project-manager --GITHUB_PERSONAL_TOKEN=your_github_token_here --RUN_SSE=1 # Start with SSE transport on a custom port npx -y @monsoft/mcp-github-project-manager --GITHUB_PERSONAL_TOKEN=your_github_token_here --RUN_SSE=1 --PORT=8080
When using SSE transport, the server will be accessible at:
http://localhost:<PORT>/sse
http://localhost:<PORT>/messages
To use this with AI assistants like Claude in Anthropic or Cursor:
# Start the MCP server in your terminal npx -y @monsoft/mcp-github-project-manager --GITHUB_PERSONAL_TOKEN=your_github_token_here
Then configure your AI assistant to use this MCP server. The exact configuration depends on the client you're using.
To use the GitHub Project Manager in your own code:
import { GitHubProjectManager } from '@monsoft/mcp-github-project-manager'; // The token will be automatically loaded from command line arguments const manager = new GitHubProjectManager(); // Now you can use the manager to interact with GitHub projects
When running your application, provide the GitHub token as a command-line argument:
node your-app.js --GITHUB_PERSONAL_TOKEN=your_github_token_here
You can also specify the transport type and other options:
# Use SSE transport node your-app.js --GITHUB_PERSONAL_TOKEN=your_github_token_here --RUN_SSE=1 --PORT=3010 # Use default Stdio transport node your-app.js --GITHUB_PERSONAL_TOKEN=your_github_token_here
If you need to programmatically start the server with specific transport options:
import { startGitHubProjectManagerServer, startGitHubProjectManagerServerSSE, } from '@monsoft/mcp-github-project-manager'; // Start with Stdio transport await startGitHubProjectManagerServer('your_github_token_here'); // Or start with SSE transport await startGitHubProjectManagerServerSSE('your_github_token_here', 3010);
const newIssue = await manager.createIssue({ owner: 'organization-name', repo: 'repository-name', title: 'Issue title', body: 'Detailed description of the issue', labels: ['bug', 'priority-high'], assignees: ['username1', 'username2'], });
const issue = await manager.getIssue({ owner: 'organization-name', repo: 'repository-name', issue_number: 123, });
await manager.updateIssue({ owner: 'organization-name', repo: 'repository-name', issue_number: 123, title: 'Updated title', body: 'Updated description', state: 'closed', });
const issues = await manager.listIssues({ owner: 'organization-name', repo: 'repository-name', state: 'open', labels: ['bug'], sort: 'created', direction: 'desc', });
await manager.addIssueComment({ owner: 'organization-name', repo: 'repository-name', issue_number: 123, body: 'This is a comment', });
const pr = await manager.createPullRequest({ owner: 'organization-name', repo: 'repository-name', title: 'Pull request title', body: 'Description of changes', head: 'feature-branch', base: 'main', });
const pullRequest = await manager.getPullRequest({ owner: 'organization-name', repo: 'repository-name', pull_number: 456, });
await manager.mergePullRequest({ owner: 'organization-name', repo: 'repository-name', pull_number: 456, merge_method: 'squash', });
await manager.createPullRequestReview({ owner: 'organization-name', repo: 'repository-name', pull_number: 456, event: 'APPROVE', body: 'LGTM! Great work.', });
const project = await manager.createProject({ owner: 'organization-name', name: 'Project Name', body: 'Project description', });
await manager.addProjectItem({ project_id: 12345, content_id: issue.id, content_type: 'Issue', });
const items = await manager.listProjectItems({ project_id: 12345, });
The package provides custom error classes for handling common error scenarios:
try { // GitHub operations } catch (error) { if (error instanceof MissingGitHubTokenError) { console.error('GitHub token is missing. Please provide one via command line.'); } else if (error instanceof AuthenticationError) { console.error('Failed to authenticate with GitHub. Check your token.'); } else if (error instanceof RateLimitError) { console.error('GitHub API rate limit exceeded.'); } else { console.error('An unexpected error occurred:', error.message); } }
Available error classes:
MissingGitHubTokenError
: Thrown when a GitHub token is not providedAuthenticationError
: Thrown when authentication failsResourceNotFoundError
: Thrown when a requested resource doesn't existValidationError
: Thrown when input validation failsRateLimitError
: Thrown when GitHub API rate limits are exceededNetworkError
: Thrown when network communication issues occurGitHubApiError
: General error for GitHub API issuesYour GitHub personal access token needs the following permissions:
repo
- Full access to repositoriesproject
- Access to projectsissues
- Access to issuesnpm run build
npm run validate
npm test
npm run lint
MIT