Skip to main content
Glama
attila-batky-epam

GitHub MCP Server

GitHub MCP Server

A Model Context Protocol (MCP) server for GitHub operations, written in TypeScript.

Features

  • Create and manage pull requests

  • Comment on PRs

  • List and get PR details

  • Merge pull requests

  • Automated PR review with security and quality checks

Related MCP server: forgejo-mcp

Installation & Setup

For End Users (via npm)

# Install globally
npm install -g github-mcp

# Or install locally in your project
npm install github-mcp

The package comes pre-built with compiled JavaScript - no TypeScript setup needed!

For Contributors (from source)

If you're developing or contributing to this project:

  1. Create a GitHub Personal Access Token:

  2. Create .env file:

    GITHUB_TOKEN=your-token-here
  3. Install dependencies:

    npm install
  4. Build the TypeScript project:

    npm run build

Usage

After installing via npm, configure in your MCP client:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "github-mcp"],
      "env": {
        "GITHUB_TOKEN": "your-token-here"
      }
    }
  }
}

From source (for contributors):

Development mode (TypeScript with hot reload):

npm run dev

Production mode (compiled JavaScript):

npm run build
npm start

Configure with Claude Code (local development):

Add to .claude/.mcp.json:

{
  "mcpServers": {
    "github": {
      "command": "node",
      "args": ["C:/code/github-mcp/dist/index.js"],
      "env": {
        "GITHUB_TOKEN": "your-token-here"
      }
    }
  }
}

Available Tools

  • create_pr - Create a pull request

    • owner (required): Repository owner (username or org)

    • repo (required): Repository name

    • title (required): Pull request title

    • body (optional): Pull request description

    • head (required): Branch containing changes

    • base (optional): Branch to merge into (default: "main")

  • comment_on_pr - Add a comment to a pull request

    • owner (required): Repository owner (username or org)

    • repo (required): Repository name

    • pr_number (required): Pull request number

    • body (required): Comment text (supports Markdown)

  • get_pr - Get details about a pull request

    • owner (required): Repository owner (username or org)

    • repo (required): Repository name

    • pr_number (required): Pull request number

  • list_prs - List pull requests for a repository

    • owner (required): Repository owner (username or org)

    • repo (required): Repository name

    • state (optional): Filter by state - "open", "closed", or "all" (default: "open")

  • merge_pr - Merge a pull request

    • owner (required): Repository owner (username or org)

    • repo (required): Repository name

    • pr_number (required): Pull request number

    • merge_method (optional): "merge", "squash", or "rebase" (default: "merge")

    • commit_title (optional): Custom merge commit title

    • commit_message (optional): Custom merge commit message

Contributing

Development Setup

  1. Clone the repository

  2. Install dependencies: npm install

  3. Build TypeScript: npm run build

  4. Run in dev mode: npm run dev

Testing

This project uses Vitest for unit testing:

  • 58 test cases covering happy paths, error handling, and edge cases

  • 100% coverage on core API functions

  • Security pattern detection tests for SQL injection, XSS, command injection

  • Fast execution with Vitest's modern test runner

Run tests:

npm test                  # Run all tests
npm run test:watch        # Watch mode for development
npm run test:coverage     # Generate coverage report
npm run test:ui           # Interactive test UI

CI/CD

This project uses GitHub Actions for continuous integration:

  • Automated testing with coverage reports on all PRs

  • Automated builds on all PRs and pushes to main

  • Type checking to catch TypeScript errors

  • Multi-version testing (Node 18.x, 20.x, 22.x)

  • Automated PR reviews with security and quality checks

The CI workflows are for repo contributors only - end users receive pre-built packages.

Scripts

  • npm run build - Compile TypeScript to JavaScript

  • npm run dev - Run with tsx (no build needed)

  • npm run clean - Remove build and coverage artifacts

  • npm start - Run compiled JavaScript

  • npm run review-pr - Run PR review tool

  • npm test - Run test suite

  • npm run test:watch - Run tests in watch mode

  • npm run test:coverage - Run tests with coverage report

  • npm run test:ui - Run tests with interactive UI

