Skip to main content
Glama
  • Listens on a local port. Gemini on the web arrives through Tailscale Funnel, a Cloudflare tunnel, or your own HTTPS reverse proxy

  • Tool names and PascalCase arguments follow Antigravity / original agy (Path, CommandLine, Confirm)

  • HTTP serves Streamable MCP (/mcp) plus OAuth; a local subprocess can use stdio with no config

  • One HTTP process per machine. Destructive commands are refused until you Confirm. Sessions claim write paths

  • UI language defaults to English; switch to Chinese in the setup screen or with language=zh

Private repo: https://github.com/luckfu/gemini-hands. The sibling Node project gemini-space is read-only reference and is not modified.

Contents

Related MCP server: OneCode Core

Requirements

  • Python 3.13+

  • uv

  • Gemini on the web: an HTTPS hostname (Tailscale Funnel or Cloudflare is enough)

  • Tailscale mode: signed-in Tailscale app, Funnel and HTTPS certificates enabled in the admin console

  • Cloudflare mode: cloudflared on PATH (no Cloudflare account)

Install

git clone https://github.com/luckfu/gemini-hands.git
cd gemini-hands
uv sync

Then run uv run gemini-hands …. After you install the script, gemini-hands works on its own.

Five-minute start

uv run gemini-hands serve

If there is no config yet, the terminal UI opens. Pick how Gemini should reach this machine, set a workspace, Save and start.

Startup prints the MCP URL and the owner password. You can also ask later:

uv run gemini-hands url         # https://…/mcp for Gemini on the web
uv run gemini-hands password    # owner password; copied to the clipboard

Paste the URL into a custom Gemini connector. Leave Client ID / Secret empty. On the authorize page, paste the owner password.

Day to day:

uv run gemini-hands serve      # start
uv run gemini-hands stop       # stop
uv run gemini-hands setup      # edit config
uv run gemini-hands doctor     # check the tunnel

Language (English is the default):

uv run gemini-hands config set language=zh    # 中文
uv run gemini-hands config set language=en    # English

Connect Gemini on the web

sequenceDiagram
    participant You
    participant Hands as Gemini Hands
    participant Gemini as Gemini on the web
    You->>Hands: serve (Funnel or Cloudflare)
    Hands-->>You: https://host/mcp + owner password
    You->>Gemini: Custom connector URL, empty client id/secret
    Gemini->>Hands: OAuth register + authorize
    You->>Hands: paste owner password
    Hands-->>Gemini: code + tokens
    Gemini->>Hands: MCP tools
  1. The server must be running.

  2. Open gemini.google.com/customize/connectors → + Custom.

  3. MCP Server URL is the output of uv run gemini-hands url, for example:

    https://macbook-air.your-tailnet.ts.net/mcp
    https://xxxx.trycloudflare.com/mcp
  4. Leave Client ID and Client Secret empty. Dynamic client registration accepts Gemini’s six oauth-redirect*.googleusercontent.com callbacks.

  5. On the approve page, paste the owner password from the start log or uv run gemini-hands password. It lives in ~/.gemini-hands/auth.json as ownerToken. It is not your Google password.

  6. After it connects, ordinary chat and Gemini Task can call tools.

Google binds a connector by hostname. Do not hang a second test connector on the same host or you will get 401s. Use another hostname for parallel tests (for example *.ts.net vs *.trycloudflare.com).

A trycloudflare hostname changes every start; update the connector. A Tailscale Funnel hostname usually follows the machine name and can stay.

Four connection modes

Gemini Hands always listens on this machine (public listens on 0.0.0.0). Remote modes forward HTTPS to that port. Default port 7676.

Mode

connect

Gemini on the web

Who opens the tunnel

This machine only

local

cannot connect

none. Use http://127.0.0.1:7676/mcp or stdio

Tailscale Funnel

tailscale

https://machine.ts.net/mcp

serve runs tailscale funnel --bg --yes <port>

Cloudflare tunnel

cloudflare

https://xxxx.trycloudflare.com/mcp

serve runs cloudflared for trycloudflare

Existing public HTTPS

public

your https://domain/mcp

your reverse proxy forwards 443

local

