AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

Stateful Auth For The Github Mcp Server

mcp-sirkanaad26-stateful-auth-for-the-github-mcp-server · by SirKanaad26

Implementing Stateful Authorization for the Github MCP Server. Note: we have cloned the official Github MCP server and then worked on it.

No reviews yet
0 installs
29 views
0.0% view→install

Install

$ agentstack add mcp-sirkanaad26-stateful-auth-for-the-github-mcp-server

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access Used
  • Shell / process execution No
  • Environment & secrets Used
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-sirkanaad26-stateful-auth-for-the-github-mcp-server)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Stateful Auth For The Github Mcp Server? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

[](https://goreportcard.com/report/github.com/github/github-mcp-server)

GitHub MCP Server

The GitHub MCP Server connects AI tools directly to GitHub's platform. This gives AI agents, assistants, and chatbots the ability to read repositories and code files, manage issues and PRs, analyze code, and automate workflows. All through natural language interactions.

Use Cases

  • Repository Management: Browse and query code, search files, analyze commits, and understand project structure across any repository you have access to.
  • Issue & PR Automation: Create, update, and manage issues and pull requests. Let AI help triage bugs, review code changes, and maintain project boards.
  • CI/CD & Workflow Intelligence: Monitor GitHub Actions workflow runs, analyze build failures, manage releases, and get insights into your development pipeline.
  • Code Analysis: Examine security findings, review Dependabot alerts, understand code patterns, and get comprehensive insights into your codebase.
  • Team Collaboration: Access discussions, manage notifications, analyze team activity, and streamline processes for your team.

Built for developers who want to connect their AI tools to GitHub context and capabilities, from simple natural language queries to complex multi-step agent workflows.


Remote GitHub MCP Server

[](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D) [](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D&quality=insiders)

The remote GitHub MCP Server is hosted by GitHub and provides the easiest method for getting up and running. If your MCP host does not support remote MCP servers, don't worry! You can use the local version of the GitHub MCP Server instead.

Prerequisites

  1. A compatible MCP host with remote server support (VS Code 1.101+, Claude Desktop, Cursor, Windsurf, etc.)
  2. Any applicable policies enabled

Install in VS Code

For quick installation, use one of the one-click install buttons above. Once you complete that flow, toggle Agent mode (located by the Copilot Chat text input) and the server will start. Make sure you're using VS Code 1.101 or later for remote MCP and OAuth support.

Alternatively, to manually configure VS Code, choose the appropriate JSON block from the examples below and add it to your host configuration:

Using OAuthUsing a GitHub PAT VS Code (version 1.101 or greater)

{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/"
    }
  }
}
{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer ${input:github_mcp_pat}"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "github_mcp_pat",
      "description": "GitHub Personal Access Token",
      "password": true
    }
  ]
}

Install in other MCP hosts

  • [GitHub Copilot in other IDEs](/docs/installation-guides/install-other-copilot-ides.md) - Installation for JetBrains, Visual Studio, Eclipse, and Xcode with GitHub Copilot
  • [Claude Applications](/docs/installation-guides/install-claude.md) - Installation guide for Claude Web, Claude Desktop and Claude Code CLI
  • [Cursor](/docs/installation-guides/install-cursor.md) - Installation guide for Cursor IDE
  • [Windsurf](/docs/installation-guides/install-windsurf.md) - Installation guide for Windsurf IDE

> Note: Each MCP host application needs to configure a GitHub App or OAuth App to support remote access via OAuth. Any host application that supports remote MCP servers should support the remote GitHub server with PAT authentication. Configuration details and support levels vary by host. Make sure to refer to the host application's documentation for more info.

Configuration

Toolset configuration

See [Remote Server Documentation](docs/remote-server.md) for full details on remote server configuration, toolsets, headers, and advanced usage. This file provides comprehensive instructions and examples for connecting, customizing, and installing the remote GitHub MCP Server in VS Code and other MCP hosts.

