# opsgate

> opsgate is an open-source MCP server for developer tools. Typed, policy-checked server operations for AI agents, with approvals and an audit log. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted, Linux
- **Website:** https://polymatx.dev/blog/posts/opsgate-ai-agents-without-a-shell/
- **Repository:** https://github.com/polymatx/opsgate
- **MCP Registry name:** io.github.polymatx/opsgate
- **Categories:** developer tools, cloud and infrastructure, security
- **Listing updated:** 2026-11-15

## About

The author's starting point was that most server-access tools for agents are a command string run over SSH with a denylist in front, and a denylist fails against rephrased or encoded input. Opsgate takes the opposite route: the agent never supplies a string to execute. It calls one of 25 typed tools such as `service_status`, `docker_logs`, `journal_tail` and `file_read`, and opsgate builds each command itself as an argv array.

On the local machine the argv goes straight to exec with no shell process at all. Over SSH, every element is single-quoted so a hostile service name stays one literal argument. Names are also limited to a conservative character set, and `file_grep` uses fixed-string matching rather than regex.

Every tool is classed as observe, mutate or shell and checked against the mode of the target host. In `operate` mode reads run freely, while writes such as `nginx_reload` ask a human first and show the exact command. Approved and refused calls are both written to a hash-chained audit log. With no config it starts read-only on the local machine, and `opsgate init` writes a starter config. It is written in Go.

## Features

- **Typed tools, no shell:** 25 named tools replace a free-form command string, so the agent only fills in typed arguments.
- **Argv-built commands:** Commands are assembled as argument arrays and single-quoted over SSH, so injected text stays one literal word.
- **Per-host modes:** Each tool is classed observe, mutate or shell and checked against the mode set for the host it targets.
- **Human approval prompts:** In operate mode, writes ask for approval and show the exact command before it runs.
- **Hash-chained audit log:** Approved calls and refusals are both recorded in a tamper-evident log.
- **Zero-config start:** Runs read-only on the local machine with no config file, defaulting to observe mode.

## Good for

- Ask an agent what is filling the disk or listening on a port without giving it a shell
- Diagnose nginx 502 errors from journal and container logs
- Reload a service after a config change with a human approving the exact command
- Keep a reviewable record of every action and refusal an agent made on a server
- Let a team try agent-assisted ops on a read-only host first

## Install

### Claude Code (Terminal)

```sh
claude mcp add opsgate -- docker run -i --rm ghcr.io/polymatx/opsgate:0.1.3
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "opsgate": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/polymatx/opsgate:0.1.3"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "opsgate": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/polymatx/opsgate:0.1.3"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "opsgate": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/polymatx/opsgate:0.1.3"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "opsgate": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/polymatx/opsgate:0.1.3"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "opsgate": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/polymatx/opsgate:0.1.3"
      ]
    }
  }
}
```

## Tools

- `service_status`: Check the status of a service by name
- `docker_logs`: Read logs for a container
- `journal_tail`: Tail the journal for a unit with since and priority filters
- `file_read`: Read a file at a path
- `nginx_test`: Validate the nginx configuration on a host
- `nginx_reload`: Reload nginx after approval
- `listening_ports`: List listening ports and owning processes
- `service_list`: List services by state
- `disk_usage`: Report disk usage
- `file_grep`: Search files with a literal fixed-string pattern
- `service_restart`: Restart a service, refused in observe mode

## FAQ

### Does the agent get a shell?

No. It calls typed tools and opsgate builds each command as an argv array, so there is no command string to fill in.

### What happens if I deny an approval?

Nothing runs and the agent is told the operator refused. The refusal is recorded in the audit log.

### Can I try it without configuring a server?

Yes. `opsgate serve` runs with no config, on the local machine, in read-only observe mode.

### How is it installed?

The README shows `go install github.com/polymatx/opsgate/cmd/opsgate@latest`, and the registry also lists an OCI image over stdio.

### Is opsgate free?

Yes. opsgate is open source, so you can use and self-host it for free.

### How do I add opsgate to Claude Code?

Run this command in your terminal: claude mcp add opsgate -- docker run -i --rm ghcr.io/polymatx/opsgate:0.1.3

### What are the best alternatives to opsgate?

The closest alternatives to opsgate are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/opsgate-2
