Skip to main content
Glama
GitHub PR MCP Server

GitHub PR MCP Server

GitHub PR MCP Server

Un servidor MCP (Model Context Protocol) mínimo para interactuar con Pull Requests de GitHub. Está pensado como ejemplo didáctico para entender cómo crear un MCP server desde cero.

Qué hace

Expone 6 herramientas:

  • list_pull_requests — Lista los PRs de un repositorio.

  • get_pull_request — Muestra el detalle de un PR.

  • list_pull_request_comments — Lista los comentarios de un PR.

  • create_pull_request_comment — Publica un comentario en un PR.

  • create_pull_request_review — Aprueba, pide cambios o comenta un PR.

  • merge_pull_request — Mergea un PR.

Related MCP server: tai-mcp-github

Requisitos

  • Node.js 20 o superior

  • Un token de GitHub con permisos para leer/escribir PRs (repo o repo:read + repo:write según la operación)

Instalación

npm install

Configuración

Exporta tu token de GitHub:

export GITHUB_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxx"

Ejecución

npm run dev

Importante: el servidor usa stdio como transporte MCP. No escribe nada a stdout excepto el protocolo; los logs van a stderr.

Probar con MCP Inspector

El inspector te permite probar las herramientas sin necesidad de un host como Claude o Cursor:

npm run inspect

Luego abre la URL que indica, conecta el servidor y prueba las tools.

Configurar en un host MCP

Añade esto a tu cliente MCP (Claude Code, Cursor, VS Code, etc.):

{
  "mcpServers": {
    "github-pr": {
      "command": "npx",
      "args": ["tsx", "/ruta/al/proyecto/src/index.ts"],
      "env": {
        "GITHUB_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

Estructura del proyecto

.
├── src/
│   └── index.ts          # Todo el servidor
├── package.json
├── tsconfig.json
└── README.md

Notas para un video tutorial

  • El archivo src/index.ts es autónomo: configura el cliente de GitHub, define los schemas con Zod, registra las tools y arranca el transporte stdio.

  • El SDK de MCP valida los argumentos automáticamente con los schemas; si falla, la tool no se ejecuta.

  • Para demostraciones, usa un repo de prueba y un PR que no importe romper.

Available Tools

6 tools
create_pull_request_commentB

Crea un comentario general en un Pull Request

Inputs: body (required), repo (required), owner (required), pull_number (required).

create_pull_request_reviewB

Crea una review de un Pull Request. Para REQUEST_CHANGES o COMMENT, el body es obligatorio.

Inputs: repo (required), event (required), owner (required), pull_number (required), +1 more.

get_pull_requestA

Obtiene el detalle de un Pull Request específico

Inputs: repo (required), owner (required), pull_number (required).

list_pull_request_commentsB

Lista los comentarios de un Pull Request

Inputs: repo (required), owner (required), pull_number (required).

list_pull_requestsC

Lista los Pull Requests de un repositorio de GitHub

Inputs: repo (required), owner (required), state, per_page.

merge_pull_requestC

Mergea un Pull Request en su rama base

Inputs: repo (required), owner (required), pull_number (required), commit_title, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool performs a distinct action on pull requests: listing, retrieving, commenting, reviewing, and merging. There is no overlap in purpose, making it easy for an agent to select the correct tool.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern (list_pull_requests, get_pull_request, create_pull_request_comment, merge_pull_request). The naming is uniform and predictable, with only minor singular/plural variations that are appropriate.

    Tool Count5/5

    With 6 tools, the server is well-scoped for a PR-focused MCP server. Each tool covers a core PR interaction without unnecessary bloat or redundancy.

    Completeness4/5

    The tool surface covers the main PR lifecycle: list, get, comment, review, and merge. Minor gaps like updating a PR title/body or listing reviews exist, but agents can typically work around them, and the core workflows are well covered.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      MCP server for the GitHub REST API that enables interaction with repositories, pull requests, issues, branches, commits, reviews, and code search, with configurable write and destructive operations.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      MCP server for GitHub operations, providing tools for repository management, issues, pull requests, and code search.
      -