MCP GitHub Repository Server

MCP GitHub Repository Server

A server that allows AI assistants to browse and read files from specified GitHub repositories, providing access to repository contents via the Model Context Protocol.

loglmhq

Version Control
File Systems
Developer Tools
Visit Server

README

MCP GitHub Repository Server

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

Demo

demo

Features

Resources

  • 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

Resource URIs

  • Base URL format: https://api.github.com/repos/{owner}/{repo}/contents/{path}
  • Supports both files and directories
  • Files are served with text/plain MIME type
  • Directories are served with application/x-directory MIME type

Configuration

The server requires the following environment variables:

GITHUB_PERSONAL_ACCESS_TOKEN=your_github_token
GITHUB_OWNER=repository_owner
GITHUB_REPO=repository_name
GITHUB_BRANCH=branch_name  # Optional

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

Installation

To use with Claude Desktop, add the server configuration:

Config Location

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "mcp-server-github-repo": {
      "command": "/path/to/mcp-server-github-repo/build/index.js"
    }
  }
}

API Implementation

The server implements three main MCP endpoints:

  1. ListResources - Lists files and directories in the repository
  2. ReadResource - Retrieves contents of a specific file

Authentication

The server uses GitHub Personal Access Token for authentication. Make sure your token has appropriate permissions to access the repository contents.

Error Handling

The server includes error handling for:

  • Missing environment variables
  • GitHub API errors
  • Invalid paths (e.g., trying to read a directory as a file)
  • Authentication failures

Debugging

Since MCP servers communicate over stdio, debugging can be challenging. Use the MCP Inspector for debugging:

npm run inspector

This will provide a URL to access debugging tools in your browser.

Security Notes

  • Keep your GitHub Personal Access Token secure
  • Consider using tokens with minimal required permissions
  • Be aware of repository size limitations when accessing large repositories

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Excel MCP Server

Excel MCP Server

A Model Context Protocol server that enables AI assistants to read from and write to Microsoft Excel files, supporting formats like xlsx, xlsm, xltx, and xltm.

Featured
Local
Go
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Gitingest-MCP

Gitingest-MCP

An MCP server for gitingest. It allows MCP clients like Claude Desktop, Cursor, Cline etc to quickly extract information about Github repositories including repository summaries, project directory structure, file contents, etc

Featured
Local
Python
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript