GitHub Integration in VS Code Using Docker MCP: A Step-by-Step Tutorial
Written by Om-Shree-0709 on .
- Prerequisites
- Generate a GitHub Personal Access Token
- Install and Launch Docker
- Enable the GitHub MCP Server in Docker MCP Toolkit
- Connect a Client (Cursor, Claude, or VS Code)
- Then open Settings (JSON) and add this configuration:
- Start Using GitHub in VS Code
- What Happens Behind the Scenes
- Troubleshooting
- Security Tips
- Conclusion
- 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
andworkflow
scopes
2. Generate a GitHub Personal Access Token
- Navigate to GitHub → Settings → Developer settings → PATs2
- Click Generate new token
- Select scopes:
repo
,workflow
- Save the token securely
3. Install and Launch Docker
- Download Docker Desktop from docker.com
- Install and start Docker Desktop
- Verify it’s running correctly by checking the Docker icon in your system tray
or by running the following commands in your terminal:
4. Enable the GitHub MCP Server in Docker MCP Toolkit
- Open Docker Desktop and go to the MCP Toolkit section
- Search for
github_official
in the available MCP servers list - Enable the server by toggling it on
- Go to the configuration tab for
github_official
- Paste your GitHub PAT into the required environment variable input
- Save and apply changes
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)
To connect via VS Code:
-
Open Visual Studio Code 3
-
Press
Ctrl+Shift+P
to launch the command palette -
Run the following command to establish a socket bridge:
4. Then open Settings (JSON) and add this configuration:
Replace YOUR_GITHUB_TOKEN_HERE
with your actual token.
6. Start Using GitHub in VS Code
- Press
Ctrl+Shift+P
- Choose available GitHub commands such as List repositories, Create pull request, or Show commits
- Or simply ask GitHub Copilot in natural language (e.g., “Show me my latest PRs”)
- Docker will spin up a temporary container running the GitHub MCP server to handle each request.4
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.
8. Troubleshooting
Problem | Symptom | Solution |
---|---|---|
Docker not running | VS Code commands hang | Launch Docker Desktop |
Invalid/expired PAT | Authentication errors | Generate a new PAT |
Network issues | Timeout on GitHub actions | Check internet/firewall settings |
Image not found | Docker error | Run docker pull mcp/github-mcp-server |
Missing scopes | Permission denied | Ensure 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
Written by Om-Shree-0709 (@Om-Shree-0709)