DataDan
Provides permission-gated tools for PostgreSQL databases, including listing databases, schemas, and tables; describing tables; running SELECT, INSERT/UPDATE, DELETE, and DDL statements according to granted permissions; and exporting schema structure as DBML.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
DataDan
A minimalist PostgreSQL MCP that gives Claude Code permission-bound access to your database.
Problem: AI agents are notorious for accidentally deleting databases because there is nothing declarative to prevent sessions from over-stepping or acting impulsively.
Solution: DataDan lets you grant scoped permissions to your database, schemas, and tables.
Quick Start
Add a .env with a PostgreSQL connection string to your project, then add DataDan to .mcp.json:
{
"mcpServers": {
"datadan": {
"command": "npx",
"args": ["-y", "datadan", "start"]
}
}
}That's it. On first run, DataDan auto-discovers your databases, creates datadan.config.yaml with read-only access, and starts the MCP server — all in one pass. Restart Claude Code and it has read access to your databases.
Related MCP server: PostgreSQL MCP Server
Use in Any Project
Option A: Per-project (default)
Add the .mcp.json entry above to each project directory. On first start, DataDan scans .env, creates datadan.config.yaml, and registers itself.
To re-initialize manually:
npx datadan initOption B: Global config, point from anywhere
Create one config file anywhere:
name: my-databases
default-permission: read
hot-reload: true
databases:
- name: production
connection_string: ${DATABASE_URL}
- name: analytics
connection_string: ${ANALYTICS_DB_URL}Then in any project's .mcp.json:
{
"mcpServers": {
"datadan": {
"command": "npx",
"args": ["datadan", "start", "--config", "/path/to/datadan.config.yaml"]
}
}
}Or set DATADAN_CONFIG env var to point to your config.
Option C: User-level MCP config
Add to ~/.claude/settings.json to make DataDan available in every project:
{
"mcpServers": {
"datadan": {
"command": "npx",
"args": ["datadan", "start", "--config", "/home/you/datadan.config.yaml"]
}
}
}Config
datadan.config.yaml controls what Claude can do:
name: my-project
default-permission: read
hot-reload: true
databases:
- name: main
connection_string: ${DATABASE_URL}
# permission: write # override default for this database
# schemas:
# - name: public
# permission: write # override for this schema
# tables:
# - name: users
# permission: none # block access to this tablePermissions
Permissions cascade: default-permission -> database -> schema -> table. The most specific override wins.
Level | What Claude Can Do |
| No access at all |
| SELECT, describe tables |
| read + INSERT, UPDATE |
| write + DELETE |
| delete + CREATE, ALTER, DROP, TRUNCATE |
Environment Variables
Connection strings support ${ENV_VAR} syntax. DataDan loads .env from the same directory as the config file. Shell/CI variables take precedence.
Hot Reload
With hot-reload: true, DataDan re-reads the config before each tool call. Change permissions mid-session without restarting.
Tools
Once connected, Claude Code gets these tools:
Tool | Permission | Description |
| any | List all accessible databases |
| any | List schemas in a database |
| any | List tables in a schema |
| read | Show columns, types, keys, and constraints |
| read | Run SELECT statements |
| write | Run INSERT / UPDATE statements |
| delete | Run DELETE statements |
| yolo | Run DDL (CREATE, ALTER, DROP, TRUNCATE) |
| read | Export database structure as a DBML file |
| - | Add a new database connection at runtime |
Dry Run
Preview resolved permissions without starting the server:
npx datadan start --dry-run Database | Schema | Table | Permission
----------+--------+----------+-----------
main | public | users | read
main | public | posts | write
main | public | secrets | noneSecurity
DataDan enforces permissions at the application layer — it parses every SQL statement, resolves table-level permissions from your config, and blocks statements that exceed the granted level. It also writes a CLAUDE.md instruction telling Claude Code to never connect to PostgreSQL directly.
This is not sufficient on its own. Claude Code has a Bash tool and can read your .env. A determined or mistaken model can bypass DataDan entirely by running psql $DATABASE_URL or writing a script that connects directly.
Use a restricted PostgreSQL user
The only enforcement that cannot be bypassed is PostgreSQL-level permissions. Your DATABASE_URL should point to a user with grants that match your DataDan config:
-- For read-only access
CREATE USER datadan_readonly WITH PASSWORD 'yourpassword';
GRANT CONNECT ON DATABASE yourdb TO datadan_readonly;
GRANT USAGE ON SCHEMA public TO datadan_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO datadan_readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO datadan_readonly;If DataDan's config is read, the DB user should only have SELECT. Even if a model bypasses DataDan and connects directly, it hits the same wall.
Keep the config outside the project directory
With hot-reload: true, DataDan re-reads datadan.config.yaml before each tool call. If the file is writable by Claude Code, a model could escalate its own permissions mid-session.
Move the config file outside the project and point to it via DATADAN_CONFIG:
# In your shell or CI env
export DATADAN_CONFIG=/etc/datadan/myproject.yamlOr use --config in your .mcp.json:
{
"mcpServers": {
"datadan": {
"command": "npx",
"args": ["datadan", "start", "--config", "/home/you/datadan.config.yaml"]
}
}
}Defense in depth
Layer | What it stops |
Restricted DB user | Direct bypass via Bash/psql/scripts |
DataDan permission gates | Accidental over-reach through MCP tools |
Config outside project dir | Mid-session self-escalation via hot-reload |
| Well-behaved models using wrong access path |
DataDan is most effective as the right-path guardrail on top of a least-privilege DB user — not as a standalone security boundary.
Schema Sync
DataDan auto-discovers new schemas and tables on startup and periodically during use. If you add a table to your database, it appears in the config automatically — inheriting the nearest permission level.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Deterministic safety, correctness & cost gate that vets Postgres SQL before your AI agent runs it.
PostgreSQL, MySQL, OpenAPI/Swagger, and shared Agent Memory with scoped access.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceProvides AI assistants with safe, controlled access to PostgreSQL databases with read-only defaults, granular permissions, query safety features, and schema introspection capabilities.1-
- FlicenseAqualityDmaintenanceEnables AI agents to inspect and query PostgreSQL databases safely, with features like listing tables, retrieving schemas, and running read-only SQL queries.3-
- AlicenseNot gradedqualityDmaintenanceEnables full read-write access to PostgreSQL databases with transaction management and safety controls, allowing LLMs to query and modify database content.19 npm3MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to safely interact with PostgreSQL databases, perform queries, inspect schemas, and analyze query performance.2ISC