Skip to main content
Glama

devgate

Local-first approval gate, command wrapper, and MCP bridge for AI coding agents over Telegram, Unix domain sockets, and SQLite.

Requirements

  • Linux (x64 or arm64)

  • Bun >= 1.2 (when building or running from source)

Related MCP server: Telegram Notifier MCP Server

Install

Download the devgate-linux-x64 or devgate-linux-arm64 binary from GitHub Releases and place it on your PATH (for example ~/.local/bin/devgate), or build from source:

bun install
bun x tsc --noEmit
bun test
bun build src/index.ts --compile --outfile dist/devgate

Place dist/devgate on your PATH (for example ~/.local/bin/devgate).

Setup

  1. Create a Telegram bot via @BotFather and note your numeric chat ID.

  2. Initialize configuration (~/.config/devgate/config.toml with mode 0600) and optionally generate a systemd user unit:

devgate init --systemd
  1. Start the local daemon:

devgate daemon start
devgate daemon status

If using systemd user services:

systemctl --user daemon-reload
systemctl --user enable --now devgate.service

CLI Usage

# Wrap a command and notify on completion (or failure only with --on-fail)
devgate run --on-fail -- bun test

# Require mobile approval before executing
devgate run --confirm --risk high --timeout 2m -- npx prisma migrate deploy

# Direct notification, approval gate, or question
devgate notify "Build finished" --level success
devgate approve "Deploy staging" --detail "git push origin staging" --risk medium --json
devgate ask "Database engine?" --options "SQLite,PostgreSQL" --json

# Audit trail
devgate history --limit 20
devgate history --status denied --json
devgate stats

Exit codes:

  • 0: success or approved/answered

  • 1: operational error, denied, or timed out

  • 2: invalid CLI arguments or config error

  • 126: devgate run --confirm cancelled because approval was denied or timed out

  • 130: cancelled via SIGINT

For devgate run, the original exit code of the wrapped child process is preserved.

Telegram Two-Way Commands

From the allowed Telegram chat, you can query status and trigger whitelisted preset commands configured under [commands] in ~/.config/devgate/config.toml:

[commands]
status = "git status -sb"
test = { cmd = "bun test", cwd = "/path/to/repo", timeout_sec = 120 }

Available bot commands in Telegram (registered automatically in the / command menu, with inline action buttons on /help, /list, and /status):

  • /status : daemon uptime, active pending requests, and SQLite stats

  • /history [n] : recent audit trail entries (default 10, max 30)

  • /list : list configured preset commands with tap-to-run buttons

  • /run <name> : execute a whitelisted preset command and return redacted output

  • /cancel <ID> : cancel a pending approval or ask request

  • /help : show command reference and quick menu

MCP Integration (IDE / Agent Configuration)

devgate mcp exposes three tools over JSON-RPC 2.0 stdio:

  • notify_user

  • request_approval

  • ask_user

Example MCP server configuration (Claude Code, Cursor, Windsurf, or compatible clients):

{
  "mcpServers": {
    "devgate": {
      "command": "/home/YOUR_USER/.local/bin/devgate",
      "args": ["mcp"]
    }
  }
}

If running directly from source without compiling a binary:

{
  "mcpServers": {
    "devgate": {
      "command": "bun",
      "args": ["/path/to/devgate/src/index.ts", "mcp"]
    }
  }
}

Security Model

  • Outbound payloads pass through a 3-layer redaction engine (src/security/redactor.ts): curated secret patterns, active workspace .env values, and context-aware Shannon entropy on sensitive assignments.

  • Approvals are fail-closed: timeouts, client disconnects (Ctrl+C), and daemon shutdowns resolve as TIMED_OUT, CANCELLED, or DENIED.

  • Daemon IPC listens only on a 0600 Unix domain socket (${XDG_RUNTIME_DIR:-/tmp}/devgate-${uid}.sock), never on TCP.

  • Telegram updates are restricted to the configured allowed_chat_id.

License

MIT. See LICENSE.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to operate a Telegram account through the same commands as the terminal client: messaging, chat management, voice transcription, calls, stickers, and privacy settings.
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to access and search Telegram conversations, including transcribed voice messages and OCR'd images, and to draft messages that require user approval before sending.
      15
      2
      MIT