GitHub MCP server
Use GitHub's official remote MCP server: repos, code search, issues, pull requests and toolsets, with a PAT or OAuth.
Developer toolsGuided#mcp#github#git#issues#pull-requests#ai-agents
Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.
Overview
The GitHub MCP server is GitHub's official Model Context Protocol server. The remote version, hosted by GitHub at https://api.githubcopilot.com/mcp/, gives an AI assistant tools to read and change GitHub: browse repositories and files, search code, list commits and branches, read and write issues and pull requests, merge, and (with extra toolsets) work with Actions, code scanning, Dependabot, discussions, projects, gists and notifications. The source is at github.com/github/github-mcp-server; a local Docker/binary version exists too, but this collection targets the remote server.
Credentials
The remote server accepts two kinds of token, both sent as Authorization: Bearer ...:
- Personal access token (used by this collection). Create one at github.com/settings/personal-access-tokens/new. A fine-grained token limited to the repositories you need is safest: give it read access to Contents, Issues, Pull requests and Metadata for reading, and write access only where you want the assistant to create issues, branches, files or PRs. Paste it into the secret
githubTokenvariable. - OAuth. Without a token the server answers 401 with
WWW-Authenticate: Bearer error="invalid_request", ... resource_metadata="https://api.githubcopilot.com/.well-known/oauth-protected-resource/mcp/"(checked live). That document nameshttps://github.com/login/oauthas the authorization server and lists scopes such asrepo,read:org,read:user,gist,notificationsandproject. OAuth-capable clients (VS Code, Claude Code/mcp) sign you in through GitHub. Folder 1 shows these calls.
Organisations can restrict MCP and Copilot features by policy; if a token works on the REST API but not here, check your organisation's Copilot/MCP policy.
Toolsets and options
The default URL enables the default toolset group: context, repos, issues, pull_requests, users. Pick other toolsets either with a URL (https://api.githubcopilot.com/mcp/x/<toolset>, for example /x/actions, /x/all) or with headers on the default URL:
| Header | Effect |
|---|---|
X-MCP-Toolsets | Comma list, e.g. repos,issues,actions |
X-MCP-Tools | Only these tools, e.g. get_file_contents,issue_read (unknown names fail) |
X-MCP-Readonly | true exposes only read tools |
X-MCP-Lockdown | true hides public issue content from users without push access |
X-MCP-Insiders | true turns on experimental tools |
Appending /readonly to any URL does the same as X-MCP-Readonly.
Add it to your AI client
- Claude Code:
claude mcp add --transport http github https://api.githubcopilot.com/mcp -H "Authorization: Bearer YOUR_GITHUB_PAT". - Claude Desktop: Settings > Connectors > Add custom connector with the URL, or the Docker-based local server in
claude_desktop_config.json. - Cursor (
~/.cursor/mcp.json):{"mcpServers": {"github": {"url": "https://api.githubcopilot.com/mcp/", "headers": {"Authorization": "Bearer YOUR_GITHUB_PAT"}}}}. - VS Code (
.vscode/mcp.json):{"servers": {"github": {"type": "http", "url": "https://api.githubcopilot.com/mcp/"}}}; VS Code signs in with GitHub OAuth.
Run order and variables
Fill githubToken, set owner and repo to a repository you control (a scratch repo is ideal for the write folder), then run folder 2 (who am I), 3 (repository content), 4 (issues), 5 (pull requests) and 6 (writes). issueNumber and pullNumber come from the list requests.
Safety
Write tools change real repositories: issue_write, add_issue_comment, create_branch, create_or_update_file (commits straight to a branch), create_pull_request and merge_pull_request. Use a fine-grained token scoped to the repos you mean, set X-MCP-Readonly: true for assistants that only read, consider lockdown mode for public repos (issue text from strangers can contain prompt injection), and review every merge yourself. Rate limits are GitHub's normal API limits (docs).
Common errors
| Response | Meaning | Fix |
|---|---|---|
HTTP 401 missing required Authorization header | No token | Fill githubToken |
| HTTP 401/403 with a token | Expired PAT or org policy blocks it | New token; check org settings |
Tool result 404 Not Found | Repo not visible to the token | Add the repo to the fine-grained token |
| Tool not found | Toolset not enabled | Add it in X-MCP-Toolsets |
422 from create_or_update_file | Missing sha for an existing file | Get it with get_file_contents |
Docs: remote server, README tools list, server configuration.
Endpoints 23
1. Start here: auth discovery
- POSTCall /mcp without a token (expect 401)
{{mcpUrl}}Sends an MCP initialize request without Authorization. GitHub answers 401 with a WWW-Authenticate header pointing at the protected-resource metadata, which… - GETProtected resource metadata
https://api.githubcopilot.com/.well-known/oauth-protected-resource/mcp/Reads the OAuth protected-resource document for the MCP endpoint: GitHub's OAuth server as issuer and the scopes the server may ask for (repo, read:org, gist,… - GETGitHub OAuth server metadata
https://github.com/.well-known/oauth-authorization-server/login/oauthReads GitHub's OAuth authorization server metadata: authorize, token and device-code endpoints, PKCE S256 and the supported grants. MCP clients use it to run… - POSTInitialize with your token (raw JSON-RPC)
{{mcpUrl}}Runs the MCP initialize handshake with your PAT and the X-MCP-Readonly header set to false, so you can see the server name, protocol version and capabilities.…
2. Context
- MCPWho am I
{{mcpUrl}}Calls get_me, which takes no arguments and returns the authenticated user's login, name, profile URL and plan. Run it first to confirm the token works and…
3. Repositories and code
- MCPSearch repositories
{{mcpUrl}}Calls search_repositories with a GitHub search query (qualifiers like language:, stars:, topic:, user: work). minimal_output defaults to true for a compact… - MCPGet file or directory contents
{{mcpUrl}}Calls get_file_contents with owner, repo and path. A file returns its text and blob sha (needed to update it later); a directory returns its entries. Optional… - MCPList branches
{{mcpUrl}}Calls list_branches with owner and repo (page and perPage optional) and returns branch names with their head commit sha and protection flag. - MCPList commits
{{mcpUrl}}Calls list_commits for a repo. Optional sha (branch, tag or commit), path, author, since and until (ISO 8601) filter the history; perPage up to 100. - MCPSearch code
{{mcpUrl}}Calls search_code with a GitHub code search query: terms are ANDed and qualifiers such as repo:owner/repo, language:, path: narrow it. Returns matching files…
4. Issues
- MCPList issues
{{mcpUrl}}Calls list_issues for owner and repo. state (OPEN or CLOSED), labels, since and orderBy with direction filter; pagination is cursor based with after. Copy a… - MCPRead an issue
{{mcpUrl}}Calls issue_read with method get (or get_comments, get_sub_issues, get_parent, get_labels), owner, repo and issue_number. Returns the issue body, state,… - MCPSearch issues
{{mcpUrl}}Calls search_issues with a natural language query; add owner and repo to stay in one repository. Returns matching issues across repos with title, state and URL.
5. Pull requests
- MCPList pull requests
{{mcpUrl}}Calls list_pull_requests with owner and repo; state (open, closed, all), base, head, sort and direction filter. Copy a number into pullNumber. - MCPGet a pull request
{{mcpUrl}}Calls pull_request_read with method get plus owner, repo and pullNumber. Returns title, body, state, mergeable flag, head and base. Other methods: get_diff,… - MCPGet PR check runs
{{mcpUrl}}Calls pull_request_read with method get_check_runs to list the CI jobs on the head commit with their status and conclusion. Ask the assistant to explain… - MCPGet the PR diff
{{mcpUrl}}Calls pull_request_read with method get_diff and returns the unified diff of the pull request, which is what an assistant reads before reviewing or…
6. Writes (scratch repository)
- MCPCreate an issue
{{mcpUrl}}Calls issue_write with method create, owner, repo and title; body, labels, assignees and milestone are optional. Creates a real issue that notifies watchers.… - MCPComment on an issue or PR
{{mcpUrl}}Calls add_issue_comment with owner, repo, issue_number (issues and PRs share numbers) and body. Alternatively pass reaction instead of body to add an emoji… - MCPCreate a branch
{{mcpUrl}}Calls create_branch with owner, repo and the new branch name; from_branch defaults to the repository's default branch. Use it before committing a change for a… - MCPCreate or update a file
{{mcpUrl}}Calls create_or_update_file to commit a file straight to a branch. Required: owner, repo, path, content (plain text; the server base64-encodes it), message… - MCPOpen a pull request
{{mcpUrl}}Calls create_pull_request with owner, repo, title, head (your branch) and base (target branch); body, draft and reviewers are optional. Opening it as a draft… - MCPMerge a pull request
{{mcpUrl}}Calls merge_pull_request with owner, repo and pullNumber; merge_method (merge, squash, rebase), commit_title and expectedHeadSha are optional. Merging is hard…
API details
- Base URL
https://api.githubcopilot.com/mcp- Authentication
- A bearer token in the Authorization header
OAuth 2.0 (authorization code flow) with 10 scopes - Operations
- 23 operations on 23 pathsPOST 21GET 2
- Main resources
- 1. Start here: auth discovery 42. Context 13. Repositories and code 54. Issues 35. Pull requests 46. Writes (scratch repository) 6
- Description format
- Swastik Codes guided collection, API version
checked against the docs on 2026-11-18 - Links
- Documentation
How to test the GitHub MCP server in Swastik Codes
- Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
- Fork it into your workspaceChoose a workspace. You get your own copy of the GitHub MCP server collection, without the publisher's secrets.
- Add your credentialsThis API uses A bearer token in the Authorization header. Add yours in the collection's variables or an environment; the requests already reference it.
- Send a requestPick an endpoint, for example “Call /mcp without a token (expect 401)” (POST {{mcpUrl}}), and press Send. Check the response, add tests and run the whole collection with the runner.
Frequently asked questions
What is the GitHub MCP server?
Use GitHub's official remote MCP server: repos, code search, issues, pull requests and toolsets, with a PAT or OAuth. It is listed under Developer tools and has 23 endpoints.
Who publishes the GitHub MCP server?
It is listed from GitHub's public API description (an OpenAPI document), not published by GitHub on Swastik Codes. Anyone who controls github.com can claim the profile by adding a DNS TXT record.
What is the base URL of the GitHub MCP server?
Requests go to https://api.githubcopilot.com/mcp. Endpoint paths are added to this base URL.
How do I authenticate with the GitHub MCP server?
It accepts 2 methods: A bearer token in the Authorization header; OAuth 2.0 (authorization code flow) with 10 scopes.
How many endpoints does the GitHub MCP server have?
23 operations on 23 paths (21 POST, 2 GET). The largest groups are 1. Start here: auth discovery, 2. Context, 3. Repositories and code, 4. Issues.
Is forking the GitHub MCP server free?
Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.