DB MCP Server
Allows retrieving database credentials from AWS Secrets Manager to securely connect to databases.
Provides tools for executing SQL queries, exploring schemas, and managing data in MySQL databases.
Provides tools for executing SQL queries, exploring schemas, and managing data in PostgreSQL databases.
Click on "Deploy 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., "@DB MCP Server show me the columns in the orders 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.
DB MCP Server
A Model Context Protocol (MCP) server for database operations. Execute queries, introspect schemas, and manage data for PostgreSQL and MySQL databases. Works with local databases, SSH tunnels, AWS RDS, RDS Proxy, and any compatible database.
Features
db_list_instances - List RDS database instances (requires AWS credentials)
db_test_connection - Test database connectivity and get version info
db_execute_query - Execute read-only SQL queries (SELECT, SHOW, DESCRIBE, EXPLAIN)
db_execute_write - Execute write queries (INSERT/UPDATE only, DELETE blocked)
db_get_schema - Get full database schema with tables, views, and columns
db_get_tables - List tables and views with filtering options
db_get_columns - Get column details for a specific table
db_sample_data - Get sample rows from a table
Related MCP server: MCP MySQL Server
Installation
Using npx (Recommended)
No installation required. Add directly to your config:
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"db": {
"command": "npx",
"args": ["-y", "github:nikhilchintawar/db-mcp"],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_NAME": "mydb",
"DB_USER": "postgres",
"DB_PASSWORD": "password",
"DB_ENGINE": "postgresql"
}
}
}
}Claude Code (~/.claude/settings.json):
{
"mcpServers": {
"db": {
"command": "npx",
"args": ["-y", "github:nikhilchintawar/db-mcp"],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_NAME": "mydb",
"DB_USER": "postgres",
"DB_PASSWORD": "password",
"DB_ENGINE": "postgresql"
}
}
}
}Manual Installation
# Clone the repository
git clone https://github.com/nikhilchintawar/db-mcp.git
cd db-mcp
# Install dependencies
npm install
# Build
npm run buildThen add to your config:
{
"mcpServers": {
"db": {
"command": "node",
"args": ["/absolute/path/to/db-mcp/build/index.js"],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_NAME": "mydb",
"DB_USER": "postgres",
"DB_PASSWORD": "password",
"DB_ENGINE": "postgresql"
}
}
}
}Configuration Examples
Local Database
{
"mcpServers": {
"db": {
"command": "npx",
"args": ["-y", "github:nikhilchintawar/db-mcp"],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_NAME": "mydb",
"DB_USER": "postgres",
"DB_PASSWORD": "password",
"DB_ENGINE": "postgresql",
"DB_SSL": "false"
}
}
}
}SSH Tunnel
First, establish your SSH tunnel:
ssh -L 5432:rds-endpoint.amazonaws.com:5432 bastion-hostThen configure:
{
"mcpServers": {
"db": {
"command": "npx",
"args": ["-y", "github:nikhilchintawar/db-mcp"],
"env": {
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_NAME": "mydb",
"DB_USER": "admin",
"DB_PASSWORD": "password",
"DB_ENGINE": "postgresql"
}
}
}
}AWS RDS / RDS Proxy
{
"mcpServers": {
"db": {
"command": "npx",
"args": ["-y", "github:nikhilchintawar/db-mcp"],
"env": {
"DB_HOST": "my-proxy.proxy-xxxx.us-east-1.rds.amazonaws.com",
"DB_PORT": "5432",
"DB_NAME": "mydb",
"DB_USER": "admin",
"DB_PASSWORD": "password",
"DB_ENGINE": "postgresql"
}
}
}
}AWS RDS with Temporary Credentials (Read Replica)
{
"mcpServers": {
"db": {
"command": "npx",
"args": ["-y", "github:nikhilchintawar/db-mcp"],
"env": {
"AWS_REGION": "eu-west-1",
"AWS_ACCESS_KEY_ID": "your-access-key",
"AWS_SECRET_ACCESS_KEY": "your-secret-key",
"AWS_SESSION_TOKEN": "your-session-token",
"DB_HOST": "my-proxy-readonly.proxy-xxxx.eu-west-1.rds.amazonaws.com",
"DB_PORT": "5432",
"DB_NAME": "mydb",
"DB_USER": "admin",
"DB_PASSWORD": "password",
"DB_ENGINE": "postgresql",
"DB_IS_READ_REPLICA": "true",
"DB_WRITE_MODE": "disabled"
}
}
}
}AWS Secrets Manager
{
"mcpServers": {
"db": {
"command": "npx",
"args": ["-y", "github:nikhilchintawar/db-mcp"],
"env": {
"AWS_REGION": "us-east-1",
"AWS_PROFILE": "your-profile",
"DB_SECRET_ARN": "arn:aws:secretsmanager:us-east-1:123456789012:secret:mydb-AbCdEf"
}
}
}
}Configuration
Config File Locations
Claude Desktop (macOS):
~/Library/Application Support/Claude/claude_desktop_config.jsonClaude Desktop (Windows):
%APPDATA%\Claude\claude_desktop_config.jsonClaude Code:
~/.claude/settings.json
Environment Variables
Variable | Required | Description |
| Yes* | Database hostname |
| No | Database port (default: 5432 for PostgreSQL, 3306 for MySQL) |
| Yes* | Database name |
| Yes* | Database username |
| Yes* | Database password |
| Yes* |
|
| No | Enable SSL (default: true) |
| No | AWS Secrets Manager ARN (alternative to direct credentials) |
| No |
|
| No | Set to |
| No | Default query row limit (default: 1000) |
| No | Default query timeout in ms (default: 30000) |
*Required unless using DB_SECRET_ARN
AWS Configuration (Optional)
AWS credentials are only needed if using:
DB_SECRET_ARN(Secrets Manager)db_list_instancestool (RDS API)
Variable | Description |
| AWS region (required for AWS features) |
| AWS credentials profile |
| AWS access key |
| AWS secret key |
| Session token (for temporary credentials) |
Usage Examples
Once configured, you can use natural language to interact with your database:
"Show me the database schema"
"List all tables"
"Get sample data from the users table"
"Run a query to find all orders from last week"
"Insert a new record into the settings table"
"Show me the columns in the products table"
Available Tools
db_list_instances
List RDS database instances (requires AWS credentials).
Parameter | Required | Description |
| No | Filter by instance identifier |
| No | Filter by engine (postgres, mysql) |
db_test_connection
Test database connection and return status, latency, and version.
Parameter | Required | Description |
(none) | - | Uses configured connection |
db_execute_query
Execute read-only SQL queries.
Parameter | Required | Description |
| Yes | SELECT, SHOW, DESCRIBE, or EXPLAIN query |
| No | Max rows (default: 1000, max: 10000) |
| No | Query timeout in ms (default: 30000) |
db_execute_write
Execute write operations (INSERT/UPDATE only).
Parameter | Required | Description |
| Yes | INSERT or UPDATE query |
| No | Query timeout in ms (default: 30000) |
Note: DELETE, DROP, TRUNCATE, and ALTER are blocked. Fails gracefully on read replicas.
db_get_schema
Get full database schema including tables, views, and columns.
Parameter | Required | Description |
| No | Filter by schema (e.g., "public") |
db_get_tables
List tables and views.
Parameter | Required | Description |
| No | Filter by schema |
| No |
|
db_get_columns
Get column details for a specific table.
Parameter | Required | Description |
| Yes | Table name |
| No | Schema name |
db_sample_data
Get sample rows from a table.
Parameter | Required | Description |
| Yes | Table name |
| No | Schema name |
| No | Number of rows (default: 10, max: 100) |
Write Protection
The server includes multiple safety mechanisms:
Mode | Behavior |
| Blocks all write operations |
| Allows INSERT/UPDATE on any instance |
| Allows INSERT/UPDATE except on read replicas |
Always blocked: DELETE, DROP, TRUNCATE, ALTER, CREATE, GRANT, REVOKE
Read replica detection works via:
DB_IS_READ_REPLICA=trueenvironment variableAutomatic detection via RDS API (requires
DB_RDS_INSTANCE_IDENTIFIERand AWS credentials)
Development
# Watch mode for development
npm run dev
# Build for production
npm run build
# Test with MCP Inspector
npx @modelcontextprotocol/inspector node build/index.jsLicense
MIT
Available Tools
8 toolsdb_execute_queryA
Execute a read-only SQL query (SELECT, SHOW, DESCRIBE, EXPLAIN). Returns columns, rows, and execution metadata.
Inputs: sql (required), limit, timeout.
db_execute_writeB
Execute a write SQL query (INSERT or UPDATE only). DELETE is not allowed. Fails gracefully on read replicas.
Inputs: sql (required), timeout.
db_get_columnsA
Get column details for a specific table including data types, nullable flags, and key constraints.
Inputs: table (required), schemaName.
db_get_schemaA
Get the full database schema including all tables, views, and their columns with data types and constraints.
Inputs: schemaName.
db_get_tablesB
List all tables and views in the database. Can filter by schema name and object type.
Inputs: type, schemaName.
db_list_instancesA
List RDS database instances in the AWS account. Requires AWS credentials. Use this to discover available databases, their endpoints, and status.
Inputs: engine, identifier.
db_sample_dataA
Get sample rows from a table to understand its data structure and content.
Inputs: table (required), limit, schemaName.
db_test_connectionA
Test the database connection and return connection status, latency, and database version.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct operation: instance discovery, connectivity testing, read queries, write queries, and schema introspection. The schema-related tools (get_schema, get_tables, get_columns) have some overlap but their descriptions make the scope clear enough to avoid serious confusion.
Tool names consistently use a db_ prefix with snake_case and mostly follow a verb_noun pattern. The main deviation is db_sample_data, which lacks an explicit verb, and list vs get are used inconsistently (list_instances vs get_tables).
Eight tools is well-scoped for a database MCP server. Each tool serves a meaningful purpose without unnecessary redundancy or bloat.
The surface covers instance discovery, connection testing, schema inspection, data sampling, and both read and safe write operations. Minor gaps include lack of DELETE support, DDL/transactions, and explicit database selection tools, but these appear intentional or edge-case.
Maintenance
Related MCP Connectors
Query, explore, and manage your databases through natural conversation.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Work with your database from AI tools: ask, export, approved changes, and scheduled jobs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with PostgreSQL and Supabase databases through natural language. Supports secure database operations including queries, migrations, and schema management with user-provided credentials.41 npm1MIT
- AlicenseAqualityDmaintenanceEnables interaction with MySQL databases (including AWS RDS and cloud instances) through natural language. Supports database connections, query execution, schema inspection, and comprehensive database management operations.826 npm7MIT
- AlicenseAqualityDmaintenanceEnables querying and managing PostgreSQL and MySQL databases through natural language, supporting connection management, query execution, schema inspection, and parameterized queries with connection pooling.515 npm4MIT
- AlicenseAqualityCmaintenanceEnables interaction with MySQL databases (including AWS RDS and cloud instances) through natural language, supporting query execution, schema inspection, index management, and comprehensive database operations with secure SSL connections.82 npmMIT