When no toolsets are specified, [default toolsets](#default-toolset) are used.

Enterprise Cloud with data residency (ghe.com)

GitHub Enterprise Cloud can also make use of the remote server.

Example for https://octocorp.ghe.com:

{
    ...
    "proxima-github": {
      "type": "http",
      "url": "https://copilot-api.octocorp.ghe.com/mcp",
      "headers": {
        "Authorization": "Bearer ${input:github_mcp_pat}"
      }
    },
    ...
}

GitHub Enterprise Server does not support remote server hosting. Please refer to [GitHub Enterprise Server and Enterprise Cloud with data residency (ghe.com)](#github-enterprise-server-and-enterprise-cloud-with-data-residency-ghecom) from the local server configuration.


Local GitHub MCP Server

[](https://insiders.vscode.dev/redirect/mcp/install?name=github&inputs=%5B%7B%22id%22%3A%22githubtoken%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22GitHub%20Personal%20Access%20Token%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITHUBPERSONALACCESSTOKEN%22%2C%22ghcr.io%2Fgithub%2Fgithub-mcp-server%22%5D%2C%22env%22%3A%7B%22GITHUBPERSONALACCESSTOKEN%22%3A%22%24%7Binput%3Agithubtoken%7D%22%7D%7D) [](https://insiders.vscode.dev/redirect/mcp/install?name=github&inputs=%5B%7B%22id%22%3A%22githubtoken%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22GitHub%20Personal%20Access%20Token%22%2C%22password%22%3Atrue%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITHUBPERSONALACCESSTOKEN%22%2C%22ghcr.io%2Fgithub%2Fgithub-mcp-server%22%5D%2C%22env%22%3A%7B%22GITHUBPERSONALACCESSTOKEN%22%3A%22%24%7Binput%3Agithubtoken%7D%22%7D%7D&quality=insiders)

Prerequisites

  1. To run the server in a container, you will need to have Docker installed.
  2. Once Docker is installed, you will also need to ensure Docker is running. The image is public; if you get errors on pull, you may have an expired token and need to docker logout ghcr.io.
  3. Lastly you will need to Create a GitHub Personal Access Token.

The MCP server can use many of the GitHub APIs, so enable the permissions that you feel comfortable granting your AI tools (to learn more about access tokens, please check out the documentation).

Handling PATs Securely

Environment Variables (Recommended)

To keep your GitHub PAT secure and reusable across different MCP hosts:

  1. Store your PAT in environment variables

``bash export GITHUB_PAT=your_token_here ` Or create a .env file: `env GITHUB_PAT=your_token_here ``

  1. Protect your .env file

``bash # Add to .gitignore to prevent accidental commits echo ".env" >> .gitignore ``

  1. Reference the token in configurations

```bash # CLI usage claude mcp update github -e GITHUBPERSONALACCESSTOKEN=$GITHUBPAT

# In config files (where supported) "env": { "GITHUBPERSONALACCESSTOKEN": "$GITHUBPAT" } ```

> Note: Environment variable support varies by host app and IDE. Some applications (like Windsurf) require hardcoded tokens in config files.

Token Security Best Practices

  • Minimum scopes: Only grant necessary permissions
  • repo - Repository operations
  • read:packages - Docker image access
  • read:org - Organization team access
  • Separate tokens: Use different PATs for different projects/environments
  • Regular rotation: Update tokens periodically
  • Never commit: Keep tokens out of version control
  • File permissions: Restrict access to config files containing tokens

``bash chmod 600 ~/.your-app/config.json ``

GitHub Enterprise Server and Enterprise Cloud with data residency (ghe.com)

The flag --gh-host and the environment variable GITHUB_HOST can be used to set the hostname for GitHub Enterprise Server or GitHub Enterprise Cloud with data residency.

  • For GitHub Enterprise Server, prefix the hostname with the https:// URI scheme, as it otherwise defaults to http://, which GitHub Enterprise Server does not support.
  • For GitHub Enterprise Cloud with data residency, use https://YOURSUBDOMAIN.ghe.com as the hostname.

``` json "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUBPERSONALACCESSTOKEN", "-e", "GITHUBHOST", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUBPERSONALACCESSTOKEN": "${input:githubtoken}", "GITHUB_HOST": "https://" } }


## Installation

### Install in GitHub Copilot on VS Code

For quick installation, use one of the one-click install buttons above. Once you complete that flow, toggle Agent mode (located by the Copilot Chat text input) and the server will start.

More about using MCP server tools in VS Code's [agent mode documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers).

Install in GitHub Copilot on other IDEs (JetBrains, Visual Studio, Eclipse, etc.)

Add the following JSON block to your IDE's MCP settings.

```json
{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "github_token",
        "description": "GitHub Personal Access Token",
        "password": true
      }
    ],
    "servers": {
      "github": {
        "command": "docker",
        "args": [
          "run",
          "-i",
          "--rm",
          "-e",
          "GITHUB_PERSONAL_ACCESS_TOKEN",
          "ghcr.io/github/github-mcp-server"
        ],
        "env": {
          "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
        }
      }
    }
  }
}

Optionally, you can add a similar example (i.e. without the mcp key) to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with other host applications that accept the same format.

Example JSON block without the MCP key included

