opsgates-agent
Provides telephony integration through the asterisk_cli tool, allowing AI agents to interact with an Asterisk telephony server via its CLI.
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 |
|
Commands |
|
Services & logs |
|
Database |
|
Telephony |
|
Account |
|
Quick start
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_...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.
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 commandsUsage 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 |
| MCP server (FastMCP, Streamable HTTP) |
| Built-in OAuth 2.1 authorization server |
| Static bearer tokens (SHA-256 only) |
| Path confinement, secret redaction, rate limit, the decorator every tool goes through |
| Usage metering (call counts only) |
| Local JSONL audit log |
| Files, commands, services/logs/Asterisk, read-only database |
| Management command (permissions, passwords, tokens, updates) |
| Installer, hardened systemd unit, uninstaller |
| Helpers used by the installer and the |
| Test suite |
Development
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt
pytest -qTested 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.pySecurity
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 toolsaccount_statusARead-onlyIdempotent
OpsGate plan and this month's tool-call usage (does not count as a call).
Inputs: no named parameters. Returns: result
asterisk_cliBRead-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_queryARead-onlyIdempotent
One SELECT/SHOW/DESCRIBE/EXPLAIN statement on the configured MySQL/MariaDB (read-only user).
Inputs: sql (required), max_rows. Returns: result
edit_fileADestructive
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_dirARead-onlyIdempotent
List an allowed directory (depth 1-4). Protected files are shown but marked [protected].
Inputs: path (required), depth. Returns: result
list_sessionsCRead-onlyIdempotent
Open process sessions.
Inputs: no named parameters. Returns: result
read_fileBRead-onlyIdempotent
Read an allowed text file in chunks (offset in lines). Secrets are shown as ***.
Inputs: path (required), offset, max_lines. Returns: result
read_sessionCRead-onlyIdempotent
New output of a session since the last read.
Inputs: session_id (required), wait. Returns: result
run_commandADestructive
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_filesBRead-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_reloadADestructive
Send HUP to a service's main process (graceful reload, e.g. gunicorn/nginx; requires confirm=true).
Inputs: name (required), confirm. Returns: result
service_restartADestructive
Restart a systemd service (requires confirm=true and the owner's sudo authorization).
Inputs: name (required), confirm. Returns: result
service_statusBRead-onlyIdempotent
Status of a systemd service (is-active + recent journal lines).
Inputs: name (required). Returns: result
start_sessionBDestructive
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_logBRead-onlyIdempotent
Last N lines of a log file under the allowed log folders (default /var/log).
Inputs: path (required), lines. Returns: result
write_fileADestructive
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
Scored across 18 tools
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.
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.
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.
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
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server — read-only log access for AI assistants. Debug your Linux server with AI, without giving the AI shell access.76MIT
- AlicenseNot gradedqualityCmaintenanceA self-hosted MCP server that gives AI agents controlled access to a machine: filesystem, shell, background processes, git, web fetching and persistent key-value memory.GPL 3.0
- AlicenseAqualityDmaintenanceA secure local MCP server that provides AI assistants controlled filesystem access and command execution with an interactive approval system for dangerous actions.178 npmMIT
- FlicenseNot gradedqualityBmaintenanceAn 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-