-
Notifications
You must be signed in to change notification settings - Fork 1
Quick Start
Chris edited this page Jun 6, 2026
·
4 revisions
Get db-mcp running in under 5 minutes.
- Docker installed and running (for Docker method)
- Node.js 24+ LTS (for local installation)
Pull and run instantly:
docker pull writenotenow/db-mcp:latestRun with volume mount:
docker run -i --rm \
-v $(pwd):/workspace \
writenotenow/db-mcp:latest \
--sqlite-native /workspace/database.dbgit clone https://github.com/neverinfamous/db-mcp.git
cd db-mcp
pnpm install
pnpm run buildRun the server with Native backend (better-sqlite3 β full features):
node dist/cli.js --transport stdio --sqlite-native ./database.dbOr with WASM backend (sql.js β cross-platform, no compilation):
node dist/cli.js --transport stdio --sqlite ./database.dbpnpm install db-mcpAdd to your MCP configuration file (~/.cursor/mcp.json or equivalent):
{
"mcpServers": {
"db-mcp-sqlite": {
"command": "node",
"args": [
"/path/to/db-mcp/dist/cli.js",
"--transport",
"stdio",
"--sqlite-native",
"/path/to/your/database.db",
"--tool-filter",
"codemode"
]
}
}
}Note: Code Mode (
--tool-filter codemode) is the recommended default β a single tool providing access to all capabilities via a secure sandbox. See Tool Filtering for alternatives.
{
"mcpServers": {
"db-mcp-sqlite": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"./data:/app/data",
"writenotenow/db-mcp:latest",
"--sqlite-native",
"/app/data/database.db",
"--tool-filter",
"codemode"
]
}
}
}Docker Note: Volume-mount your database directory so the container can access it.
| Variant | Change |
|---|---|
| WASM backend | Replace --sqlite-native with --sqlite
|
| In-memory database | Replace the database path with :memory:
|
| Encryption at Rest | Add "--encryption-key" followed by your key (native only) |
| Starter preset | Replace "codemode" with "starter" for individual tool calls |
| CSV extension | Add "--csv" before "--tool-filter" (native only) |
| SpatiaLite | Add "--spatialite" and set SPATIALITE_PATH env var (native only) |
| Configuration File | Add "--config" followed by the path to your .yaml or .json file |
| Linux/macOS | Use forward-slash Unix paths |
| Feature | WASM (sql.js) | Native (better-sqlite3) |
|---|---|---|
| Transactions | β | β 8 tools |
| Window Functions | β | β 6 tools |
| SpatiaLite GIS | β | β 7 tools |
| FTS5 | β | β 5 tools |
| Cross-platform | β Pure JavaScript | Compiled natively |
| Performance | π High-performance |
Use --sqlite-native for production and full features. Use --sqlite for zero-dependency portability.
node dist/cli.js --transport stdio --sqlite-native :memory:Expected output:
[db-mcp] Starting MCP server...
[db-mcp] Registered adapter: Native SQLite Adapter (better-sqlite3) (sqlite:default)
[db-mcp] Server started successfully
Run the test suite:
pnpm run test- Tool Filtering β Configure tool presets for your IDE
- HTTP Transport β Remote access via Streamable HTTP or legacy SSE
- Code Mode β Enable 70β90% token reduction
- Extensions β Enable FTS5, SpatiaLite, and CSV extensions
- Tool Reference β Explore all tools by group