For clients on this computer. No OAuth. Use it for the Gemini app, debugging, or stdio.

tailscale

  1. Install and sign in to Tailscale (downloads).

  2. In admin DNS turn on HTTPS certificates and Funnel.

  3. gemini-hands config set connect=tailscale then serve. Leave the URL empty; Funnel is enabled on start. If tailscale is missing, serve prints install notes and exits.

  4. The hostname is usually https://<machine>.<tailnet>.ts.net and stays stable.

cloudflare

  1. Install cloudflared and keep it on PATH (downloads).

  2. Choose Cloudflare and leave the HTTPS URL empty.

  3. On start, cloudflared opens a *.trycloudflare.com tunnel. No Cloudflare account. If the binary is missing, serve prints install notes and exits — it will not install it for you.

  4. Gemini on the web must use the hostname printed this start.

  5. If you already have a named host, put https://space.your.domain in config and the server will not open trycloudflare.

public

Nginx / Caddy / a cloud load balancer already terminates TLS. Gemini Hands listens on 0.0.0.0:<port>. Config holds the HTTPS origin that already opens in a browser, without /mcp.

Tailscale and cloudflared

Only Gemini on the web needs a tunnel. stdio / connect=local do not.

Tailscale

OS

Typical install

macOS

App from the site, or brew install --cask tailscale

Windows

Installer, or winget install Tailscale.Tailscale

Linux

Distro package from the site, or curl -fsSL https://tailscale.com/install.sh | sh

cloudflared

OS

Typical install

macOS

brew install cloudflared

Windows

winget install Cloudflare.cloudflared, or the .msi

Debian / Ubuntu

Cloudflare apt repo, or a .deb from GitHub Releases

Other Linux

Matching binary from GitHub Releases, on PATH

Do not assume every machine has brew. cloudflared --version and tailscale status should work in a terminal.

Commands

gemini-hands                 Open the UI. Create config if missing; start or edit if it exists
gemini-hands setup           Jump straight to the edit form
gemini-hands config          Show current config (same as config show)
gemini-hands config show
gemini-hands config path     Print ~/.gemini-hands/config.json
gemini-hands config set …    Change fields without rewriting everything
gemini-hands password        Print the owner password and copy it
gemini-hands url             Print the MCP URL for Gemini on the web
gemini-hands serve           Start HTTP. Opens the UI if config is missing
gemini-hands serve --setup   Edit config, then start
gemini-hands serve --stdio   Same as stdio
gemini-hands stop            Stop the running HTTP server
gemini-hands doctor          Check mode, URL, and tunnel
gemini-hands status          Same as doctor
gemini-hands stdio           Local subprocess; no config required
gemini-hands init            Write a full config from flags (needs --connect)
gemini-hands setup
gemini-hands config set workspace ~/Documents/gemini-hands
gemini-hands config set connect=cloudflare
gemini-hands config set connect=tailscale
gemini-hands config set port=7676
gemini-hands config set public-url=https://space.example.com
gemini-hands config set workspace=~/project connect=local
gemini-hands config set language=zh

Keys for config set: connect, port, workspace, public-url, listen-host, hold-ms, language. Switching connect clears the old public URL so Tailscale / Cloudflare can request a new one.

A running server does not pick up new config by itself:

gemini-hands stop
gemini-hands serve

One-shot write (replaces the whole file, does not merge):

gemini-hands init --connect cloudflare --port 7676 --workspace ~
gemini-hands init --connect public --public-url https://space.example.com --port 7676

Configuration

Files live in ~/.gemini-hands/ (GEMINI_HANDS_HOME overrides). If only ~/.gemini-space exists, the first start renames it.

File

Contents

config.json

Mode, port, workspace, public URL, language

auth.json

Owner password ownerToken

http.json

Running HTTP process (written on start, removed on exit)

cloudflared.log

trycloudflare log

tailscale.log

Funnel log

Field

Meaning

Default

connect

local / tailscale / cloudflare / public

required

listenPort

Local port

7676

listenHost

Usually omit. public defaults to 0.0.0.0, others 127.0.0.1

null

publicBaseUrl

HTTPS origin, no /mcp. Tailscale / Cloudflare may be empty

