# Postgres AIops MCP server

> Provides governed PostgreSQL DBA operations including slow-query root cause analysis, bloat analysis, and blocking lock-chain investigation.

- Repository: https://github.com/AIops-tools/Postgres-AIops
- Page: https://hostedmcp.org/servers/aiops-tools/postgres-aiops
- Transport: stdio
- Stars: 0
- License: MIT
- Latest version: 0.13.0

## Install

### Claude Code

```sh
claude mcp add postgres-aiops -- uvx postgres-aiops
```

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

```json
{
  "mcpServers": {
    "postgres-aiops": {
      "command": "uvx",
      "args": [
        "postgres-aiops"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "postgres-aiops": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "postgres-aiops"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"postgres-aiops","type":"stdio","command":"uvx","args":["postgres-aiops"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "postgres-aiops": {
      "command": "uvx",
      "args": [
        "postgres-aiops"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add postgres-aiops -- uvx postgres-aiops
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.postgres-aiops]
command = "uvx"
args = ["postgres-aiops"]
```

### Gemini CLI

```sh
gemini mcp add -s user postgres-aiops uvx -- postgres-aiops
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "postgres-aiops": {
      "command": "uvx",
      "args": [
        "postgres-aiops"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `POSTGRES_AIOPS_MASTER_PASSWORD` | no | no |  |

## FAQ

### How are database credentials stored?

Credentials are stored in an encrypted file at ~/.postgres-aiops/secrets.enc using Fernet and scrypt, ensuring they are never kept in plaintext on disk.

### Does the tool provide an audit log of all actions?

Yes, every call made via MCP or the CLI is recorded in a unified audit log located at ~/.postgres-aiops/audit.db.

### Is there a way to prevent runaway tool calls?

Yes, a built-in runaway guard acts as a circuit breaker if the same call is executed repeatedly in a tight loop.
