# Quarry MCP server

> Provides safety-railed database access for AI agents to PostgreSQL, MySQL, SQLite, and Redis with explicit query and write policies.

- Repository: https://github.com/Wangggym/quarry
- Page: https://hostedmcp.org/servers/wangggym/quarry
- Transport: stdio
- Stars: 5
- License: MIT
- Latest version: 0.2.2

## Install

### Claude Code

```sh
claude mcp add quarry -- uvx quarry-db
```

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

```json
{
  "mcpServers": {
    "quarry": {
      "command": "uvx",
      "args": [
        "quarry-db"
      ]
    }
  }
}
```

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

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

### VS Code CLI

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

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

```json
{
  "mcpServers": {
    "quarry": {
      "command": "uvx",
      "args": [
        "quarry-db"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add quarry -- uvx quarry-db
```

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

```toml
[mcp_servers.quarry]
command = "uvx"
args = ["quarry-db"]
```

### Gemini CLI

```sh
gemini mcp add -s user quarry uvx -- quarry-db
```

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

```json
{
  "mcpServers": {
    "quarry": {
      "command": "uvx",
      "args": [
        "quarry-db"
      ]
    }
  }
}
```

## Tools (6)

- `list_connections`: List all configured database connections, grouped into project folders and env-sets (same logical db across dev/prod/...). Start here to learn which `db` keys exist.
- `list_tables`: List tables of a database (or keys for a redis connection).
- `describe_table`: Column names, types and nullability for one table.
- `exec_sql`: Execute SQL (or a redis command) against a database and get a structured result {columns, rows, rowCount, truncated, elapsedMs}. READ-ONLY by default: writes/DDL fail with code 8 unless you pass write=true AND the server was started with --write; a prod env additionally requires confirm_prod=true. SELECTs without LIMIT get an automatic LIMIT (max_rows, default 500).
- `list_saved_queries`: List the workspace's saved named queries (name, target db, params).
- `run_saved_query`: Run a saved named query by name, with `params` as {name: value}.

## FAQ

### What databases does Quarry support?

Quarry supports PostgreSQL, MySQL, SQLite, Redis, and has experimental support for Neptune.

### Does the native executable require Python or Rust to run?

No, the native executable does not require a Python or Rust toolchain to function.

### How can I update Quarry?

You can run the command `qy update` to perform an immediate update.
