tusk
MCP server giving AI agents named, read-only Postgres access across local, stage and prod
tusk is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, API, Self-hosted
- Runs
- Locally
- What it can do
- Can change data (2 tools)
- Version
- 0.4.0
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add tusk-mcp -- npx -y tusk-mcpAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"tusk-mcp": {
"command": "npx",
"args": [
"-y",
"tusk-mcp"
]
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"tusk-mcp": {
"command": "npx",
"args": [
"-y",
"tusk-mcp"
]
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"tusk-mcp": {
"command": "npx",
"args": [
"-y",
"tusk-mcp"
]
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.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.
Add with the CLI
Run in a terminal
codex mcp add tusk-mcp -- npx -y tusk-mcpOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.tusk-mcp]
command = "npx"
args = ["-y", "tusk-mcp"]Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"tusk-mcp": {
"command": "npx",
"args": [
"-y",
"tusk-mcp"
]
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "tusk-mcp": { "command": "npx", "args": [ "-y", "tusk-mcp" ] } } }Or run: gemini mcp add -s user tusk-mcp npx -- -y tusk-mcp
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "tusk-mcp": { "command": "npx", "args": [ "-y", "tusk-mcp" ] } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.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
Add to cline_mcp_settings.json
{ "mcpServers": { "tusk-mcp": { "command": "npx", "args": [ "-y", "tusk-mcp" ] } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.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
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "tusk-mcp": { "command": "npx", "args": [ "-y", "tusk-mcp" ] } } }Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "tusk-mcp": { "command": "npx", "args": [ "-y", "tusk-mcp" ] } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "tusk-mcp": { "command": "npx", "args": [ "-y", "tusk-mcp" ] } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
About tusk
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.
Tools this server provides (5)
Taken from the project documentation; the running server may differ.
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-tablesName suggests: reads
- Columns, types, keys, and enum values for tables
- execute-queryName suggests: changes
- Read-only SQL with a row limit
- execute-writeName suggests: changes
- One mutating statement with affected rows and RETURNING preview
- compare-schemas
- Structural diff of a schema between two targets
What it does
- 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
Pricing
Open source
tusk 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.