Registry / database / database-mcp

database-mcp

JSON →
library1.3.2jsnpmunverified

A Model Context Protocol (MCP) server that provides AI assistants with direct access to PostgreSQL, MySQL, SQLite, and Snowflake databases. Version 1.3.2 (stable, active development) enables natural language interactions through comprehensive introspection and analysis tools. Key differentiators: multi-database support with a unified interface, automatic SSL/TLS handling for cloud databases, read-only safe query execution, and CLI tools for quick setup with Claude Desktop. Ships TypeScript types. Release cadence: frequent minor releases.

npm install database-mcp
INSTALL
IMPORT
SIG · DATABASE-MCP
D
database-mcp
databasejavascriptv1.3.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DatabaseMCPServer
import { DatabaseMCPServer } from 'database-mcp'
const DatabaseMCPServer = require('database-mcp')
ESM-only package. CommonJS require is not supported.
createServer
import { createServer } from 'database-mcp'
import createServer from 'database-mcp'
Named export, not default export.

Initializes the MCP server with a PostgreSQL connection string and verifies status using the CLI.

npx database-mcp init "postgresql://user:pass@localhost:5432/mydb" npx database-mcp status
Debug
Known issues
deprecatedThe --setup and --configure flags are deprecated in favor of the init command.
fix
Use `database-mcp init <connection-string>` instead.
affects: >=1.2.4
gotchaThe package is ESM-only and cannot be used with CommonJS require().
fix
Use ES module imports or dynamic import() in CommonJS projects.
affects: >=1.0.0
breakingVersion 1.2.0 changed the default export to a named export.
fix
Use `import { DatabaseMCPServer } from 'database-mcp'` instead of default import.
affects: >=1.2.0 <1.2.4
gotchaThe server runs read-only queries by default; write operations are blocked.
fix
No workaround; design is intentional for safety.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'database-mcp'
Package not installed or wrong import path.
fix
Run `npm install database-mcp` and ensure you are using ES module imports.
ERR_REQUIRE_ESM
Using CommonJS require() on an ESM-only package.
fix
Use dynamic import: `const DatabaseMCPServer = await import('database-mcp')`
database-mcp: --setup is deprecated, use init instead
Using deprecated CLI flags.
fix
Use `database-mcp init <connection-string>`
Upgrade
Version history
1.3.2latest on npm
Audit
Dependencies
@modelcontextprotocol/sdkrequiredMCP server framework dependency
pgoptionalPostgreSQL client driver
mysql2optionalMySQL client driver
better-sqlite3optionalSQLite client driver
snowflake-sdkoptionalSnowflake client driver
Agent activity
6 hits · last 30 days
node
6
Resources
database-mcp — npm install database-mcp · libregistry