How to Add GitHub MCP to Gemini CLI
Add GitHub MCP (Model Context Protocol) to your Gemini CLI to enable repository access, issue management, and code analysis capabilities.
Prerequisites
- Gemini CLI installed
- Docker installed
Setup
1. Create GitHub Personal Access Token
Go to https://github.com/settings/personal-access-tokens/new and create a token with repository permissions.
2. Create Settings Configuration
Create .gemini/settings.json with the following configuration:
{
"mcpServers": {
"github": {
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN=YOURTOKEN", "ghcr.io/github/github-mcp-server"]
}
}
}Replace YOURTOKEN with your actual GitHub Personal Access Token.
That's it! Your Gemini CLI now has access to GitHub repositories and can perform various GitHub operations through natural language commands.
Note:
Using the official Docker MCP servers (such as the GitHub MCP server or Docker MCP Toolkit) will always enable all the tools that server exposes. There is currently no way to filter or disable individual tools via configuration. This might lead to exceeding tool limits and affected performance.