gh
GitHub context server for AI models. Fetch files, structure, filter, and more.
claude mcp add --transport stdio shanksxz-gh-mcp-server node dist/server.js \ --env GITHUB_TOKEN="Optional: GitHub personal access token to increase API rate limits"
How to use
This MCP server enables AI models to access GitHub repository contents as context by providing tools to fetch repository-wide contents, specific file contents, and repository structures. The available tools let you fetch an entire repository's files (with filtering by extensions, exclusions, and a cap on the number of files), retrieve the content of a single file, and obtain a navigable structure listing of a repository. To use it, run the server locally or in your environment, ensure any required authentication token is available via GITHUB_TOKEN to increase API rate limits, and then interact with the MCP protocol to invoke get-repo-context, get-file-content, or get-repo-structure as needed for your AI workflow.
How to install
Prerequisites:
- Git
- Node.js (and npm) installed on your system
- Access to the internet to fetch dependencies
Installation steps:
- Clone the repository: git clone https://github.com/shanksxz/github-mcp.git
- Navigate into the project directory: cd github-mcp
- Install dependencies: npm install
- Build the project (produces the server artifact): npm run build
- Run the MCP server (example):
ensure you have a valid GitHub token if needed
export GITHUB_TOKEN=your_github_token_if_available node dist/server.js
Notes:
- The server communicates via the MCP protocol over stdin/stdout.
- Public repositories work without authentication, but authenticated requests help with rate limits.
Additional notes
Environment variable tips:
- GITHUB_TOKEN: Set this to a GitHub Personal Access Token if you plan to access many private or rate-limited resources. Without a token, GitHub's unauthenticated rate limit applies.
Usage tips:
- Use get-repo-context to pull a curated set of files from a repository, applying maxFiles, fileExtensions, and excludePaths to tailor the content.
- Use get-file-content for precise file retrieval without pulling the entire repository.
- Use get-repo-structure to understand the repository layout before selecting files for context.
Common issues:
- If the MCP server fails to respond, ensure the built artifact exists at dist/server.js and that the server process has permissions to read environment variables.
- If rate limits are hit, confirm GITHUB_TOKEN is valid and has appropriate scopes.
Related MCP Servers
browser-tools
Monitor browser logs directly from Cursor and other MCP compatible IDEs.
mcp-llms-txt-explorer
MCP to explore websites with llms.txt files
whois
MCP Server for whois lookups.
n8n-workflow-builder
MCP server that allow LLM in agent mode builds n8n workflows for you
adb
An MCP (Model Context Protocol) server for interacting with Android devices through ADB in TypeScript.
midnight
Midnight MCP server giving AI assistants access to Midnight blockchain — search contracts, analyze code, explore docs