# MCPg MCP server

> Lets AI agents safely inspect, query, operate, and tune PostgreSQL databases using 279 specialized tools.

- Repository: https://github.com/devopam/MCPg
- Page: https://hostedmcp.org/servers/devopam/mcpg
- Transport: stdio
- Stars: 14
- License: MIT
- Latest version: 0.8.4

## Install

### Claude Code

```sh
claude mcp add mcpg -- uvx mcpg
```

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

```json
{
  "mcpServers": {
    "mcpg": {
      "command": "uvx",
      "args": [
        "mcpg"
      ]
    }
  }
}
```

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

```json
{
  "servers": {
    "mcpg": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mcpg"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "mcpg": {
      "command": "uvx",
      "args": [
        "mcpg"
      ]
    }
  }
}
```

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

```toml
[mcp_servers.mcpg]
command = "uvx"
args = ["mcpg"]
```

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

```json
{
  "mcpServers": {
    "mcpg": {
      "command": "uvx",
      "args": [
        "mcpg"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `MCPG_DATABASE_URL` | no | no |  |
| `MCPG_HTTP_PORT` | no | no |  |
| `MCPG_TRANSPORT` | no | no |  |

## FAQ

### Is MCPg safe to use with production databases?

Yes, it is safe by default with read-only access mode and AST validation for every user-supplied SQL statement.

### Which PostgreSQL versions are supported?

The server supports PostgreSQL versions 14 through 19.
