MCP GitHub Repository Server logo

MCP GitHub Repository Server

by loglmhq

An MCP server that provides access to GitHub repository contents. This server allows AI assistants to browse and read files from specified GitHub repositories.

View on GitHub

Last updated: N/A

What is MCP GitHub Repository Server?

This is an MCP (Model Context Protocol) server that enables access to files and directories within a GitHub repository. It serves file contents as plain text and directory listings for AI assistants to browse and read.

How to use MCP GitHub Repository Server?

  1. Configure environment variables (GITHUB_PERSONAL_ACCESS_TOKEN, GITHUB_OWNER, GITHUB_REPO, GITHUB_BRANCH).
  2. Install dependencies using npm install.
  3. Build the server using npm run build.
  4. Configure Claude Desktop by adding the server configuration to claude_desktop_config.json with the correct path to the built index.js file.

Key features of MCP GitHub Repository Server

  • Access any file in a GitHub repository via URI

  • List repository contents and navigate directories

  • Support for branch-specific file access

  • File contents are served as plain text

Use cases of MCP GitHub Repository Server

  • Allowing AI assistants to read code from a GitHub repository

  • Providing context to AI models from GitHub files

  • Enabling AI-powered code analysis and documentation

  • Integrating GitHub repository contents into AI workflows

FAQ from MCP GitHub Repository Server

What is the base URL format?

The base URL format is https://api.github.com/repos/{owner}/{repo}/contents/{path}

What MIME type are files served with?

Files are served with text/plain MIME type.

What MIME type are directories served with?

Directories are served with application/x-directory MIME type.

What environment variables are required?

The server requires GITHUB_PERSONAL_ACCESS_TOKEN, GITHUB_OWNER, GITHUB_REPO, and optionally GITHUB_BRANCH.

How do I debug the server?

Use the MCP Inspector by running npm run inspector. This will provide a URL to access debugging tools in your browser.