Package Distribution

When published to npm:

  • ✅ Pre-built JavaScript included (dist/ directory)

  • ✅ TypeScript definitions included (.d.ts files)

  • ❌ Source TypeScript excluded

  • ❌ CI workflows excluded

  • ❌ Development files excluded

End users get a ready-to-use package with no build step required!

Future Extensions

This library currently focuses on core PR and merging workflows. Potential future extensions include:

Core Workflow Operations

  • Branch Management: create_branch, list_branches, delete_branch, compare_branches

  • Issue Management: create_issue, list_issues, update_issue, close_issue, add_issue_comment

  • Commit Operations: get_commit, list_commits with filtering

  • Repository Content: get_file, update_file, get_directory for direct file operations

CI/CD Integration

  • GitHub Actions: trigger_workflow, get_workflow_runs, get_run_logs

  • Commit Status API: create_commit_status, get_commit_statuses for external CI

  • Enhanced PR Details: get_pr_files, get_pr_commits, request_reviewers

Advanced Features

  • Release Management: create_release, list_releases, create_tag

  • Repository Search: search_code, search_issues, search_commits

  • Security: list_security_advisories, get_dependabot_alerts

The automated PR review tool (review-pr.ts) serves as a CI/CD quality gate and is intentionally separate from the core MCP library.

Development Retrospective

This project was built through human-AI collaboration using Claude Code. Key learnings:

What Required Human Guidance

1. Git Workflow Discipline

  • Issue: AI initially committed directly to main branch

  • Fix: User enforced branch-first workflow, set up branch protection via GitHub API

  • Lesson: AI needs explicit constraints on destructive/risky operations

2. Code Quality & Performance

  • Issue: Initial test code was verbose (385 lines for github-api tests)

  • Iterations: 3 self-audit rounds reduced to 227 lines (-41%) while maintaining 100% coverage

  • Approach: User requested "performance/cleanup audit" prompts

  • Lesson: AI benefits from explicit optimization passes after generation

3. Scope Management

  • Issue: AI wanted to add lint rules, prettier, complex tooling

  • Fix: User kept scope minimal ("we don't need that")

  • Lesson: AI tends toward over-engineering; human judgment keeps it practical

4. Test Strategy

  • Issue: Initial approach tried to test implementation files with actual logic

  • Pivot: User guided toward testing the extracted pure logic (patterns, analysis)

  • Result: 100% coverage on github-api.ts, meaningful tests on review-pr.ts

  • Lesson: AI can test effectively when given clear architectural direction

5. CI Pipeline Architecture

  • Issue: Initial single test job combined unit tests + coverage

  • Improvement: User requested split into fast unit test job + coverage job

  • Result: 13s fast feedback vs 16s+ combined, parallel execution

  • Lesson: AI implements well but human insight drives architectural improvements

What Worked Without Changes

1. TypeScript Migration

  • AI correctly converted JS → TS with proper types

  • Type definitions for GitHub API were accurate

  • No type errors after initial conversion

2. Test Infrastructure Setup

  • Vitest configuration with coverage was correct first try

  • Test patterns (mocking, helpers, DRY principles) were sound

  • Coverage thresholds appropriately set

3. GitHub API Integration

  • API request patterns were correct

  • Error handling was appropriate

  • Token authentication worked as expected

4. Documentation

  • README updates were comprehensive

  • Code examples were accurate

  • Installation instructions were clear

Collaboration Pattern

Effective workflow:

  1. User provides high-level requirement ("add unit testing")

  2. AI implements full solution

  3. User requests optimization ("cleanup audit round")

  4. AI refactors with metrics (LoC reduction, coverage maintained)

  5. User approves or redirects

