Node.js-based Model Context Protocol server (v0.1.6) that provides AI systems with runtime database connections. Supports PostgreSQL and MySQL via connection pooling, schema introspection, parameterized query execution, and dynamic connection management. Acts as a bridge between MCP-enabled AI assistants (e.g., Claude) and relational databases. Key differentiators: on-the-fly configuration switching, health monitoring, config file imports/exports, and CLI interface. Requires Node >=18.0.0. Early stage with weekly releases, no breaking changes so far.
npm install mcp-database-serverVerified import paths — ran on the pinned version, not inferred.
Shows full setup: instantiate server with PostgreSQL config, start MCP server, dynamically add MySQL connection, then run parameterized query.
Use import syntax or dynamic import() in CommonJS files.
Upgrade Node to >=18.0.0.
Rename 'max' to 'poolSize' in connection configuration.
Replace server.getTables(conn) with server.getSchema(conn).
Use process.env.VAR for sensitive values; never commit .env files.
Call server.closeAllConnections() in process.on('exit', ...) or SIGTERM handler.Pin exact version and review changelog before upgrades.
Use import syntax (ESM) or dynamic import('mcp-database-server') in CommonJS files.Verify connection names are identical; check getConnections() for existing names.
Check network connectivity and hostname spelling; use IP address if needed.
Set poolSize to integer >= 1 (e.g., 5).