Skip to main content
Glama

OpsGates Agent

A secure, self-hosted MCP server that lets Claude, ChatGPT, Claude Code, Cursor, VS Code and Codex operate your Linux server — inside limits you set.

Your passwords, tokens, files and command output never leave your server. The agent runs as an unprivileged user in a hardened systemd sandbox, previews every change before making it, and keeps a local audit log of every call.

Website: https://opsgates.com · Docs: https://opsgates.com/docs

Why

Giving an AI assistant a shell on a production server is risky. OpsGates is built around the opposite default: the agent can read what an ordinary user can read, and nothing else unless you explicitly allow it.

  • Read-only by default. Writing files and restarting services are opt-in, per folder and per service.

  • Preview, then confirm. Every state-changing tool returns a preview first and only runs with confirm=true.

  • No shell by default. Commands run from an allow-list, without a shell; options that execute programs or write files are refused.

  • Secrets stay masked. Anything that looks like a secret is shown as ***; secret files cannot be read.

  • Tamper-resistant. The agent cannot modify its own code, configuration, state or logs.

  • Auditable. Every call is written to /var/log/opsgate/audit.jsonl.

  • OAuth 2.1 built in (PKCE, dynamic client registration, hashed tokens), plus optional TOTP two-factor sign-in.

Related MCP server: Combined MCP Server

Tools

Group

Tools

Files

list_dir, read_file, search_files, write_file, edit_file, backup_create

Commands

run_command, run_shell (opt-in), start_session, read_session, stop_session, list_sessions

Services & logs

service_status, service_restart, service_reload, tail_log

Database

db_query (read-only)

Telephony

asterisk_cli

Account

account_status

Quick start

  1. Create a free account at https://opsgates.com, add a server, and run the command it shows:

    curl -fsSL https://<your-opsgates-site>/install.sh | sudo bash -s -- --key og_...
  2. Add the connector URL printed by the installer to your assistant (for example Claude → Settings → Connectors → Add custom connector) and sign in with the password the installer printed.

  3. Manage it any time with sudo opsgate help.

Always read an installer before piping it to a shell. deploy/install.sh is in this repository.

Permissions

sudo opsgate allow-write /srv/app/config     # let the agent write in this folder
sudo opsgate allow-restart nginx             # let it restart this service (exact sudo rule)
sudo opsgate help                            # all management commands

Usage metering

meter.py sends only call counts to OpsGates Cloud, to apply your plan's monthly allowance. No commands, paths, file contents or output are ever sent. The source is in this repository.

Repository layout

Path

Purpose

server.py

MCP server (FastMCP, Streamable HTTP)

oauth.py

Built-in OAuth 2.1 authorization server

auth.py

Static bearer tokens (SHA-256 only)

security.py

Path confinement, secret redaction, rate limit, the decorator every tool goes through

meter.py

Usage metering (call counts only)

audit.py

Local JSONL audit log

tools/

Files, commands, services/logs/Asterisk, read-only database

bin/opsgate

Management command (permissions, passwords, tokens, updates)

deploy/

Installer, hardened systemd unit, uninstaller

scripts/

Helpers used by the installer and the opsgate command, and doctor.py

tests/

Test suite

Development

python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt
pytest -q

Tested with Python 3.12 and 3.13. Dependencies are pinned.

To list the tools without installing anything on a server (for example in an MCP inspector), run the stdio check, which uses throw-away state and read-only access:

python scripts/stdio_check.py

Security

Found a vulnerability? Please read SECURITY.md and report it privately.

Contributing

Bug reports, ideas and pull requests are welcome. See CONTRIBUTING.md.

License

GNU AGPL-3.0. You can use, study, modify and self-host the agent freely. If you offer a modified version to others as a service, you must publish your changes under the same license.

Need to embed OpsGates in a closed-source product or resell it? Commercial licenses and a partner / affiliate programme are available: see https://opsgates.com for contact details.

Available Tools

18 tools
account_statusA
Read-onlyIdempotent

OpsGate plan and this month's tool-call usage (does not count as a call).

Inputs: no named parameters. Returns: result

asterisk_cliB
Read-onlyIdempotent

Asterisk CLI command: read-only ones (pjsip show..., core show channels...) run directly; reloads (only if the owner enabled the Asterisk profile) need confirm=true. Only on servers with Asterisk.