Key principle: AI is thorough but needs human judgment on:

  • When to stop adding features

  • When "good enough" beats "perfect"

  • What trade-offs to make (verbosity vs DRY, speed vs completeness)

Metrics

  • Project Duration: ~3 days of iterative development

  • Test Coverage: 100% on core API, 100% on review logic

  • Code Quality: 227 lines of tests (from 385), optimized CI pipeline

  • Git Discipline: 14 PRs, 0 direct main commits after enforcement

  • CI Performance: 20% pipeline speedup with parallel jobs

Available Tools

5 tools
comment_on_prB

Add a comment to a pull request

ParametersJSON Schema
NameRequiredDescriptionDefault
bodyYesComment text (supports Markdown)
repoYesRepository name
ownerYesRepository owner (username or org)
pr_numberYesPull request number

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavioral traits but only states the obvious action. It does not mention side effects, permissions, idempotency, or any side effects beyond adding a comment, which is insufficient for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that effectively communicates the core purpose without redundancy. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite the simple action and complete parameter schema, the description lacks behavioral context, usage guidance, and return value information. With no annotations and no output schema, a more complete description is needed to guide the agent effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All parameters are fully documented in the schema (100% coverage), so the description does not need to add parameter details. The description adds no extra meaning, but the schema already provides the necessary semantics, yielding the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (add) and the resource (comment to a pull request), distinguishing it from sibling tools like get_pr and merge_pr. It is specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. There is no mention of prerequisites, context, or exclusions, despite the presence of sibling tools for PR operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

create_prB

Create a pull request

ParametersJSON Schema
NameRequiredDescriptionDefault
baseNoBranch to merge intomain
bodyNoPull request description
headYesBranch containing changes
repoYesRepository name
ownerYesRepository owner (username or org)
titleYesPull request title

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It only mentions 'create', implying a write operation, but discloses no side effects, prerequisites, or return behavior. This is minimal and mirrors the mid-tier example that scored 2.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with zero filler words. It is highly concise and clearly structured, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite a complete schema, the description lacks essential context such as what a pull request is, what inputs are needed, or expected outcomes. With no annotations and no output schema, this minimal description is insufficient for a tool with six parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for all six parameters, so the schema already provides parameter semantics. The description adds no extra meaning beyond the schema, matching the baseline of 3 for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create a pull request' uses a specific verb and resource, clearly stating the tool's action and target. It distinguishes itself from sibling tools like get_pr, merge_pr, list_prs, and comment_on_pr by implying a creation operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool vs. alternatives. The description simply states the action without context, exclusions, or comparison to sibling tools, so the agent gets no explicit usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_prB

Get details about a pull request

ParametersJSON Schema
NameRequiredDescriptionDefault
repoYesRepository name
ownerYesRepository owner (username or org)
pr_numberYesPull request number

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full responsibility for behavioral disclosure. It merely says 'Get details about a pull request' without detailing what 'details' include, whether the operation is read-only, any potential side effects, or the response format. This is a significant gap for a tool with no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that gets straight to the point with the verb front-loaded. It wastes no words, though it is sparse. It earns a 4 for effectively communicating the core purpose without unnecessary verbiage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple get tool with no output schema and no annotations, the description should provide at least some context about the returned data or usage context. The current description is a restatement of the tool name and does not explain what 'details' means, leaving the agent to guess about response structure and edge cases.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already provides 100% documentation for all three parameters (owner, repo, pr_number). The description adds no additional meaning beyond what the schema states, so it neither improves nor detracts from parameter clarity. Baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly uses a specific verb ('Get') and resource ('details about a pull request'), making the tool's purpose immediately obvious. It also distinguishes from sibling tools like list_prs (which lists multiple PRs) and create_pr/comment_on_pr/merge_pr (which perform actions), by focusing on retrieval of a single PR's details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives such as list_prs. The description only states what the tool does, not the scenarios in which it should be preferred, nor any exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_prsB

