tusk-mcp
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 mydbRelated MCP server: mcp-postgres
Setup 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
Multiple environments / databases
A config file defines named targets: environments (local/stage/prod) or entirely different databases within one app. tusk.config.jsonc or tusk.config.json in the working directory is picked up automatically when no connection flags are given; --config <path> (relative or absolute) loads an explicit file. Connection flags cannot be combined with a config file.
{
"defaultTarget": "local", // used when a tool call omits target
"defaults": { // merged under every target
"user": "app",
"database": "myapp"
},
"targets": {
"local": { "host": "localhost", "description": "dev" },
"stage": {
"host": "stage.db.internal",
"password": "${STAGE_DB_PASSWORD}", // env var interpolation
"ssl": true
},
"prod": {
"connectionString": "postgres://ro:${PROD_DB_PASSWORD}@10.0.0.5:5432/myapp",
"ssh": { "host": "bastion.example.com", "user": "deploy", "key": "~/.ssh/id_rsa" },
"structureOnly": true, // per-target: schema visible, queries disabled
"description": "production"
},
"analytics": { "host": "warehouse.db", "database": "events" }
}
}Target fields mirror the CLI flags: host, port, user, password, passwordFile, passwordCmd, database, connectionString, ssl (true or {ca, cert, key} paths), ssh ({host, port, user, key, password}), structureOnly, description.
Priority: explicit fields > connectionString > defaults. ssh/ssl objects deep-merge, so defaults.ssh can hold the shared bastion and a target override just the port. ${VAR} interpolates from the environment in any string, so the file is safe to commit. Config-file targets ignore PG* env vars; use ${PGPASSWORD} explicitly if wanted.
With multiple targets every tool takes a target enum parameter (optional when defaultTarget is set, absent entirely with a single target), the target list is announced via MCP instructions, and compare-schemas becomes available. Connections are lazy per target: an unreachable bastion never blocks startup or the other targets.
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
Agents see schema but cannot run queries. The --structure-only flag applies it to every target; per-target structureOnly in the config file keeps execute-query registered and rejects calls against that target only. When all targets are structure-only the tool is not registered at all.
tusk-mcp --host db --database mydb --structure-onlyTools
Tool | Description |
| All schemas with tables, views, and estimated row counts in one call (partitions filtered out) |
| Columns, types, PKs, FKs, and enum values for one or more tables per call |
| Read-only SQL with limit (rejected on structure-only targets) |
| Structural diff of a schema between two targets (multi-target only) |
Output format
Tool results use compact text in content for the AI model and JSON-safe
preview data in structuredContent for clients that support structured MCP
output. Query text uses a tab-delimited preview with null=\N; strings are
JSON-quoted, so empty strings render as "" and the literal string "\\N" is
distinct from SQL null. With multiple targets, results start with a
target=<name> line.
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 | - | Multi-target config file (see above) |
| 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 |
| boolean | false | Enable SSL without certificate verification |
| 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
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceAn MCP server that gives AI agents direct read-only access to PostgreSQL databases, enabling natural language analytics through tools for schema exploration, querying, trend analysis, and data quality checks.Last updated115MIT
- Alicense-qualityCmaintenanceRead-only PostgreSQL MCP server that enables running SELECT queries, listing tables and schemas, and describing columns, with built-in protection against writes and malicious SQL attacks.Last updated484MIT
- Flicense-qualityFmaintenanceA read-only MCP server that enables AI agents to explore database schemas and execute safe queries on PostgreSQL and MySQL.Last updated
- Alicense-qualityAmaintenanceA hardened, read-only Postgres MCP server that enables LLMs to safely query databases without write, DDL, shell, or credential exposure.Last updatedMIT
Related MCP Connectors
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Read-only MCP server for wafergraph.com's semiconductor & AI supply-chain data: 30 tools, no auth.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/volveezz/tusk-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server