
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
database-mcp
Advanced tools
Model Context Protocol server for multi-database access (PostgreSQL, MySQL, SQLite, Snowflake) with comprehensive introspection and analysis tools
A Model Context Protocol (MCP) server that provides AI assistants with direct access to multiple database types. This server enables natural language interactions with PostgreSQL, MySQL, SQLite, and Snowflake databases through comprehensive introspection and analysis tools.
# Run directly with npx (no installation needed)
npx database-mcp init "postgresql://user:pass@host:port/db"
npx database-mcp status
# Install globally for repeated use
npm install -g database-mcp
database-mcp init "postgresql://user:pass@host:port/db"
database-mcp status
Restart Claude Desktop after setup.
✨ New: Use with NPX - no installation required! Just run npx database-mcp directly.
New in v1.2.4: Use the simple database-mcp init command for streamlined setup!
Added in v1.2.4:
database-mcp status - Check your current database configurationdatabase-mcp update - Update your database connection easily--setup and --configure (still work but show warnings)Prefer manual configuration? Use database-mcp --find-config to locate your Claude Desktop config file and get setup instructions.
Run directly with NPX (no installation needed):
npx database-mcp init "your-database-connection-string"
Check status:
npx database-mcp status
Restart Claude Desktop and you're ready!
Install globally:
npm install -g database-mcp
database-mcp init "your-database-connection-string"
Use from source:
git clone https://github.com/nitaiaharoni1/database-mcp.git
cd database-mcp
npm install
npm run build
npm run configure
Manual configuration: Use npx database-mcp --find-config to locate your Claude Desktop config file and add the server manually.
# Cloud providers (SSL automatically enabled)
postgresql://user:pass@host.amazonaws.com:5432/db
postgresql://user:pass@host.ondigitalocean.com:25060/db?sslmode=require
postgresql://user:pass@host.database.windows.net:5432/db
# Local PostgreSQL (SSL disabled)
postgresql://user:pass@localhost:5432/database
# Cloud MySQL
mysql://user:pass@host.amazonaws.com:3306/database
# Local MySQL
mysql://user:pass@localhost:3306/database
# Snowflake cloud data warehouse
snowflake://username:password@account.snowflakecomputing.com/database/schema?warehouse=COMPUTE_WH&role=ACCOUNTADMIN
# With specific region
snowflake://user:pass@account.us-east-1.snowflakecomputing.com/MYDB/PUBLIC?warehouse=ANALYTICS_WH&role=ANALYST
# Minimal configuration (uses defaults)
snowflake://user:pass@account/database
# Absolute path
/absolute/path/to/database.sqlite
# Relative path
./relative/path/to/database.db
# Memory database (for testing)
:memory:
The Database MCP server provides 13 powerful tools for database interaction:
query_database - Execute SELECT queries with formatted resultsexplain_query - Analyze query execution plans and performancelist_schemas - List all available schemas/databaseslist_tables - List tables and views with detailsdescribe_table - Get detailed table structure and column informationlist_indexes - List all indexes and their propertiesget_foreign_keys - Discover foreign key relationshipslist_functions - List stored procedures and functionsget_table_stats - Get table statistics (row counts, sizes)get_database_info - Get database version and configurationanalyze_column - Analyze column data distribution and statisticssearch_tables - Search for tables and columns by name patternsget_connection_info - Check connection status and database detailsThe database-mcp package provides several command-line tools for easy configuration:
database-mcp init [connection_string] - Interactive setup for Claude Desktop
database-mcp init "postgresql://user:pass@host:port/db"
database-mcp init # Uses DATABASE_URL environment variable
database-mcp status - Show current database configuration and connection status
database-mcp status
database-mcp update <connection_string> - Update database connection string
database-mcp update "mysql://user:pass@newhost:3306/db"
database-mcp --help/-h - Show help informationdatabase-mcp --version/-v - Show version informationdatabase-mcp --find-config - Show Claude Desktop config file locationdatabase-mcp --setup - Use database-mcp init insteaddatabase-mcp --configure - Use database-mcp init insteadThese deprecated commands still work but will show warning messages encouraging use of the new commands.
"What tables are in my database?"
"Show me the structure of the users table"
"What are the foreign key relationships in my database?"
"How many records are in each table?"
"Show me the column statistics for the orders table"
"What's the distribution of values in the status column?"
"Find all customers who placed orders in the last 30 days"
"Show me the execution plan for this query: SELECT * FROM users WHERE email = ?"
"What indexes exist on the products table?"
"Find all tables related to user management"
"What columns contain the word 'email'?"
"Show me all tables that reference the users table"
# Initial setup
database-mcp init "postgresql://user:pass@host:port/db"
# Check current configuration
database-mcp status
# Update to a different database
database-mcp update "mysql://user:pass@newhost:3306/newdb"
# Find config file location
database-mcp --find-config
DATABASE_URL - Your database connection string (required)NODE_TLS_REJECT_UNAUTHORIZED - Set to '0' to disable SSL verification for development (not recommended for production)require - Always use SSL (recommended for production)prefer - Use SSL if available, fall back to non-SSLdisable - Never use SSL (local development only)export DATABASE_URL="postgresql://user:pass@host:5432/db?sslmode=require"
The Database MCP server includes comprehensive testing:
# Run all tests
npm test
# Run only unit tests (recommended for CI)
npm run test:unit
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode (development)
npm run test:watch
# Test CLI functionality
npm run test:cli
Test Coverage:
Clone the repository:
git clone https://github.com/nitaiaharoni1/database-mcp.git
cd database-mcp
Install dependencies:
npm install
This will automatically set up pre-commit hooks via Husky to ensure code quality.
Configure your database connection:
cp .env.example .env
# Edit .env with your database credentials
Run tests:
npm test
Build the project:
npm run build
Test locally:
npm run dev
This project uses Husky to enforce code quality standards:
These hooks prevent broken code from being committed or pushed, maintaining high code quality standards for all contributors.
This project uses GitHub Actions for automated continuous integration and deployment:
.github/workflows/ci.yml)Triggers: Push to main/develop, Pull Requests
.github/workflows/release.yml)Triggers: GitHub Releases, Version Tags (v*)
.github/workflows/integration.yml)Triggers: Manual dispatch, Scheduled (daily)
.github/workflows/dependabot-auto-merge.yml)Triggers: Dependabot Pull Requests
NPM Token Setup:
# Create npm access token at https://www.npmjs.com/settings/tokens
# Add to GitHub Secrets as NPM_TOKEN
Optional Database Testing:
# Add to GitHub Secrets for integration testing
TEST_DATABASE_URL="postgresql://user:pass@host:port/db"
Dependabot Configuration:
.github/dependabot.ymlnitaiaharoni1Add these badges to monitor build status:


[](https://badge.fury.io/js/database-mcp)
[](https://codecov.io/gh/nitaiaharoni1/database-mcp)
Non-Commercial License - All rights reserved to Nitai Aharoni.
This software is available for:
Commercial use is prohibited without explicit permission. For commercial licensing inquiries, please contact: nitaiaharoni1@gmail.com
See the LICENSE file for complete terms and conditions.
Made with ❤️ for the AI and database community
FAQs
Model Context Protocol server for multi-database access (PostgreSQL, MySQL, SQLite, Snowflake) with comprehensive introspection and analysis tools
The npm package database-mcp receives a total of 23 weekly downloads. As such, database-mcp popularity was classified as not popular.
We found that database-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.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.