Inputs: command (required), confirm. Returns: result

backup_createB

Timestamped copy of a file into the backups folder.

Inputs: path (required). Returns: result

db_queryA
Read-onlyIdempotent

One SELECT/SHOW/DESCRIBE/EXPLAIN statement on the configured MySQL/MariaDB (read-only user).

Inputs: sql (required), max_rows. Returns: result

edit_fileA
Destructive

Replace one unique snippet of a file. Without confirm=true it only returns the diff. Backs up first.

Inputs: new (required), old (required), path (required), confirm. Returns: result

list_dirA
Read-onlyIdempotent

List an allowed directory (depth 1-4). Protected files are shown but marked [protected].

Inputs: path (required), depth. Returns: result

list_sessionsC
Read-onlyIdempotent

Open process sessions.

Inputs: no named parameters. Returns: result

read_fileB
Read-onlyIdempotent

Read an allowed text file in chunks (offset in lines). Secrets are shown as ***.

Inputs: path (required), offset, max_lines. Returns: result

read_sessionC
Read-onlyIdempotent

New output of a session since the last read.

Inputs: session_id (required), wait. Returns: result

run_commandA
Destructive

Run an allow-listed command (no shell: | ; > * are not interpreted). Path arguments must be in allowed folders. Commands that change things (cp, mv, git pull...) require confirm=true.

Inputs: command (required), cwd, confirm, timeout. Returns: result

search_filesB
Read-onlyIdempotent

Search a regular expression in files under an allowed path (recursive, skips protected files).

Inputs: path (required), pattern (required), glob, max_results. Returns: result

service_reloadA
Destructive

Send HUP to a service's main process (graceful reload, e.g. gunicorn/nginx; requires confirm=true).

Inputs: name (required), confirm. Returns: result

service_restartA
Destructive

Restart a systemd service (requires confirm=true and the owner's sudo authorization).

Inputs: name (required), confirm. Returns: result

service_statusB
Read-onlyIdempotent

Status of a systemd service (is-active + recent journal lines).

Inputs: name (required). Returns: result

start_sessionB
Destructive

Start an allow-listed command in the background; read its output with read_session.

Inputs: command (required), cwd, confirm. Returns: result

stop_sessionC

Stop a session.

Inputs: session_id (required). Returns: result

tail_logB
Read-onlyIdempotent

Last N lines of a log file under the allowed log folders (default /var/log).

Inputs: path (required), lines. Returns: result

write_fileA
Destructive

Write a file in allowed paths. Without confirm=true it only returns the diff. Backs up first.

Inputs: path (required), content (required), confirm. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 18 tools

    Disambiguation4/5

    Most tools target distinct resources (files, logs, services, sessions, DB, Asterisk), and descriptions draw clear lines between the closest pairs (write_file=whole file vs edit_file=unique snippet; restart=full restart vs reload=HUP). The main soft overlap is service_restart/service_reload/service_status and run_command vs asterisk_cli, but the descriptions resolve these well enough that misselection is unlikely.

    Naming Consistency4/5

    Almost everything is snake_case and grouped by domain with recognizable prefixes (service_*, *_session, *_file). There is a minor stylistic split between verb_noun (list_dir, read_file, start_session) and resource_verb (service_restart, db_query, account_status), but the pattern stays readable and predictable per subsystem.

    Tool Count4/5

    18 tools sits at the heavier end but the breadth maps to genuinely different subsystems of a server-ops agent (filesystem, logs, systemd, DB, Asterisk, process sessions, account). Each tool appears to earn its place, so the count is slightly heavy but not padded.

    Completeness3/5

    Core read/write/edit/backup, service control, log tailing, read-only DB, and a full session lifecycle are covered, which is strong. However there are notable gaps for an ops domain: no directory creation, no file delete, and no service start/stop/enable (only restart and reload), so some lifecycle workflows dead-end.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      MCP server — read-only log access for AI assistants. Debug your Linux server with AI, without giving the AI shell access.
      7
      6
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A secure local MCP server that provides AI assistants controlled filesystem access and command execution with an interactive approval system for dangerous actions.
      17
      8 npm
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      An MCP server that gives web AI assistants like ChatGPT and Claude Chat hands-on control over a local development machine, enabling them to read, edit, and execute code through a safe, policy-checked interface.
      1
      -