null

workspace

Starting directory for run_command

home

holdMs

How long to wait before returning a task id

45000 (500–55000)

language

zh or en for UI and terminal copy

en

The setup screen (gemini-hands / setup) can change mode, port, workspace, a fixed HTTPS origin, and 中文 / English. The home screen shows the owner password. serve prints it every start.

Tools

Arguments are PascalCase. Paths must be absolute. There is no separate “open workspace” step.

Tool

What it does

read_file

Read text. At most 800 lines or 46080 bytes per call; over 100MB or binary is not inlined

write_file

Create or overwrite. Existing files need Overwrite or Append

edit_file

Replace every Target with Replacement; whitespace must match

list_dir

List a directory

grep_search

Search file contents; regex and case-insensitive flags

find_by_name

Glob filenames, e.g. *.py

run_command

Run zsh in the workspace. Non-daemons wait; timeout returns a task id

manage_task

list / status / send_input / kill background commands

execute

Code Mode: async Python calling await tools.read_file({"Path": "…"})

poll_execution

Wait on a running execute

cancel_execution

Cancel execute

server_info

Current mode and MCP URLs; does not read files

Common run_command fields: CommandLine, toolSummary, WaitMsBeforeAsync, IsDaemon, Confirm.

No web search, browser, cron, or sub-agent swarm. Those are out of scope.

Behavior

Workspace. run_command starts in workspace (home by default). File tools still take absolute paths and may point outside that folder.

Waiting. Non-daemon commands wait on the server up to holdMs (45s default). After that you get a task id; poll with manage_task + Action=status + TaskId.

Session isolation. A Gemini session that wrote a path claims it. Another session cannot write that path or a child of it.

Destructive commands. rm -rf aimed at /, ~, *, plus mkfs / shutdown / reboot / dd and similar, are refused. After you agree in the chat, retry the same command with Confirm: true.

Code Mode. Use execute to touch many files from one async Python snippet calling tools.*. At most 64 tool calls, 6 concurrent.

OAuth. local and stdio do not require OAuth. Remote modes enable dynamic client registration for Gemini’s Google redirect hosts. The owner password is only for the approve page.

Local stdio

For the Gemini app or an editor as a subprocess. No port, no config required:

uv run gemini-hands stdio

Protocol on stdout, human logs on stderr. If a config exists, workspace and holdMs are reused.

Audit page and icon

After a remote start:

  • Audit: https://hostname/web/ (owner password first)

  • Icon: https://hostname/icon.png (also /icon.svg, /favicon.png)

MCP initialize sends title and icons. Gemini’s custom-app UI may still show a default glyph; the files are served.

Process and ports

Only one HTTP listener. A second serve prints the live pid and URLs and exits.

If the preferred port is taken by something else, the next 30 ports are tried and the config is updated (7676 is in use; using 7677 instead). If the occupant is this same Gemini Hands process, it will not start a second copy.

stop sends SIGTERM. A Cloudflare quick tunnel dies with the process. Tailscale Funnel is node config and may still point at the old port until the next serve.

Troubleshooting

Symptom

What to do

Gemini asks for Client ID / Secret

Dynamic registration failed. Check POST /register in the server log, that the process is up, and that the tunnel hostname is allowed

Authorize page: what to paste?

gemini-hands password, or the Owner password: line from serve

401 after approve

A second connector on the same hostname, or a trycloudflare host that already rotated

url is only http://127.0.0.1

Remote mode has not started, or the tunnel is still coming up

Tailscale Funnel failed

Installed and signed in? Funnel / HTTPS certs on? On PATH? See ~/.gemini-hands/tailscale.log

tailscale / cloudflared not found

That mode needs the binary. Install it, then serve again. Nothing is auto-installed

trycloudflare timed out

~/.gemini-hands/cloudflared.log; the network must reach Cloudflare

Config changed but behavior did not

gemini-hands stop && gemini-hands serve

Port in use

Use the port printed at start, or stop then start

Destructive command refused

Confirm in the chat, then retry with Confirm: true

uv run gemini-hands doctor
curl -sS http://127.0.0.1:7676/healthz
curl -sS "$(uv run gemini-hands url | sed 's|/mcp$||')/healthz"

