
Company News
AWS Security Hub Adds Socket for Supply Chain Security
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.
database-admin-mcp
Advanced tools
MCP server for database administration - schema inspection, query optimization, data exploration, and migration helpers for PostgreSQL and MySQL
A Model Context Protocol (MCP) server for database administration. Provides AI assistants with tools for schema inspection, query optimization, data exploration, and migration helpers.
Supports PostgreSQL and MySQL.
npm install -g database-admin-mcp
Or use with npx:
npx database-admin-mcp
Add to claude_desktop_config.json:
{
"mcpServers": {
"database": {
"command": "npx",
"args": ["database-admin-mcp"],
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb"
}
}
}
}
Connection (choose one method):
Using connection string:
DATABASE_URL=postgresql://user:pass@localhost:5432/dbname
# or
DATABASE_URL=mysql://user:pass@localhost:3306/dbname
Using individual variables:
DB_TYPE=postgres # or mysql
DB_HOST=localhost
DB_PORT=5432 # 3306 for MySQL
DB_NAME=mydb
DB_USER=myuser
DB_PASSWORD=mypassword
DB_SSL=true # optional
Safety settings:
DB_READ_ONLY=true # Default: true (prevents INSERT/UPDATE/DELETE)
DB_MAX_ROWS=1000 # Default: 1000 (max rows returned per query)
| Tool | Description |
|---|---|
list_tables | List all tables with size and index count |
describe_table | Get columns, types, indexes, and foreign keys |
get_relationships | View all foreign key relationships as a graph |
get_connection_info | Show current connection settings |
| Tool | Description |
|---|---|
sample_data | Retrieve sample rows from a table |
execute_query | Run SQL queries (respects read-only mode) |
| Tool | Description |
|---|---|
analyze_indexes | Get index usage stats and suggestions |
explain_query | Get query execution plan with recommendations |
| Tool | Description |
|---|---|
generate_migration | Generate up/down SQL for schema changes |
"Show me all tables in the database"
"What columns does the users table have?"
"Show me 5 sample rows from the orders table"
"Are there any unused indexes on the products table?"
"Generate a migration to add an email column to the customers table"
"Why is this query slow: SELECT * FROM orders WHERE customer_id = 123"
Read-only by default: Write operations (INSERT, UPDATE, DELETE, DROP, etc.) are blocked unless DB_READ_ONLY=false
Row limits: Results are limited to DB_MAX_ROWS (default 1000) to prevent memory issues
Connection pooling: Efficient connection management with automatic cleanup
No credentials in output: Connection info tool hides passwords
pg_stat_user_indexes for index analysisinformation_schema for metadataSHOW TABLE STATUS for storage analysisMIT License - see LICENSE
FAQs
MCP server for database administration - schema inspection, query optimization, data exploration, and migration helpers for PostgreSQL and MySQL
The npm package database-admin-mcp receives a total of 18 weekly downloads. As such, database-admin-mcp popularity was classified as not popular.
We found that database-admin-mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.