gemini-agent-mcp
Provides tools for inspecting local Git repositories, including git status and git diff, and can run Git commands via the shell to track workspace changes.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
A remote MCP (Model Context Protocol) agent harness that lets Gemini Web or CLI clients inspect workspaces, read and edit files, track diffs, and execute shell commands on local machines behind NAT via a lightweight gateway and Go client binary.
Architecture
Gemini Web / CLI
│ HTTPS (POST/GET /mcp/<deviceId>, Bearer or X-Gateway-Token)
▼
Gateway Server (Cloudflare Workers or self-hosted workerd)
├── RegistryHub (SQLite DO) ── device list, clientToken, PBKDF2 admin password
├── RelayHub[deviceId] (SQLite DO + WebSocket Hibernation)
│ ├── workspaces, diffs, command logs, pending approvals, device gatewayToken
│ └── /ws/ui (live WebSocket updates to the web console)
└── ASSETS (packages/web static bundle)
▲
│ Outbound WSS (/ws/client, X-Client-Token + X-Device-Id)
▼
Local Go Client (gemini-mcp)
└── ~/.gemini-mcp/config.json ── serverUrl, clientToken, deviceId, mcpUrl, gatewayTokenEach connected machine receives its own deviceId, an isolated /mcp/<deviceId> endpoint, and a server-issued gatewayToken. Rotating or setting a custom device password in the web console updates the connected client's local configuration file automatically.
Related MCP server: opencode-remote-mcp
Server deployment
Option A: Cloudflare Workers
One-click deploy
During deployment, Cloudflare prompts for the secrets defined in .dev.vars.example:
ADMIN_PASSWORD: initial administrator password for the web console (can be changed later inside the WebUI).CLIENT_TOKEN: pre-shared registration token used by local client binaries to connect via WebSocket.SESSION_SECRET: HMAC-SHA256 key used to sign WebUI session cookies.
Manual deploy via Wrangler
npm install
npm run build
npx wrangler secret put ADMIN_PASSWORD
npx wrangler secret put CLIENT_TOKEN
npx wrangler secret put SESSION_SECRET
npx wrangler deployThe root wrangler.jsonc runs the @gemini-mcp/shared and @gemini-mcp/web builds automatically before packaging the Worker and static assets.
Option B: Self-hosted outside Cloudflare (VPS / Docker)
The server runs on any Linux/macOS host or container using the open-source workerd runtime via Wrangler with local SQLite persistence, without requiring a Cloudflare account.
Run directly on a VPS
npm install
npm run build -w @gemini-mcp/shared && npm run build -w @gemini-mcp/web
cp .dev.vars.example .dev.vars
# Edit .dev.vars with your ADMIN_PASSWORD, CLIENT_TOKEN, and SESSION_SECRET
npm run start:serverThis listens on 0.0.0.0:8787 and stores SQLite Durable Object state under ./data.
Run with Docker
cp .dev.vars.example .dev.vars
# Edit .dev.vars with your secrets
docker build -t gemini-agent-mcp .
docker run -d \
--name gemini-agent-mcp \
--restart unless-stopped \
-p 8787:8787 \
-v "$(pwd)/data:/app/data" \
-v "$(pwd)/.dev.vars:/app/.dev.vars:ro" \
gemini-agent-mcpReverse proxy notes
Gemini Web requires HTTPS for remote MCP endpoints. Place Caddy, Nginx, or Traefik in front of port 8787 with WebSocket upgrade enabled and X-Forwarded-Proto / X-Forwarded-Host headers forwarded so the gateway assigns public https:// MCP URLs to connecting clients.
Example Caddyfile:
mcp.example.com {
reverse_proxy 127.0.0.1:8787
}Client usage
Download prebuilt binaries
Prebuilt static binaries for windows/amd64, linux/amd64, linux/arm64, and linux/armhf are published on GitHub Releases.
Example on Linux (amd64):
curl -fsSL -o gemini-mcp https://github.com/XTxiaoting14332/gemini-agent-mcp/releases/latest/download/gemini-mcp-linux-amd64
chmod +x gemini-mcp
sudo mv gemini-mcp /usr/local/bin/gemini-mcpFirst-run setup and configuration
Run the binary with flags once, or run gemini-mcp in an interactive terminal to follow the prompt:
gemini-mcp \
--url https://your-gateway.example.com \
--token <CLIENT_TOKEN> \
--name workstationOn connection, the server assigns deviceId, mcpUrl, and gatewayToken, writes them to ~/.gemini-mcp/config.json (mode 0600), and prints the assigned endpoint and password to stdout. Subsequent runs only require:
gemini-mcpTo use a custom config file path or update connection fields:
gemini-mcp --config /path/to/config.json
gemini-mcp init --url https://your-gateway.example.com --token <CLIENT_TOKEN> --name server-01Gemini MCP configuration
Gemini Web (gemini.google.com)
In Gemini Web under custom MCP server connections (Connect to MCP server), the gateway exposes OAuth 2.1 discovery (/.well-known/oauth-protected-resource, /.well-known/oauth-authorization-server) and PKCE authorization (/oauth/authorize, /oauth/token):
MCP Server URL:
https://your-gateway.example.com/mcp/<deviceId>Expand Other settings (optional if using dynamic client registration, or fill directly from the WebUI Overview tab):
Client ID (
OAuth Client ID):<deviceId>Client Secret (
OAuth Client Secret):<DEVICE_GATEWAY_TOKEN>
Click Next and approve access on the gateway authorization page using your device password (
<DEVICE_GATEWAY_TOKEN>) or WebUI admin password.
Gemini CLI / Gateway clients
Clients that support custom HTTP headers can connect directly using static Bearer or gateway headers:
{
"mcpServers": {
"workstation": {
"httpUrl": "https://your-gateway.example.com/mcp/<deviceId>",
"headers": {
"Authorization": "Bearer <DEVICE_GATEWAY_TOKEN>",
"X-Gateway-Token": "<DEVICE_GATEWAY_TOKEN>"
}
}
}
}Command policy and security
Workspace sandboxing: file operations (
list_dir,find_files,read_file,write_file,edit_file,delete_file,grep_search,git_status,git_diff) andrun_commandworking directories are validated on the client against enabled workspace paths registered in the WebUI using symlink-aware realpath resolution.automode (default):run_commandrequiresrisk_level(safe,moderate, orhigh) andrisk_reason, combined with deterministic server-side pattern escalation in packages/shared/src/risk.ts (rm -rf,sudo, piped remote scripts,git push --force, etc.).safecommands execute immediately;moderateandhighcommands pause withAPPROVAL_REQUIREDand anapproval_id, requiring user confirmation in chat (允许/拒绝) or via the WebUI Commands tab.bypassmode: executes workspace commands directly without approval prompts while still recording stdout, stderr, exit codes, and duration.Credential storage: the WebUI administrator password is stored as a salted PBKDF2-SHA256 hash inside
RegistryHubSQLite. Changing the password in WebUI Settings increments the password version and invalidates prior session cookies.
Repository layout
.github/workflows/ CI checks and multi-arch client release workflow
packages/
shared/ shared TypeScript protocol types, MCP tool schemas, risk classifier
worker/ gateway router, MCP Streamable HTTP handler, RelayHub & RegistryHub DOs
web/ React + Vite + Tailwind CSS v4 web console
client-go/ standalone Go client binary (cmd/gemini-mcp)
client/ Node.js/TypeScript reference client and esbuild single-file bundle
scripts/ end-to-end integration test against local wrangler dev
Dockerfile self-hosted container image using workerd + local SQLite persistence
wrangler.jsonc root Workers configuration for one-click, CLI, and self-hosted runsDevelopment
Requirements: Node.js 20+ (tested on Node 22) and Go 1.24+.
npm install
npm run build
npm run typecheckRun the end-to-end integration test (starts local wrangler dev, connects both the Go binary and Node bundle clients simultaneously, and verifies auth, multi-device isolation, diffs, auto approval, and bypass execution):
npm testCross-compile all release binaries locally:
npm run build:binary-allLicense
Source code is licensed under the GNU General Public License v3.0 (GPL-3.0); see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Remote shell and detached long-running jobs on your own machines — no SSH, open ports or VPN.
Connect AI assistants to your Mac and Linux computers with scoped access to local files and tools.
Secure tunneling, reverse proxy and remote access for local applications.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables Google Gemini on web or mobile to connect to a local Antigravity IDE/CLI workstation, letting users browse and manage coding sessions, inspect paused approvals, search and read repository files, audit git changes, send handoffs that resume the right project chat, and view ASCII usage telemetry or a live web dashboard.12AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceBridges Gemini Web, Gemini Mobile, and other remote MCP clients to a locally running OpenCode instance over StreamableHTTP. It enables sandboxed repository inspection (status, read, search, diff) plus dispatching, polling, and interrupting OpenCode coding sessions from a phone or browser.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables Gemini Web to securely connect to local code repositories and terminal toolchains through Streamable HTTP MCP, hardened OAuth 2.1, and Cloudflare Tunnel support, with low-RTT batch tools for searching, reading, editing, and executing commands.MIT
- AlicenseAqualityBmaintenanceEnables Gemini on the web and the local Gemini app to read files, search code, and run commands on the user's computer through a locally running HTTP or stdio MCP server. Connections reach the machine over Tailscale Funnel, a Cloudflare tunnel, or a custom HTTPS reverse proxy, with OAuth approval, write-session claiming, and confirmation for destructive commands.1311MIT