Provides read-only access to PostgreSQL databases, enabling schema introspection and the execution of SELECT-only SQL queries to retrieve data from tables and views.
Allows for secure credential retrieval by supporting HashiCorp Vault commands to fetch database passwords during connection setup.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tusk-mcpshow me the schema of the users table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
tusk-mcp
Read-only PostgreSQL MCP server for AI agents. Exposes schema introspection and SELECT-only query execution over the Model Context Protocol.
Install
# npx (no install needed)
npx tusk-mcp --host db.example.com --database mydb
# or clone + run
bun install
bun run src/index.ts --host localhost --database mydbSetup UI
Interactive browser-based setup that generates config for Claude Desktop, Claude Code, Cursor, Windsurf, and OpenAI Codex.
npx tusk-mcp setupBuild standalone binary
bun run build # Windows
bun run build:linux # Linux
bun run build:macos # macOS ARMConnection
Individual flags (recommended)
tusk-mcp --host db.example.com --port 5432 --user admin --password 'p@ss' --database mydbConnection string
tusk-mcp --connection-string "postgres://admin:p%40ss@db.example.com:5432/mydb"Unencoded special characters in passwords (@, #) are handled automatically.
Environment variables
PGHOST=db.example.com PGDATABASE=mydb tusk-mcpPriority: flags > --connection-string > DATABASE_URL > PG* env vars
Password security
# From file (Docker/K8s secrets)
tusk-mcp --host db --database mydb --password-file /run/secrets/db_pass
# From command (any secrets manager)
tusk-mcp --host db --database mydb --password-cmd 'vault kv get -field=password secret/db'
tusk-mcp --host db --database mydb --password-cmd 'op read op://vault/db/password'SSL
Providing any certificate file automatically enables SSL.
tusk-mcp --host db --database mydb --ssl-ca /path/to/ca.crt # CA verification
tusk-mcp --host db --database mydb \ # mutual TLS
--ssl-ca ca.crt --ssl-cert client.crt --ssl-key client.keySSH tunnel
tusk-mcp --host db-internal --database mydb \
--ssh-host bastion.example.com --ssh-user deploy --ssh-key ~/.ssh/id_rsaStructure-only mode
Disables execute-query tool. Agents can see schema but not run queries.
tusk-mcp --host db --database mydb --structure-onlyTools
Tool | Description |
| List non-system schemas |
| Tables and views with estimated row counts (partitions filtered out) |
| Columns, types, PKs, FKs, and enum values inline |
| Read-only SQL with limit (disabled in structure-only mode) |
MCP config
{
"mcpServers": {
"tusk": {
"command": "npx",
"args": ["-y", "tusk-mcp", "--host", "localhost", "--database", "mydb"]
}
}
}Claude Code
claude mcp add --transport stdio tusk -- npx -y tusk-mcp --host localhost --database mydbOpenAI Codex (~/.codex/config.toml)
[mcp_servers.tusk]
command = "npx"
args = ["-y", "tusk-mcp", "--host", "localhost", "--database", "mydb"]All flags
Flag | Type | Default | Description |
| string | localhost | PostgreSQL host |
| number | 5432 | PostgreSQL port |
| string | — | Database user |
| string | — | Database password |
| string | — | Read password from file |
| string | — | Run command for password |
| string | — | Database name |
| string | — | Full connection URL |
| string | — | CA certificate path (enables SSL) |
| string | — | Client certificate path (enables SSL) |
| string | — | Client key path (enables SSL) |
| string | — | SSH tunnel host |
| number | 22 | SSH tunnel port |
| string | — | SSH username |
| string | — | SSH private key path |
| string | — | SSH password |
| boolean | false | Disable execute-query |
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.