gemini-workspace
Health Pass
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 60 GitHub stars
Code Fail
- fs module — File system access in package.json
- rm -rf — Recursive force deletion command in scripts/sync-agy-fast.sh
- network request — Outbound network request in src/agy-bridge.test.ts
- Hardcoded secret — Potential hardcoded credential in src/agy-bridge.test.ts
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
Gemini Web AGY MCP server with OAuth 2.1, deterministic local tools, Code Mode, and Skills
Gemini Workspace
Give Google Gemini Web (and its parallel Task subagents) your local machine—speaking the exact Antigravity (agy) tool surface Gemini was trained on.
Why Gemini Workspace?
Most local coding MCP servers (Desktop Commander, DevSpace, Filesystem MCP) were designed around ChatGPT / Codex (exec_command, write_stdin, apply_patch, open_workspace) or Claude Code. When you connect them to Gemini Web (gemini.google.com → Custom Connectors), you hit two walls:
- Wrong tool distribution: Gemini models are post-trained heavily on Google Antigravity's PascalCase tool surface (
read_file,write_file,edit_file,run_command,manage_task) with absolute paths and zeroopen_workspaceceremony. - Gemini Web Connector protocol quirks:
- Strict JSON Schema subset: Connector registration fails (
"We had trouble connecting") ifinputSchemacontains$schema,additionalProperties,$defs,const, or >32-bit integer bounds. - ~60s hard RPC timeout & no MCP
Tasks: Gemini Web declares MCP2025-11-25withouttaskscapability, ignores post-turn server push notifications, and kills any tool call exceeding ~60s (DEADLINE_EXCEEDED). - Parallel Task Subagents: In Gemini Task mode, Gemini spawns multiple cloud subagents that simultaneously
initializeagainst your/mcpendpoint. Without session isolation and concurrent refresh-token rotation grace, subagents either block each other past 60s, leak background task notices across agents, or trigger401token-rotation races.
- Strict JSON Schema subset: Connector registration fails (
Gemini Workspace is a lightweight, self-hosted MCP server built from the ground up around those exact constraints—with zero closed-source binary dependencies (only 6 runtime npm packages + Node's built-in node:sqlite).
Key Features
- 5 Native Deterministic
agyTools (Pure Node.js)read_file: 800-line / 46,080-byte paginated text reads with UTF-8 safeByteOffsetcontinuation + magic-byte multimodal inline blocks (PNG,JPEG,GIF,WebP,PDF,MP3,WAV,MP4).write_file: Automatic parent directory creation,Overwrite, and newline-awareAppendwhile preserving file mode bits.edit_file: EOL-normalized (LF/CRLF/ mixed) exact replacement across occurrences with LCS(+A/-R lines)diff summaries and per-file write locks.run_command: Real80×24PTY execution (zsh -c), inheriting your realHOME(~/.ssh,~/.gitconfig), ANSI stripping, and 10 KiB head/tail truncation with full output saved on disk.manage_task:list,status,send_input(interactive PTY stdin), and orphan-free process-group + descendantSIGKILL(kill).
- 5 High-Throughput Batch Tools (powered by INK-Q/agy-fast)
batch_search: Packs up to 20 parallel literal, regex, glob, fuzzy path, and read-onlygitqueries into one call with an 8.8 KiB UTF-8 inline cap and spill-to-disk overflow.quick_outline&read_slices: Fast symbol/section line-range outlines across up to 40 files (TS/JS/HTML/Vue/Svelte/CSS/Py/GDScript/Go/Rust/Java/MD/JSON/YAML) plus targeted multi-range line reads.apply_edits: Atomic multi-file, multi-hunk edits with serialized commits, indentation/fuzzy mismatch hints, rollback protection,dryRun/bestEffort, and an optional post-writeverifycommand (capped at 45s for Gemini Web).run_checks: Runs independent checks (typecheck, lint, tests) concurrently under a shared 45s budget with compact passing summaries and full failure logs.
- 45-Second Smart Hold (Bridging Gemini's 60s Ceiling)
- Non-daemon
run_commandcalls automatically hold on the server for up to 45s—commands under 45s finish in one round trip. - Commands exceeding 45s return a
TaskId; eachmanage_task(Action: "status")call holds up to another 45s until completion, preserving the real exit code and output.
- Non-daemon
- Built for Gemini Task Multi-Subagent Concurrency
- Issues soft
Mcp-Session-Idheaders oninitialize(1 Gemini Subagent ↔ 1 isolated task/notice queue), executes commands across subagents truly in parallel, and never404s stale sessions across local server restarts.
- Issues soft
- Code Mode (
execute/poll_execution/cancel_execution)- Run an async JavaScript snippet on your machine calling
tools.read_file,tools.edit_file,tools.run_commandin loops orPromise.all—collapsing 20+ operations into a single Gemini tool call.
- Run an async JavaScript snippet on your machine calling
- Automatic Local Skills Injection
- Scans
~/.agents/skills,~/.claude/skills,~/.codex/skills, and~/.gemini-workspace/skills(SKILL.md) into MCPinstructions(injected directly into Gemini Web's system prompt).
- Scans
- OAuth 2.1 +
/web/Activity Dashboard- Single-owner password approval page, SHA-256 hashed SQLite token store with a 300-second refresh-token rotation grace window, built-in Gemini Schema sanitizer, and a zero-build
/web/UI to inspect every subagent session and tool call.
- Single-owner password approval page, SHA-256 hashed SQLite token store with a 300-second refresh-token rotation grace window, built-in Gemini Schema sanitizer, and a zero-build
Architecture
flowchart LR
subgraph Gemini Web / Gemini Task
SA1["Main Agent / Subagent A\n(Mcp-Session-Id: S1)"]
SA2["Subagent B\n(Mcp-Session-Id: S2)"]
end
Tunnel["HTTPS Tunnel\n(Tailscale Funnel / Cloudflare)"]
subgraph Gemini Workspace (Local Mac / Linux)
Auth["OAuth 2.1 + 300s Refresh Grace\n+ Gemini Schema Sanitizer"]
Router["Soft Session Router\n(S1 / S2 Isolated Queues)"]
Engine["Deterministic AGY Engine\n(80x24 PTY · 45s Hold · Multimodal FS)"]
CM["Code Mode VM\n(execute / poll / cancel)"]
Web["/web/ Activity UI"]
end
SA1 & SA2 -- "HTTPS POST /mcp" --> Tunnel --> Auth --> Router
Router --> Engine & CM
Router -. "SQLite audit" .-> Web
5-Minute Quickstart
1. Prerequisites
- Node.js
>= 22.19(uses built-innode:sqlite) andpnpm - macOS or Linux
- An HTTPS tunnel pointing to your local port
7676(e.g., Tailscale Funnel or Cloudflare Tunnel)
2. Clone & Build
git clone https://github.com/cunninghamcard-bit/gemini-workspace.git
cd gemini-workspace
pnpm install
pnpm build
3. Initialize & Start Tunnel
# Expose local port 7676 over HTTPS (example using Tailscale Funnel):
tailscale funnel --bg 7676
# Initialize ~/.gemini-workspace/config.jsonc and generate your Owner Password in ~/.gemini-workspace/auth.json:
./bin/gemini-workspace.js init --public-url https://your-machine.your-tailnet.ts.net
# Verify everything is ready:
./bin/gemini-workspace.js doctor
# Start the server:
./bin/gemini-workspace.js serve
Tip: Your generated Owner Password is saved in
~/.gemini-workspace/auth.json(ownerToken). You will enter it once when authorizing Gemini Web or signing intohttps://<your-host>/web/.
4. Connect to Google Gemini Web
- Open gemini.google.com/customize/connectors → click + Custom.
- Enter your MCP Server URL:
(Leave Client ID / Secret blank — Gemini Workspace supports dynamic OAuth client registration.)https://your-machine.your-tailnet.ts.net/mcp - Approve the connection using your Owner Password from
~/.gemini-workspace/auth.json. - Open a chat (or Gemini Task) and start coding directly against your local repositories!
⚠️ Important Google Connector Caveat: Google binds custom connectors by hostname (
*.your-tailnet.ts.net). Do not register a second test connector on the same hostname (even on a different port like:8443), or Google will overwrite/revoke the shared OAuth account link. Always use a separate hostname (e.g.,*.trycloudflare.com) if testing another MCP server alongside production.
Local stdio usage (Gemini desktop app)
Web Gemini uses a remote connector over HTTPS + OAuth. The Gemini desktop app's "Local MCP" is a different mechanism: it spawns a command and speaks JSON-RPC over stdin/stdout. This repository ships a stdio entry for exactly that — no public tunnel, no OAuth.
- Gemini desktop app → Settings → Set up custom connected app → Local MCP
- Command (absolute paths required):
/absolute/path/to/node /absolute/path/to/gemini-workspace/bin/mcp-stdio.js - Click Next.
In a source checkout you can also run pnpm start:stdio. The tool set matches HTTP mode: read_file, write_file, edit_file, run_command, manage_task, the batch tools (batch_search, apply_edits, read_slices, quick_outline, run_checks), plus execute / poll_execution / cancel_execution when Code Mode is enabled.
stdout is the protocol channel. Any non-JSON-RPC output on stdout breaks the client's parser, so this entry redirects
console.log/info/debugto stderr and does not start the/web/audit panel. Configuration is still loaded from~/.gemini-workspace/config.jsonc.
Running as a Background Service (launchd on macOS)
Create ~/Library/LaunchAgents/dev.gemini-workspace.server.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>dev.gemini-workspace.server</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/node</string>
<string>--import</string>
<string>/ABSOLUTE/PATH/TO/gemini-workspace/bin/silence-sqlite-warning.js</string>
<string>/ABSOLUTE/PATH/TO/gemini-workspace/dist/cli.js</string>
<string>serve</string>
</array>
<key>WorkingDirectory</key><string>/ABSOLUTE/PATH/TO/gemini-workspace</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key><string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
<key>HOME</key><string>/Users/YOUR_USERNAME</string>
</dict>
<key>RunAtLoad</key><true/>
<key>KeepAlive</key><true/>
<key>StandardOutPath</key><string>/Users/YOUR_USERNAME/.devspace/logs/gemini-workspace.out.log</string>
<key>StandardErrorPath</key><string>/Users/YOUR_USERNAME/.devspace/logs/gemini-workspace.err.log</string>
</dict>
</plist>
Load it:
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/dev.gemini-workspace.server.plist
Configuration (~/.gemini-workspace/config.jsonc)
{
"configVersion": 1,
"server": {
"host": "127.0.0.1",
"port": 7676,
"publicBaseUrl": "https://your-machine.your-tailnet.ts.net"
},
"agy": {
"workspace": "~",
"holdMs": 45000,
"exposedTools": ["read_file", "write_file", "edit_file", "run_command", "manage_task"]
},
"codeMode": {
"enabled": true
},
"skills": {
"enabled": true,
"paths": []
},
"ui": {
"enabled": true
},
"activity": {
"enabled": true,
"maxCalls": 500
},
"oauth": {
"refreshTokenGraceSeconds": 300
}
}
CLI Reference
gemini-workspace serve # Start OAuth + MCP + /web/ server
gemini-workspace doctor # Verify config, OAuth DB, discovered skills & tools
gemini-workspace init --public-url <https> # Initialize config.jsonc and Owner Password
gemini-workspace config show # Print resolved configuration
gemini-workspace config set codeMode.enabled false
Acknowledgements & License
- Originally forked from @waishnav/devspace for its clean OAuth 2.1 SQLite foundation, then stripped of ~79k lines of legacy surfaces and rebuilt around a pure Node.js deterministic Antigravity tool engine tailored for Google Gemini Web.
- Batch coding tools (
batch_search,apply_edits,read_slices,quick_outline,run_checks) are vendored and adapted from INK-Q/agy-fast (MIT License, tuned with a 45s RPC budget for Gemini Web and synced viascripts/sync-agy-fast.sh).
Licensed under the MIT License.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found