Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4.8k
docs: Add Google Gemini CLI installation guide and integration#757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
edbdf4b89ec9f5526a6c10127628a6e2426bc9639179e07826bfae0dc52a1dee5e7bfdd6696f67e736798f794ab660967c83c67d10d4dca934434aafc381f8615cc6072a7214cd4454ead3bf326d4e070b33df257acaad060fa30139db9e7ff86293f2e5ad726d9139f86124e12040dbf898f17f6718c7File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| # Install GitHub MCP Server in Google Gemini CLI | ||
| ## Prerequisites | ||
| 1. Google Gemini CLI installed (see [official Gemini CLI documentation](https://github.com/google-gemini/gemini-cli)) | ||
| 2. [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new) with appropriate scopes | ||
| 3. For local installation: [Docker](https://www.docker.com/) installed and running | ||
| <details> | ||
| <summary><b>Storing Your PAT Securely</b></summary> | ||
| <br> | ||
| For security, avoid hardcoding your token. Create or update `~/.gemini/.env` (where `~` is your home or project directory) with your PAT: | ||
| ||
| ```bash | ||
| # ~/.gemini/.env | ||
| GITHUB_PAT=your_token_here | ||
| ``` | ||
| </details> | ||
| ## GitHub MCP Server Configuration | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The installation could be outdated with the main README.md file ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the note as requested: 26d9139 | ||
| MCP servers for Gemini CLI are configured in its settings JSON under an `mcpServers` key. | ||
| - **Global configuration**: `~/.gemini/settings.json` where `~` is your home directory | ||
| - **Project-specific**: `.gemini/settings.json` in your project directory | ||
| After securely storing your PAT, you can add the GitHub MCP server configuration to your settings file using one of the methods below. You may need to restart the Gemini CLI for changes to take effect. | ||
| > **Note:** For the most up-to-date configuration options, see the [main README.md](../../README.md). | ||
| ### Method 1: Remote Server (Recommended) | ||
| The simplest way is to use GitHub's hosted MCP server: | ||
| ```json | ||
| // ~/.gemini/settings.json | ||
| { | ||
| "mcpServers": { | ||
| "github": { | ||
| "httpUrl": "https://api.githubcopilot.com/mcp/", | ||
| "trust": true, | ||
| "headers": { | ||
| "Authorization": "Bearer $GITHUB_PAT" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove "Bearer"
| ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| ### Method 2: Local Docker | ||
| With docker running, you can run the GitHub MCP server in a container: | ||
| ```json | ||
| // ~/.gemini/settings.json | ||
| { | ||
| "mcpServers": { | ||
| "github": { | ||
| "command": "docker", | ||
| "args": [ | ||
| "run", | ||
| "-i", | ||
| "--rm", | ||
| "-e", | ||
| "GITHUB_PERSONAL_ACCESS_TOKEN", | ||
| "ghcr.io/github/github-mcp-server" | ||
| ], | ||
| "env": { | ||
| "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_PAT" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| ### Method 3: Binary | ||
| You can download the latest binary release from the [GitHub releases page](https://github.com/github/github-mcp-server/releases) or build it from source by running `go build -o github-mcp-server ./cmd/github-mcp-server`. | ||
| Then, replacing `/path/to/binary` with the actual path to your binary, configure Gemini CLI with: | ||
| ```json | ||
| // ~/.gemini/settings.json | ||
| { | ||
| "mcpServers": { | ||
| "github": { | ||
| "command": "/path/to/binary", | ||
| "args": ["stdio"], | ||
| "env": { | ||
| "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_PAT" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| ## Verification | ||
| To verify that the GitHub MCP server has been configured, start Gemini CLI in your terminal with `gemini`, then: | ||
| 1. **Check MCP server status**: | ||
| ``` | ||
| /mcp list | ||
| ``` | ||
| ``` | ||
| ℹConfigured MCP servers: | ||
| 🟢 github - Ready (96 tools, 2 prompts) | ||
| Tools: | ||
| - github__add_comment_to_pending_review | ||
| - github__add_issue_comment | ||
| - github__add_sub_issue | ||
| ... | ||
| ``` | ||
| 2. **Test with a prompt** | ||
| ``` | ||
| List my GitHub repositories | ||
| ``` | ||
| ## Troubleshooting | ||
| ### Local Server Issues | ||
| - **Docker errors**: Ensure Docker Desktop is running | ||
| ```bash | ||
| docker --version | ||
| ``` | ||
| - **Image pull failures**: Try `docker logout ghcr.io` then retry | ||
| - **Docker not found**: Install Docker Desktop and ensure it's running | ||
| ### Authentication Issues | ||
| - **Invalid PAT**: Verify your GitHub PAT has correct scopes: | ||
| - `repo` - Repository operations | ||
| - `read:packages` - Docker image access (if using Docker) | ||
| - **Token expired**: Generate a new GitHub PAT | ||
| ### Configuration Issues | ||
| - **Invalid JSON**: Validate your configuration: | ||
| ```bash | ||
| cat ~/.gemini/settings.json | jq . | ||
| ``` | ||
| - **MCP connection issues**: Check logs for connection errors: | ||
| ```bash | ||
| gemini --debug "test command" | ||
| ``` | ||
| ## References | ||
| - Gemini CLI Docs > [MCP Configuration Structure](https://google-gemini.github.io/gemini-cli/docs/tools/mcp-server.html#configuration-structure) | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or Podman. (https://podman.io)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not used Podman but based on my quick check it has Docker command compatibility, so I have added it: 79e0782
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case there is any doubt.... I use podman with this server and with gemini-cli, and it works great - no surprise here.