Skip to main content
Glama
Gemini Remote Agent MCP

Gemini Remote Agent MCP

by lisycotana

English | 简体中文

Gemini Remote Agent MCP

A workspace-scoped remote development MCP server built for Gemini Custom Apps / MCP Connectors. It exposes 15 workspace tools (plus a dedicated /mcp/readonly endpoint) directly inside a target workspace over stateless Streamable HTTP, secured with OAuth 2.1 + PKCE, path sandboxing, secret redaction, and JSONL audit logging.

flowchart LR
    G[Gemini Web Custom App] -->|HTTPS + Bearer JWT| T[Tailscale Funnel / Cloudflare Tunnel]
    T -->|HTTP 127.0.0.1:8000| M[OAuthResourceMiddleware]
    M -->|Scope + Size + Header Checks| F[FastMCP Streamable HTTP]
    F -->|Read / Write / Git| W[Workspace Sandbox]
    F -->|Exec / BG Jobs| S[Sanitized Env + bwrap]

Features & Security Controls

  • Files: list_directory, find_files, grep_search (ripgrep), read_file (line-numbered), edit_file (SHA-256 optimistic lock + unified diff), write_file (atomic write).

  • Execution: run_command, start_bg_job, poll_bg_job, kill_bg_job with process-tree termination and concurrency limits.

  • Git: git_status_diff, git_restore (disabled by default, requires explicit confirmation).

  • Hardening:

    • Case-insensitive denied_globs, symlink/junction traversal blocking, Windows reserved device name & ADS checks, and ripgrep glob-override protection.

    • Child-process environment scrubbing (MCP_*, AWS_*, GITHUB_TOKEN, *SECRET*, *TOKEN*, etc.), command policy checks, and optional command allowlist (MCP_ALLOWED_COMMANDS).

    • OAuth 2.1 + PKCE (S256) resource server & optional self-hosted single-user provider with rate limiting, CSP-hardened consent UI, security headers, streaming body size limit, and rotating JSONL audit logs.

Related MCP server: Spark Terminal MCP

Quick Start

Local Development

cp .env.example .env
# Set MCP_WORKSPACE_ROOT, and for local testing set MCP_AUTH_ENABLED=false, MCP_SANDBOX_MODE=none
uv sync
uv run remote-agent-mcp --check
uv run remote-agent-mcp                      # Streamable HTTP (Gemini Web / remote)
uv run remote-agent-mcp --transport stdio    # Stdio (Gemini CLI / Claude Desktop / Cursor)
uv run remote-agent-mcp --print-client-config gemini-cli

Docker (Isolated Non-Root Container)

docker build -t gemini-remote-agent-mcp .
docker run --rm -p 127.0.0.1:8000:8000 \
  -v /path/to/project:/workspace \
  -e MCP_AUTH_ENABLED=true \
  -e MCP_OAUTH_ISSUER=https://YOUR_TENANT.us.auth0.com/ \
  -e MCP_OAUTH_AUDIENCE=https://mcp.example.com/mcp \
  -e MCP_ALLOWED_USER_SUBS=auth0|YOUR_SUBJECT \
  gemini-remote-agent-mcp

Verification

uv run ruff check .
uv run pytest
npx @modelcontextprotocol/inspector

Documentation

Available Tools

15 tools
edit_fileB

Replace exact text, optionally preview only. Existing files require expected_sha256.

Inputs: path (required), new_string (required), old_string (required), dry_run, +2 more. Returns: object

find_filesB
Read-only

Find files using a relative glob such as '**/*.py'; results stay inside the workspace.

Inputs: pattern (required), path, max_results. Returns: object

git_restoreA
DestructiveIdempotent

Discard tracked edits only. Untracked files are preserved. Disabled by default.

Inputs: paths, source_ref, restore_all, confirm_destructive. Returns: object

git_status_diffB
Read-only

Return branch/status and both diffs. Untracked files are listed, not dumped.

Inputs: include_diff, max_diff_chars. Returns: object

kill_bg_jobB
DestructiveIdempotent

Terminate a background job and its child process tree.

Inputs: job_id (required), signal_name. Returns: object

list_bg_jobsA
Read-only

List active and recently exited background jobs with status and PID.

Inputs: no named parameters. Returns: object

list_directoryB
Read-only

List directories recursively; omit ignored, sensitive, and symlinked entries.

Inputs: path, max_depth, max_entries. Returns: object

poll_bg_jobC
Read-only

Poll job status and incremental output. Use next_offset for the next request.

Inputs: job_id (required), max_bytes, offset_bytes. Returns: object

read_fileB
Read-only

Read UTF-8 lines (or tail_lines from EOF); pass returned sha256 to edit_file.

Inputs: path (required), end_line, start_line, tail_lines. Returns: object

read_multiple_filesB
Read-only

Batch-read up to 10 workspace UTF-8 files in one call to save round-trips.

Inputs: paths (required), max_lines_per_file. Returns: object

run_commandB
Destructive

Run a non-interactive shell command. OS isolation is required for untrusted callers.

Inputs: command (required), cwd, timeout_sec, max_output_chars. Returns: object

start_bg_jobB
Destructive

Start a non-interactive long-running job; poll with the returned job_id.

Inputs: command (required), cwd. Returns: object

workspace_infoA
Read-only

Return workspace path, OS/shell environment, and active safety flags.

Inputs: no named parameters. Returns: object

write_fileB
DestructiveIdempotent

Create a UTF-8 file or explicitly overwrite one with expected_sha256; returns a diff.

Inputs: path (required), content (required), dry_run, overwrite, +1 more. Returns: object

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 15 tools

    Disambiguation5/5

    Each tool targets a distinct action and resource: directory listing, glob-based file finding, content grep, single/batch reads, exact edits, overwrites, git status/diff, restore, shell execution, and background-job lifecycle. The read_file/read_multiple_files and edit_file/write_file pairs are clearly differentiated by batching and creation vs modification semantics.

    Naming Consistency4/5

    All names use consistent snake_case and are mostly action-oriented resource names such as list_directory, read_file, run_command, and kill_bg_job. Minor deviations are workspace_info and git_status_diff, which are noun-first rather than verb-first.

    Tool Count5/5

    With 15 tools, the server stays within a well-scoped range for a remote workspace agent. Each tool covers a necessary capability: filesystem reads/writes, search, git inspection/restore, command execution, and background-job management.

    Completeness4/5

    The surface covers core file operations, search, git status/diff/restore, shell commands, and background jobs. There are minor gaps such as no explicit delete/move/copy file tools and limited git operations, though run_command can work around many of these.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Gemini Spark to securely read, edit, and search a selected local workspace, execute shell commands, and integrate development tools via MCP with user approval safeguards.
      1
      MIT
    • A
      license
      C
      quality
      A
      maintenance
      Provides an MCP client with confined read/write access to one approved workspace, including file and directory CRUD, search, git, shell commands, Python tooling, data conversion, web fetch, HTTP testing, system diagnostics, and a todo list, under a security model with workspace confinement, secret redaction, audit logging, and optional read-only or command restrictions.
      68
      MIT