Get the FREE Ultimate OpenClaw Setup Guide →

mcp -github-repo

MCP server for interacting with a github repo

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio loglmhq-mcp-server-github-repo node /path/to/mcp-server-github-repo/build/index.js \
  --env GITHUB_REPO="repository_name" \
  --env GITHUB_OWNER="repository_owner" \
  --env GITHUB_BRANCH="branch_name (optional)" \
  --env GITHUB_PERSONAL_ACCESS_TOKEN="your_github_token"

How to use

This MCP server exposes access to a GitHub repository's contents through MCP endpoints. It lets you list the repository’s files and directories and read individual files from a specified owner/repo, with optional branch support. The server authenticates to GitHub using a Personal Access Token and streams file contents as plain text, suitable for use by AI assistants that need to browse or read repository data. Use ListResources to explore the repository structure and ReadResource to fetch the contents of a particular file. If you specify a branch via GITHUB_BRANCH, the server will serve contents from that branch when available.

How to install

Prerequisites:

  • Node.js (and npm) installed
  • Access to the GitHub repository you want to serve

Install and build:

  1. npm install
  2. npm run build

Optional for development with auto-rebuild: 3) npm run watch

Run (example):

  • Ensure environment variables are set (see mcp_config):
    • GITHUB_PERSONAL_ACCESS_TOKEN=your_github_token
    • GITHUB_OWNER=repository_owner
    • GITHUB_REPO=repository_name
    • GITHUB_BRANCH=branch_name (optional)
  • Start the server: node /path/to/mcp-server-github-repo/build/index.js

If integrating with Claude Desktop, place the generated config in Claude's config.json as shown in the README example.

Additional notes

Environment variables are required for authentication and repository details. Ensure your GitHub token has access to the target repository. Be mindful of rate limits on GitHub's API, especially for large repositories or frequent requests. For debugging, you can use the MCP Inspector tool (npm run inspector) to get a debugging URL. Directories are served with application/x-directory and files as text/plain. If you encounter authentication failures, double-check token permissions and token scope. When using different branches, verify that the branch exists in the repository and that the token has access to that branch.

Related MCP Servers

Sponsor this space

Reach thousands of developers