Skip to main content
Glama

GitHub Integration in VS Code Using Docker MCP: A Step-by-Step Tutorial

Written by on .

mcp
vscode
Github
Docker

  1. Prerequisites
    1. Generate a GitHub Personal Access Token
      1. Install and Launch Docker
        1. Enable the GitHub MCP Server in Docker MCP Toolkit
          1. Connect a Client (Cursor, Claude, or VS Code)
            1. Then open Settings (JSON) and add this configuration:
              1. Start Using GitHub in VS Code
                1. What Happens Behind the Scenes
                  1. Troubleshooting
                    1. Security Tips
                      1. Conclusion
                        1. Acknowledgements

                          Integrating GitHub with Visual Studio Code (VS Code) using Docker's MCP server introduces a secure, modular way to work with GitHub APIs inside your editor. This tutorial walks through setting up a Docker-based GitHub MCP server and using it in VS Code for a seamless, containerized development experience.1

                          1. Prerequisites

                          • Visual Studio Code
                          • Docker Desktop (running)
                          • A GitHub account
                          • A Personal Access Token (PAT) with repo and workflow scopes

                          2. Generate a GitHub Personal Access Token

                          1. Navigate to GitHub → Settings → Developer settings → PATs2
                          2. Click Generate new token
                          3. Select scopes: repo, workflow
                          4. Save the token securely

                          Image

                          3. Install and Launch Docker

                          1. Download Docker Desktop from docker.com
                          2. Install and start Docker Desktop
                          3. Verify it’s running correctly by checking the Docker icon in your system tray
                            or by running the following commands in your terminal:
                          docker --version # Confirms Docker is installed
                          docker run hello-world # Pulls and runs a test image to verify the Docker is working properly

                          4. Enable the GitHub MCP Server in Docker MCP Toolkit

                          1. Open Docker Desktop and go to the MCP Toolkit section
                          2. Search for github_official in the available MCP servers list
                          3. Enable the server by toggling it on
                          4. Go to the configuration tab for github_official
                          5. Paste your GitHub PAT into the required environment variable input
                          6. Save and apply changes

                          Image

                          5. Connect a Client (Cursor, Claude, or VS Code)

                          Docker MCP Toolkit supports multiple clients. You can connect using:

                          • Cursor IDE (auto-detected)
                          • Claude Desktop (connect via toolkit interface)
                          • VS Code (manual setup as follows)

                          Image

                          To connect via VS Code:

                          1. Open Visual Studio Code 3

                          2. Press Ctrl+Shift+P to launch the command palette

                          3. Run the following command to establish a socket bridge:

                            docker run -i --rm alpine/socat STDIO TCP:host.docker.internal:8811

                          4. Then open Settings (JSON) and add this configuration:

                          "mcp": { "servers": { "my-mcp-server": { "type": "stdio", "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_TOKEN_HERE", "mcp/github-mcp-server" ] } } }

                          Replace YOUR_GITHUB_TOKEN_HERE with your actual token.

                          6. Start Using GitHub in VS Code

                          1. Press Ctrl+Shift+P
                          2. Choose available GitHub commands such as List repositories, Create pull request, or Show commits
                          3. Or simply ask GitHub Copilot in natural language (e.g., “Show me my latest PRs”)
                          4. Docker will spin up a temporary container running the GitHub MCP server to handle each request.4

                          Image

                          7. What Happens Behind the Scenes

                          • When a GitHub command is triggered inside VS Code, the MCP client initiates a connection to a Docker containerized server instance using the mcp/github-mcp-server image.
                          • The GitHub Personal Access Token (PAT) is securely injected into the container at runtime via an environment variable, preventing exposure on the host system.
                          • Inside the container, the MCP server translates structured or natural language commands into authenticated GitHub API calls using the provided token.
                          • The communication occurs over a local TCP socket (bridged using socat), allowing the host editor to interact with the server without exposing public ports.
                          • Once the requested operation completes (e.g., listing repositories, creating a PR), the container exits cleanly, leaving no residual processes or credentials behind.

                          Image

                          8. Troubleshooting

                          ProblemSymptomSolution
                          Docker not runningVS Code commands hangLaunch Docker Desktop
                          Invalid/expired PATAuthentication errorsGenerate a new PAT
                          Network issuesTimeout on GitHub actionsCheck internet/firewall settings
                          Image not foundDocker errorRun docker pull mcp/github-mcp-server
                          Missing scopesPermission deniedEnsure correct scopes in the PAT

                          9. Security Tips

                          • Never share or commit your PAT in public code
                          • Remove sensitive environment variables before sharing your settings
                          • Consider limiting container runtime resources via Docker settings for added safety

                          10. Conclusion

                          Docker MCP enables secure GitHub integration directly inside your editor using isolated containers. Whether you're connecting via VS Code, Cursor, or Claude, this method offers flexibility, speed, and peace of mind for developers handling critical workflows.

                          Acknowledgements

                          This tutorial is based on insights shared by Michael Irwin in his Docker MCP Toolkit walkthrough video5, where he demonstrated how to securely connect GitHub to VS Code using containerized MCP servers. Special thanks to the Docker team and broader MCP developer community for building reliable tools that simplify secure, modular development workflows.

                          Footnotes

                          1. MCP Toolkit - Docker Docs

                          2. GitHub's official MCP Server

                          3. Use MCP servers in VS Code (Preview)

                          4. Author’s GitHub Example Repository

                          5. How to Use Docker MCP Catalog and Toolkit (Docker Tutorial) – YouTube

                          Written by Om-Shree-0709 (@Om-Shree-0709)