List pull requests for a repository

ParametersJSON Schema
NameRequiredDescriptionDefault
repoYesRepository name
ownerYesRepository owner (username or org)
stateNoFilter by state: open, closed, or allopen

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It only says 'list', implying a read operation, but does not explicitly state that it is non-mutating, nor does it mention return format, pagination, ordering, or default state. The description adds little beyond the tool name and schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, front-loaded with the key verb and resource. Every word earns its place with no unnecessary filler or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is minimal and does not explain return values, pagination, or any behavior beyond listing. While the schema covers parameters well, the absence of output schema and annotations leaves room for more context. However, for a simple list tool with well-defined parameters, this is adequate but not complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema provides descriptions for all three parameters (owner, repo, state) with 100% coverage. The description does not add any additional meaning to the parameters. Baseline 3 is appropriate since the schema already documents the parameters adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (List) and the resource (pull requests) for a repository. This distinguishes it from sibling tools like get_pr (single PR), create_pr, comment_on_pr, and merge_pr, which have different purposes. The verb+resource pair is specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives. No mention of, for example, 'use get_pr to retrieve details of a single PR' or 'use create_pr to open a new PR'. The description simply states what it does without context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

merge_prC

Merge a pull request

ParametersJSON Schema
NameRequiredDescriptionDefault
repoYesRepository name
ownerYesRepository owner (username or org)
pr_numberYesPull request number
commit_titleNoTitle for the merge commit (optional)
merge_methodNoMerge method to usemerge
commit_messageNoMessage for the merge commit (optional)

TDQS

C2.5/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Given that annotations are entirely absent, the description carries the full burden of behavioral disclosure. It only says 'Merge a pull request'—a minimal restatement of the tool's name—without mentioning side effects like branch deletion, permission requirements, or potential merge conflicts. This adds no transparency beyond the name itself.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence with zero waste. It states the essential purpose directly and is front-loaded. While it may be too brief for other dimensions, conciseness is a strength here.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 6 parameters, no annotations, and no output schema, this description is severely under-specified. It does not explain merge behavior, default method, possible outcomes, or any constraints. The single sentence is insufficient for an agent to understand when and how to invoke the tool correctly beyond what the name already suggests.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers 100% of the parameters with descriptions, so per baseline rules a score of 3 is appropriate. The description itself adds no parameter-specific semantics, but the schema already documents all six parameters, including optional commit_title, commit_message, and merge_method.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Merge a pull request' clearly states the action (merge) and the resource (pull request), which distinguishes it from sibling tools like create_pr, get_pr, and list_prs. However, it lacks any qualifying detail about scope or variant (e.g., merge into default branch), so it's clear but not maximally informative.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It does not mention prerequisites like approvals or CI status, nor does it reference sibling tools or alternative merge strategies. The description is purely definitional and offers no usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 5 tool updatesv1.0.0
    • First observedcomment_on_pr
    • First observedcreate_pr
    • First observedget_pr
    • First observedlist_prs
    • First observedmerge_pr

TDQS

B3.4/5.0
Disambiguation5/5

Each tool targets a distinct PR operation: create, comment, get, list, and merge. There is no overlap or ambiguity between the actions.

Naming Consistency4/5

The naming follows a predictable verb_noun/reference pattern (create_pr, get_pr, list_prs, merge_pr), with the only minor deviation being comment_on_pr using an extra preposition. Overall, the convention is consistent and readable.

Tool Count5/5

With 5 tools focused entirely on pull request management, the count is well-scoped for a single-purpose server. Each tool serves a clear need without redundancy.

Completeness4/5

The core PR lifecycle is covered: create, read, list, comment, and merge. Missing operations like updating a PR or closing without merging are minor gaps that agents can work around, but the surface is mostly complete.

Maintenance

ActivityStale
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/attila-batky-epam/github-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server