GitHub Context MCP Server
Provides tools for interacting with GitHub repositories, including browsing files, reading file contents, searching code, viewing commits, branches, pull requests, and issues, with runtime management of repository lists.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitHub Context MCP Server Show me open issues in myorg/backend"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GitHub Context MCP Server
An MCP (Model Context Protocol) server that gives Claude access to one or more GitHub repositories — including private ones — directly from Claude Desktop or Claude Code.
Repositories are managed dynamically at runtime: just tell Claude to add or remove a repo and it's persisted immediately, with no config file editing required.
Prerequisites
Node.js 18 or later
Related MCP server: github-analyzer-mcp
Installation
npm install
npm run buildGitHub Token Setup
Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
Click Generate new token (classic)
Give it a name (e.g.
claude-mcp)Select the
reposcope (covers both public and private repositories)Click Generate token and copy it
If you only need public repos, the
public_reposcope is sufficient.
Claude Desktop Configuration
Edit the config file at:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add this block inside "mcpServers":
{
"mcpServers": {
"github-context": {
"command": "node",
"args": ["path_to_repo/dist/index.js"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}That's it — no repo list needed here. Restart Claude Desktop after saving.
Managing repositories
Repos are managed through Claude itself at runtime. The list is stored in dist/repos.json and persists across sessions.
Add a repo
"Add the repo myorg/backend to GitHub context"
Claude calls add_repo → verifies the repo is accessible with your token → saves it to repos.json.
Remove a repo
"Remove myorg/old-project from GitHub context"
Claude calls remove_repo → updates repos.json.
List current repos
"What repos do you have access to?"
Claude calls list_repos → shows everything currently saved.
Changes take effect immediately — no restart needed.
Available Tools
Repo management
Tool | Description |
| Show all saved repositories |
| Add a repo (verifies access before saving) |
| Remove a repo from the list |
Data access
Tool | Description |
| Metadata: description, language, stars, default branch, visibility |
| Browse files and directories at any path |
| Read the full content of any file |
| Search code across a repo (GitHub search API) |
| Recent commit history, optionally filtered by branch or file path |
| List all branches (protected branches are marked) |
| List open, closed, or all pull requests |
| List open, closed, or all issues |
Common parameters
repo—"owner/repo"format, must be in the saved listbranch— branch name, tag, or commit SHA (defaults to the repo's default branch)path— file or directory path inside the repomax_results— how many items to returnstate—"open","closed", or"all"(for PRs and issues)
Example prompts
Add the repo myorg/backend to GitHub context.
List all the files in the src/ directory of myorg/backend.
Read the file src/auth/middleware.ts from myorg/backend.
Search for "function authenticate" in myorg/backend.
Show me the last 10 commits on the main branch of myorg/frontend.
What open issues are there in myorg/backend?
Remove myorg/old-project from GitHub context.Repos file location
By default repos are stored at dist/repos.json next to the built script. To use a custom path, set the REPOS_FILE env var in your Claude Desktop config:
"env": {
"GITHUB_TOKEN": "ghp_your_token_here",
"REPOS_FILE": "localpath/.config/github-mcp/repos.json"
}This is useful if you want the repo list to survive rebuilds or to share it across multiple projects.
Development
Run without building (useful for local testing):
GITHUB_TOKEN=ghp_... npm run devRecompile after making source changes:
npm run buildThen restart Claude Desktop.
Project structure
├── src/
│ └── index.ts # MCP server — all tools, repo persistence logic
├── dist/ # Compiled output (generated by npm run build)
│ ├── index.js
│ └── repos.json # Persisted repo list (auto-created on first add_repo)
├── package.json
├── tsconfig.json
├── .env.example
└── claude-desktop-config.example.jsonSecurity notes
Your GitHub token is passed via environment variable and never logged or sent to Claude.
Only repos explicitly added via
add_repoare accessible — Claude cannot reach other repos even if your token has broader access.add_repoverifies the repo exists and is accessible with your token before saving it.File content is truncated at 100,000 characters to prevent context overflow.
Available Tools
11 toolsadd_repoA
Add a GitHub repository to the saved list. The repo will be accessible in this and all future sessions. Use "owner/repo" format. The server will verify the repo exists and is accessible with your token.
Inputs: repo (required).
get_branchesB
List branches for a repository.
Inputs: repo (required).
get_commitsB
Get recent commits for a branch or file path.
Inputs: repo (required), path, branch, max_results.
get_fileA
Get the content of a file from a repository.
Inputs: path (required), repo (required), branch.
get_issuesB
List issues for a repository.
Inputs: repo (required), state, max_results.
get_pull_requestsC
List pull requests for a repository.
Inputs: repo (required), state, max_results.
get_repo_infoA
Get metadata for a repository (description, language, stars, default branch, etc.).
Inputs: repo (required).
list_filesA
List files and directories at a given path inside a repository.
Inputs: repo (required), path, branch.
list_reposA
List all GitHub repositories currently saved in the repo list.
Inputs: no named parameters.
remove_repoA
Remove a GitHub repository from the saved list.
Inputs: repo (required).
search_codeA
Search for code within a specific repository using the GitHub code search API.
Inputs: repo (required), query (required), max_results.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool has a clear, distinct purpose. Repository list management (list/add/remove) is separated from repository content exploration (files, code, commits, branches, PRs, issues). Even similar tools like list_files and get_file are easily differentiated by their descriptions.
All tools follow a consistent verb_noun pattern using snake_case (list_repos, add_repo, get_file, search_code). The verbs are simple and predictable, making it easy to infer functionality from the name.
With 11 tools, the server is well-scoped for providing GitHub repository context. Each tool serves a distinct need, and the count is within the ideal range for a focused server.
The server covers a broad range of read-only context operations: repo metadata, file listing/content, code search, commits, branches, PRs, and issues. Minor gaps exist such as missing single-resource getters (e.g., get_pull_request, get_issue) but the core context workflows are well covered.
Maintenance
Related MCP Connectors
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
Access the GitHub API, enabling file operations, repository management, search functionality, and…
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables to interact with GitHub repositories directly from Claude, supporting actions like viewing repos, checking status, committing and pushing changes, and managing pull requests.544 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude to analyze GitHub repositories with tools for health scoring, contributor analysis, issue tracking, code search, and more.MIT
- FlicenseNot gradedqualityDmaintenanceEnables Claude to query GitHub repositories in plain English, fetching recent activity, release notes, issue triage, and health summaries via the GitHub API.-
- AlicenseNot gradedqualityDmaintenanceConnects Claude to GitHub repositories for querying repos, reviewing PRs, managing issues, searching code, and automating workflows.MIT