This MCP server allows you to browse GitHub repositories, navigate through directories, and view file contents directly through AI assistants. It works with various MCP clients including Cursor, Windsurf, and Claude Desktop.
Before installing, ensure you have:
You can install and run GitHub Repo MCP using several methods:
npx github-repo-mcp
cmd /c npx -y github-repo-mcp
{
"mcpServers": {
"github-repo-mcp": {
"command": "wsl",
"args": [
"bash",
"-c",
"cmd /c npx -y github-repo-mcp"
],
"enabled": true
}
}
}
First, find the full path to npx:
which npx
Then use that path in your configuration:
{
"mcpServers": {
"github-repo-mcp": {
"command": "wsl",
"args": [
"bash",
"-c",
"'/home/[username]/.nvm/versions/node/v20.18.0/bin/npx github-repo-mcp'"
],
"enabled": true
}
}
}
npx -y @smithery/cli install @Ryan0204/github-repo-mcp --client claude
Wait a few seconds or click the refresh button if the server doesn't register immediately.
To avoid rate limiting, you can configure a GitHub personal access token:
{
"mcpServers": {
"github-repo-mcp": {
"command": "...",
"args": [...],
"env": {
"GITHUB_TOKEN": "Your_Github_Token"
},
"enabled": true
}
}
}
The server provides three main tools for interacting with GitHub repositories:
Lists all files and directories at the root of a GitHub repository.
Parameters:
repoUrl
: The URL of the GitHub repository (e.g., "https://github.com/owner/repo")Lists contents of a specific directory in a GitHub repository.
Parameters:
repoUrl
: The URL of the GitHub repositorypath
: The directory path to fetch (e.g., "src")Retrieves and displays the content of a specific file from a GitHub repository.
Parameters:
repoUrl
: The URL of the GitHub repositorypath
: The file path to fetch (e.g., "src/index.js")Browsing a repository root:
Ask your AI assistant to "Show me the contents of the repository at https://github.com/Ryan0204/github-repo-mcp"
Exploring a specific directory:
Ask "What files are in the src directory of https://github.com/Ryan0204/github-repo-mcp?"
Viewing a file:
Ask "Show me the README.md file from https://github.com/Ryan0204/github-repo-mcp"
Common issues and solutions:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.