MCP Directory

How to add GitHub Repo MCP to Cursor

Let AI assistants browse public GitHub repositories, explore directories, and view file contents. Paste the config into ~/.cursor/mcp.json and restart Cursor.

Last updated June 14, 2026 · 27 · stdio · apikey

Cursor config for GitHub Repo MCP

npx github-repo-mcp
{
  "mcpServers": {
    "github-repo-mcp": {
      "command": "wsl",
      "args": [
        "bash",
        "-c",
        "cmd /c npx -y github-repo-mcp"
      ],
      "env": {
        "GITHUB_TOKEN": "Your_Github_Token"
      }
    }
  }
}

Setup steps

  1. 1Open Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
  2. 2Paste the GitHub Repo MCP config below into the "mcpServers" object.
  3. 3Fill in placeholder secrets, then save.
  4. 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
  5. 5Ask Cursor to use one of GitHub Repo MCP's tools to confirm it's connected.

Before you start

  • Node.js 18+
  • npm or yarn
  • Optional: a GitHub personal access token for higher API rate limits

What GitHub Repo MCP can do in Cursor

getRepoAllDirectories

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").

getRepoDirectories

Lists the contents of a specific directory in a GitHub repository. Parameters: repoUrl (the repository URL) and path (the directory path to fetch, e.g. "src").

getRepoFile

Retrieves and displays the content of a specific file from a GitHub repository. Parameters: repoUrl (the repository URL) and path (the file path to fetch, e.g. "src/index.js").

Security

Works without authentication against public repositories only (60 requests/hour rate limit). An optional GitHub personal access token (GITHUB_TOKEN) can be supplied for higher rate limits and to access repositories the token has permission for. The server detects common binary file extensions and will not display their contents, and large files may be unavailable due to GitHub API size limits.

GitHub Repo MCP + Cursor FAQ

Where is the Cursor config file?

Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the GitHub Repo MCP config there under the "mcpServers" key and restart the client.

Is GitHub Repo MCP safe to use with Cursor?

Works without authentication against public repositories only (60 requests/hour rate limit). An optional GitHub personal access token (GITHUB_TOKEN) can be supplied for higher rate limits and to access repositories the token has permission for. The server detects common binary file extensions and will not display their contents, and large files may be unavailable due to GitHub API size limits.

Do I need a GitHub token?

No. The server works without authentication, but unauthenticated GitHub API access is limited to 60 requests per hour. Setting a personal access token via the GITHUB_TOKEN environment variable in mcp.json raises this limit.

Can it access private repositories?

Only public repositories are accessible by default. A token with appropriate permissions is required to access private repositories.

Can it read any file type?

It displays code and text files. The server detects common binary file extensions and will not display their contents, and very large files may be unavailable due to GitHub API size limits.

View repo Full GitHub Repo MCP page