GitHub Repository Browser

by loglmhq

4 stars
449 downloads
Not rated
GitHub

About

Integrates with the GitHub API to provide file browsing, content retrieval, and directory navigation capabilities for analyzing and accessing repository contents.

Details

Author
loglmhq
Repository
loglmhq/mcp-server-github-repo
GitHub stars
4
Downloads
449
License
MIT License
Categories
Developer Tools, Other, Design, Workplace, File Management, AI, Frontend, Infrastructure, API

- Access any file in a GitHub repository via URI
- List repository contents and navigate directories
- Support for branch-specific file access
- File contents served as plain text
- Directories served with application/x-directory MIME type
- Authentication via GitHub Personal Access Token

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name GitHub Repository Browser
    Command (node, npx, python, etc.) node
    Arguments
    • Argument 1 /path/to/mcp-server-github-repo/build/index.js
    Environment
    • GITHUB_REPO repository_name
    • GITHUB_OWNER repository_owner
    • GITHUB_BRANCH branch_name
    • GITHUB_PERSONAL_ACCESS_TOKEN your_github_token

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

To use with Claude Desktop, add the server configuration:

- 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"
    }
  }
}

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

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "github repository browser": {
            "env": {
                "GITHUB_REPO": "repository_name",
                "GITHUB_OWNER": "repository_owner",
                "GITHUB_BRANCH": "branch_name",
                "GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_token"
            },
            "args": [
                "/path/to/mcp-server-github-repo/build/index.js"
            ],
            "command": "node"
        }
    }
}

Linux

{
    "env": {
        "GITHUB_REPO": "repository_name",
        "GITHUB_OWNER": "repository_owner",
        "GITHUB_BRANCH": "branch_name",
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_token"
    },
    "args": [
        "/path/to/mcp-server-github-repo/build/index.js"
    ],
    "command": "node"
}

Macos

{
    "env": {
        "GITHUB_REPO": "repository_name",
        "GITHUB_OWNER": "repository_owner",
        "GITHUB_BRANCH": "branch_name",
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_token"
    },
    "args": [
        "/path/to/mcp-server-github-repo/build/index.js"
    ],
    "command": "node"
}

Windows

{
    "env": {
        "GITHUB_REPO": "repository_name",
        "GITHUB_OWNER": "repository_owner",
        "GITHUB_BRANCH": "branch_name",
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your_github_token"
    },
    "args": [
        "/path/to/mcp-server-github-repo/build/index.js"
    ],
    "command": "node"
}

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

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.