{
  "inputs": [
    {
      "type": "promptString",
      "id": "github_token",
      "description": "GitHub Personal Access Token",
      "password": true
    }
  ],
  "servers": {
    "github": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GITHUB_PERSONAL_ACCESS_TOKEN",
        "ghcr.io/github/github-mcp-server"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
      }
    }
  }
}

Install in Other MCP Hosts

For other MCP host applications, please refer to our installation guides:

  • [GitHub Copilot in other IDEs](/docs/installation-guides/install-other-copilot-ides.md) - Installation for JetBrains, Visual Studio, Eclipse, and Xcode with GitHub Copilot
  • [Claude Code & Claude Desktop](docs/installation-guides/install-claude.md) - Installation guide for Claude Code and Claude Desktop
  • [Cursor](docs/installation-guides/install-cursor.md) - Installation guide for Cursor IDE
  • [Google Gemini CLI](docs/installation-guides/install-gemini-cli.md) - Installation guide for Google Gemini CLI
  • [Windsurf](docs/installation-guides/install-windsurf.md) - Installation guide for Windsurf IDE

For a complete overview of all installation options, see our [Installation Guides Index](docs/installation-guides).

> Note: Any host application that supports local MCP servers should be able to access the local GitHub MCP server. However, the specific configuration process, syntax and stability of the integration will vary by host application. While many may follow a similar format to the examples above, this is not guaranteed. Please refer to your host application's documentation for the correct MCP configuration syntax and setup process.

Build from source

If you don't have Docker, you can use go build to build the binary in the cmd/github-mcp-server directory, and use the github-mcp-server stdio command with the GITHUB_PERSONAL_ACCESS_TOKEN environment variable set to your token. To specify the output location of the build, use the -o flag. You should configure your server to use the built executable as its command. For example:

{
  "mcp": {
    "servers": {
      "github": {
        "command": "/path/to/github-mcp-server",
        "args": ["stdio"],
        "env": {
          "GITHUB_PERSONAL_ACCESS_TOKEN": ""
        }
      }
    }
  }
}

Tool Configuration

The GitHub MCP Server supports enabling or disabling specific groups of functionalities via the --toolsets flag. This allows you to control which GitHub API capabilities are available to your AI tools. Enabling only the toolsets that you need can help the LLM with tool choice and reduce the context size.

Toolsets are not limited to Tools. Relevant MCP Resources and Prompts are also included where applicable.

When no toolsets are specified, [default toolsets](#default-toolset) are used.

> Looking for examples? See the [Server Configuration Guide](./docs/server-configuration.md) for common recipes like minimal setups, read-only mode, and combining tools with toolsets.

Specifying Toolsets

To specify toolsets you want available to the LLM, you can pass an allow-list in two ways:

  1. Using Command Line Argument:

``bash github-mcp-server --toolsets repos,issues,pull_requests,actions,code_security ``

  1. Using Environment Variable:

``bash GITHUB_TOOLSETS="repos,issues,pull_requests,actions,code_security" ./github-mcp-server ``

The environment variable GITHUB_TOOLSETS takes precedence over the command line argument if both are provided.

Specifying Individual Tools

You can also configure specific tools using the --tools flag. Tools can be used independently or combined with toolsets and dynamic toolsets discovery for fine-grained control.

  1. Using Command Line Argument:

``bash github-mcp-server --tools get_file_contents,issue_read,create_pull_request ``

  1. Using Environment Variable:

``bash GITHUB_TOOLS="get_file_contents,issue_read,create_pull_request" ./github-mcp-server ``

  1. Combining with Toolsets (additive):

``bash github-mcp-server --toolsets repos,issues --tools get_gist ` This registers all tools from repos and issues toolsets, plus get_gist`.

  1. Combining with Dynamic Toolsets (additive):

``bash github-mcp-server --tools get_file_contents --dynamic-toolsets ` This registers getfilecontents plus the dynamic toolset tools (enabletoolset, listavailabletoolsets, gettoolset_tools`).

Important Notes:

  • Tools, toolsets, and dynamic toolsets can all be used together
  • Read-only mode takes priority: write tools are skipped if --read-only is set, even if explicitly requested via --tools
  • Tool names must match exactly (e.g., get_file_contents, not getFileContents). Invalid tool names will cause the server to fail at startup with an error message

Using Toolsets With Docker

When using Docker, you can pass the toolsets as environment variables:

docker run -i --rm \
  -e GITH

…

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [SirKanaad26](https://github.com/SirKanaad26)
- **Source:** [SirKanaad26/stateful-auth-for-the-github-mcp-server](https://github.com/SirKanaad26/stateful-auth-for-the-github-mcp-server)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.