@customable/db-mcp (2.0.0)
Installation
@customable:registry=npm install @customable/db-mcp@2.0.0"@customable/db-mcp": "2.0.0"About this package
🗄️ db-mcp
MCP Server for database access supporting PostgreSQL, MariaDB/MySQL, and SQLite.
Features
Query Execution
- 🔍
run_query- Execute SQL query - 📊
run_query_batch- Execute multiple queries - 🔐 Uses prepared statements for security
Schema Operations
- 📋
list_tables- List all tables - 🗂️
get_table_schema- Get table structure - 📊
get_table_info- Get table statistics (rows, size) - 🔍
describe_table- Detailed table information
Database Management
- 🗄️
list_databases- List all databases - 🔄
switch_database- Switch active database - 📊
get_database_size- Get database size
Advanced Features
- 📈
explain_query- Analyze query performance - 🔄 Schema diff (compare schemas)
- 📊 Query statistics
Supported Databases
- PostgreSQL 9.6+
- MySQL/MariaDB 5.7+
- SQLite 3.x
Installation
npm install
npm run build
Configuration
Set environment variables based on your database type:
PostgreSQL
export DB_TYPE=postgres
export DB_HOST=localhost
export DB_PORT=5432
export DB_USER=myuser
export DB_PASSWORD=mypassword
export DB_NAME=mydatabase
MySQL/MariaDB
export DB_TYPE=mysql
export DB_HOST=localhost
export DB_PORT=3306
export DB_USER=myuser
export DB_PASSWORD=mypassword
export DB_NAME=mydatabase
SQLite
export DB_TYPE=sqlite
export DB_PATH=/path/to/database.sqlite
Usage
npm start
What's New in v2.0.0
🎉 Major release with comprehensive improvements:
- 🏗️ Complete refactor - Modular architecture (205 lines → 102 lines, -50%)
- 🔒 SQL injection protection - Validation and prepared statements
- 🔒 100% type safety - Proper TypeScript throughout
- 📝 Complete JSDoc - All public APIs documented
- 📄 Pagination support -
limitandoffsetfor queries - 📦 Updated dependencies - MCP SDK 1.20.0 (latest)
See CHANGELOG.md for full details.
Security
⚠️ Important:
- Always use prepared statements (automatically done)
- SQL validation warns about dangerous patterns
- Never expose database credentials in logs
- Use read-only users when possible
- Limit query execution time
License
MIT
Dependencies
Dependencies
| ID | Version |
|---|---|
| better-sqlite3 | ^9.4.0 |
| mysql2 | ^3.9.0 |
| pg | ^8.11.0 |
| zod | ^3.23.8 |
Development dependencies
| ID | Version |
|---|---|
| @modelcontextprotocol/sdk | ^1.20.0 |
| @types/better-sqlite3 | ^7.6.9 |
| @types/node | ^22.0.0 |
| @types/pg | ^8.11.0 |
| @vitest/coverage-v8 | ^3.2.4 |
| typescript | ^5.5.0 |
| vitest | ^3.2.4 |
Keywords
mcp
database
postgresql
mysql
mariadb
sqlite
mcp-server
Details
2025-10-10 10:14:57 +02:00
Assets (1)
Versions (2)
View all
npm
1
Customable Team
MIT
latest
16 KiB
db-mcp-2.0.0.tgz
16 KiB