# tusk

> tusk is an open-source MCP server for databases. MCP server giving AI agents named, read-only Postgres access across local, stage and prod. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, Self-hosted
- **Repository:** https://github.com/volveezz/tusk-mcp
- **MCP Registry name:** io.github.volveezz/tusk-mcp
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-11-27

## About

Tusk connects an AI agent to several PostgreSQL databases at once, each registered as a named target such as local, stage or prod. Reads run inside READ ONLY transactions, so the database itself rejects writes that slip past the SQL check. Writes are off by default and must be enabled per target in a config file.

Databases behind a bastion host can be reached through the built-in SSH tunnel or through a proxy command such as ssh, docker exec or kubectl exec. Connections open lazily per target, so one unreachable host does not block the others. A compare-schemas tool diffs the structure of a schema between two targets.

The server suits developers and data engineers who want an agent to explore schemas and run queries against live environments with explicit guardrails. Passwords can come from files or secrets managers, and config files can reference environment variables so they are safe to commit.

## Features

- **Named multi-database targets:** Define local, stage, prod or unrelated databases in one config and address each by name.
- **Read-only query transactions:** Every query runs in a READ ONLY transaction enforced by Postgres, not just by SQL parsing.
- **Opt-in write access:** Writes are disabled unless a target sets write access in the config file, and go through a separate tool.
- **SSH and proxy connections:** Reach private databases via a built-in SSH tunnel or any stdio proxy command.
- **Schema comparison:** Diff the structure of a schema between two targets in a single call.
- **Secrets handling:** Read passwords from files or commands and interpolate environment variables in config.

## Good for

- Let an agent explore a production schema without any risk of modifying data
- Compare a staging schema against production before a migration
- Query a database reachable only through a bastion or container network from an AI client
- Run a single controlled write against a local development database during testing
- Share one committed config across a team with secrets pulled from the environment

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add tusk-mcp -- npx -y tusk-mcp
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

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

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add tusk-mcp -- npx -y tusk-mcp
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.tusk-mcp]
command = "npx"
args = ["-y", "tusk-mcp"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user tusk-mcp npx -- -y tusk-mcp

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

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

```json
{
  "mcpServers": {
    "tusk-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tusk-mcp"
      ]
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, 2 of 5 tools change data; 2 names don't say. From the server's own tool labels and tool names; not verified by us.

- `overview`: All schemas with tables, views, and estimated row counts
- `describe-tables` (name suggests: reads): Columns, types, keys, and enum values for tables
- `execute-query` (name suggests: changes): Read-only SQL with a row limit
- `execute-write` (name suggests: changes): One mutating statement with affected rows and RETURNING preview
- `compare-schemas`: Structural diff of a schema between two targets

## FAQ

### Can the agent write to my database by default?

No. Each target defaults to read access, and writes only work on targets set to write access in the config file.

### How are read-only queries enforced?

Each query runs inside a READ ONLY transaction, so Postgres refuses writes even if the SQL check misses them.

### How do I connect to a database behind a bastion?

Use the built-in SSH tunnel options or a proxy command such as ssh, docker exec or kubectl exec.

### How is tusk installed?

Run it with npx tusk-mcp using connection flags, or clone the repository and run it with Bun.

### Is tusk free?

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

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

Run this command in your terminal: claude mcp add tusk-mcp -- npx -y tusk-mcp

### What are the best alternatives to tusk?

The closest alternatives to tusk are PostgreSQL, Db Access MCP, PostgreSQL MCP Server, Db Conn MCP and PostgreSQL MCP Server.

## Where this comes from

- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [PostgreSQL](https://ai-powered.com/mcp/postgresql): PostgreSQL is an open-source MCP server for databases.
- [Db Access MCP](https://ai-powered.com/mcp/db-access-mcp): Db Access MCP is an open-source MCP server for databases.
- [PostgreSQL MCP Server](https://ai-powered.com/mcp/postgresql-mcp-server-4): PostgreSQL MCP Server is an open-source MCP server for databases.
- [Db Conn MCP](https://ai-powered.com/mcp/db-conn-mcp): Db Conn MCP is an MCP server for databases.
- [PostgreSQL MCP Server](https://ai-powered.com/mcp/postgresql-mcp-server-3): PostgreSQL MCP Server is an open-source MCP server for databases.
- [DB MCP Server](https://ai-powered.com/mcp/db-mcp-server): DB MCP Server is an open-source MCP server for databases.
- [Custom MCP Database](https://ai-powered.com/mcp/custom-mcp-database): Custom MCP Database is an open-source MCP server for databases.
- [Postgres Schema MCP](https://ai-powered.com/mcp/postgres-schema-mcp): Postgres Schema MCP is an open-source MCP server for databases.

---
Source: https://ai-powered.com/mcp/tusk
