Skip to main content
Glama
rishav0004

GitHub MCP Server (Custom)

by rishav0004

GitHub MCP Server (Custom)

A custom Model Context Protocol (MCP) server giving an AI agent full CRUD access to GitHub: repositories, issues, pull requests, branches, comments, reviews, and merges. Built with the official Python mcp SDK (FastMCP) and GitHub's REST API via httpx.

총 23개의 도구 — 전체 목록은 server.py를 참고하세요. 주요 기능은 다음과 같습니다.

영역

도구

저장소

list_repos, get_repo

이슈

list_issues, get_issue, create_issue, update_issue, close_issue, add_issue_comment, list_issue_comments

브랜치

list_branches, get_branch, create_branch, delete_branch

풀 리퀘스트

list_pull_requests, get_pull_request, create_pull_request, update_pull_request, merge_pull_request, list_pr_files

리뷰

list_pr_reviews, create_pr_review

커밋

list_commits, get_commit

설정

  1. 의존성 설치

    pip install -r requirements.txt
  2. GitHub 토큰 생성

    https://github.com/settings/tokens로 이동하여 다음 중 하나를 만드세요.

    • classic PAT with the repo scope, or

    • fine-grained PAT with Contents, Issues, Pull requests, and Metadata set to Read & write, scoped to the repos you want the agent to touch.

  3. 토큰을 환경 변수로 설정하기

    export GITHUB_TOKEN=ghp_your_token_here
  4. 단독 실행 (선택적 기본 동작 확인)

    python server.py

    이 명령은 MCP 클라이언트가 stdio로 연결하기를 기다리며 대기합니다. 정상 동작입니다. 웹 서버가 아닙니다.

Related MCP server: github-mcp

Claude Desktop에 연결하기

claude_desktop_config.json에 다음을 추가하세요. Windows에서는 %APPDATA%\Claude\claude_desktop_config.json, macOS에서는 ~/Library/Application Support/Claude/claude_desktop_config.json입니다.

{
  "mcpServers": {
    "github": {
      "command": "python",
      "args": ["/absolute/path/to/server.py"],
      "env": {
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

Claude Desktop을 재시작하면 GitHub 도구가 도구 피커에 나타납니다.

자체 에이전트 파이프라인에 연결하기 (예: Jira → GitHub → Teams 프로젝트)

표준 MCP stdio 서버이므로 어떤 MCP 호환 클라이언트나 SDK든 이 서버를 하위 프로세스로 실행하고 stdin/stdout을 통해 통신할 수 있습니다. MCP C# SDK를 사용하는 .NET 호스트도 포함하고, orchestator가 polyglot이라면 Python/TypeScript SDK도 가능합니다. 클라이언트를 다음에 지정하세요:

command: python
args: ["/absolute/path/to/server.py"]
env: { "GITHUB_TOKEN": "<token>" }

확장하기

새 도구를 추가하려면 server.py에 @mcp.tool() 데코레이터가 있는 함수를 추가하고, GitHub REST API에 대해 _request(method, path, ...)를 호출하면 됩니다. docstring은 모델에게 표시되는 도구 설명이 되고, 타입 힌트는 입력 스키마가 됩니다 — 둘 다 정확하게 유지하세요.

참고 사항

  • 모든 쓰기 작업(create_*, update_*, delete_*, merge_*) 은 GitHub에서 실제 변경을 수행합니다 — dry-run 모드가 없습니다. 특히 merge_pull_request와 delete_branch는 임시 저장소에서 먼저 테스트하는 것이 좋습니다.

  • Rate limits follow GitHub's standard REST API limits — the server doesn't do its own throttling. (작성 기준 5000 requests/hour for authenticated requests) 서버는 자체 throttling을 하지 않습니다.

  • GitHub의 오류(잘못된 인증, 404, 병합 충돌 등)는 API 응답 본문과 함께 RuntimeError로 발생합니다. 따라서 호출한 에이전트는 대응할 수 있는 읽기 쉬운 메시지를 받습니다.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    Enables LLMs to interact with GitHub repositories, issues, pull requests, and workflows through the Model Context Protocol. It provides a comprehensive set of tools for repository management, issue tracking, code search, and CI/CD automation.
    -
  • A
    license
    C
    quality
    D
    maintenance
    Enables AI assistants to directly operate GitHub repositories, such as listing issues, through the Model Context Protocol.
    2
    140 npm
    2
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to interact with GitHub repositories, issues, pull requests, and content via the Model Context Protocol.
    1
    MIT