- Home
- MCP servers
- MCP GitHub Repository Server
MCP GitHub Repository Server
- javascript
0
GitHub Stars
javascript
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"mcp-mirror-loglmhq_mcp-server-github-repo": {
"command": "/path/to/mcp-server-github-repo/build/index.js",
"args": [],
"env": {
"GITHUB_REPO": "repository_name",
"GITHUB_OWNER": "repository_owner",
"GITHUB_BRANCH": "branch_name (optional)",
"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_TOKEN"
}
}
}
}You can run an MCP server that gives you programmatic access to the contents of a GitHub repository. It lets you browse files, read file contents as plain text, and navigate directories from an MCP client, making it easy for AI assistants to read code and docs from specific repos.
How to use
Once the MCP server is running, you can connect your MCP client to fetch repository contents and navigate the project structure. Use the ListResources action to enumerate files and directories at a given path, and use ReadResource to retrieve the contents of a specific file. You can specify a branch to access branch-specific files. File contents are delivered as plain text, so you can display code, docs, or README files directly in your assistant.
Typical usage patterns include listing the root of the repository to understand its structure, drilling into directories to locate source files, and reading individual files to inspect code or documentation without leaving your MCP workflow. Use tokens and repository details you configure to ensure you access the exact repository and branch you intend.
How to install
Prerequisites you need before running the server are Node.js and npm. Ensure you have Node.js installed (which also provides npm). Install and build the MCP server, then run it.
Step 1: Install dependencies
npm install
Step 2: Build the server
npm run build
Step 3: Start the server
node build/index.js
Configuration, security, and notes
Configure access to your GitHub repository by providing a personal access token and repository details so the server can fetch contents from GitHub. The server supports branch-specific access to read files from a particular branch.
Environment variables you need to set for the server to access GitHub are:
GITHUB_PERSONAL_ACCESS_TOKEN=your_github_token
GITHUB_OWNER=repository_owner
GITHUB_REPO=repository_name
GITHUB_BRANCH=branch_name # Optional
Example client configuration for running locally
If you are configuring a local or IDE-based MCP client, you can run the server as a local process and connect to it using stdio. The following example shows how to reference the local start command in your client config.
{
"mcpServers": {
"mcp-server-github-repo": {
"type": "stdio",
"command": "/path/to/mcp-server-github-repo/build/index.js",
"args": []
}
}
}
Available tools
ListResources
Lists files and directories in the repository at a given path, enabling navigation of the project structure.
ReadResource
Fetches the contents of a specific file from the repository, returning plain text suitable for display in an MCP client.
Authentication
Uses a GitHub Personal Access Token to authenticate requests against the GitHub API and access repository contents.
Error Handling
Provides error handling for missing environment variables, GitHub API errors, invalid paths, and authentication failures.
Debugging
Supports debugging via the MCP Inspector tooling to access debugging URLs and tools.