Environment

Variable

Meaning

GEMINI_HANDS_HOME

Config directory, default ~/.gemini-hands

GEMINI_SPACE_HOME

Same (old name)

GEMINI_HANDS_LANG

zh or en, overrides language in config

Development

uv sync
uv run python -m unittest discover -s tests

Package gemini_hands, entry gemini-hands. HTTP uses the MCP Python SDK Streamable HTTP transport. The setup UI is Textual.

License

MIT

Available Tools

12 tools
cancel_executionB

Cancel a running execute snippet.

Inputs: execution_id (required). Returns: result

edit_fileA

Replace every exact occurrence of Target in a file. Target must match the file text, including whitespace.

Inputs: Path (required), Target (required), Replacement (required), ArtifactMetadata. Returns: result

executeA

Run an async Python snippet that can await tools.* to batch many local operations in one call.

Inputs: code (required), yield_time_ms. Returns: result

find_by_nameB

Find files or directories by name glob. Prefer this over find or ls.

Inputs: Path (required), Pattern (required). Returns: result

list_dirB

List one directory. Prefer this over a shell ls.

Inputs: Path (required). Returns: result

manage_taskB

List, wait on, write to, or kill a background command from this session.

Inputs: Action (required), Input, TaskId. Returns: result

poll_executionC

Wait for an execute snippet that was still running.

Inputs: execution_id (required), yield_time_ms. Returns: result

read_fileB

Read a text file. Each call returns at most 800 lines or 46080 bytes.

Inputs: Path (required), EndLine, StartLine, ByteOffset. Returns: result

run_commandA

Run a zsh command. The server waits for it to finish. A long command returns a task id for manage_task.

Inputs: CommandLine (required), toolSummary (required), WaitMsBeforeAsync (required), Confirm, +1 more. Returns: result

server_infoB

Report that this process speaks MCP over stdin and stdout.

Inputs: no named parameters. Returns: result

write_fileA

Create or replace a file. Parent directories are created. Set Overwrite or Append when the file exists.

Inputs: Path (required), Content (required), Append, Overwrite, +1 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 12 tools

    Disambiguation4/5

    File tools are cleanly separated by action (read/write/edit/list/grep/find), and search-based tools explicitly state which shell command they replace. The one fuzzy area is two parallel task-lifecycle sets: run_command+manage_task for shell processes versus execute+poll_execution+cancel_execution for Python snippets, which an agent could mix up despite the descriptions.

    Naming Consistency4/5

    Most tools follow a predictable verb_noun pattern (read_file, write_file, list_dir, grep_search, find_by_name, run_command, manage_task, cancel_execution). Two deviations stand out: bare verb 'execute' and noun-only 'server_info', which break the pattern without causing confusion.

    Tool Count5/5

    12 tools is squarely in the well-scoped range, and each one maps to a distinct capability: file I/O, directory listing, content/name search, shell execution, background task control, and Python batching. Nothing feels redundant or padded.

    Completeness4/5

    Core file operations (read, write, edit, list, search) plus command execution and async task control cover the agent's lifecycle well. There is no dedicated delete or move/rename file tool, but run_command provides a workaround, making it a minor gap.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Exposes a governed suite of 38 tools over one OAuth-gated MCP endpoint so web AI chat clients can read and edit files, run whitelisted shell commands, search, query Git/SQLite, drive browsers via DevTools, and manage background jobs on the local machine. Remote access runs through Tailscale Funnel while local tools connect straight to 127.0.0.1, keeping operations permission-scoped rather than granting unrestricted shell access.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Connects Gemini on the web to a user's own Windows PC, letting it read files, run commands, write to disk, and invoke local skills and other MCP plugins. It reaches the machine through a stable self-hosted Tailscale Funnel URL, with tools enabled and approved by the user.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Google Gemini Web and its parallel Task subagents to securely access a local machine through OAuth 2.1, exposing deterministic file, command, task-management, Code Mode, and Skills tools over MCP.
      5
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Gemini web chat to access and control a local PC's files, search, Git, shell commands, and background processes across macOS, Windows, and Linux through an OAuth-secured MCP connector.
      1
      MIT