DevDb MCP Server for MySQL, Postgres, SQLite, MSSQL
Run an MCP server inside your IDE to connect and manage MySQL, Postgres, SQLite, and MSSQL databases.
npx -y @damms005/devdb-vscode?tab=readme-ov-file#mcp-configurationOverview
DevDb MCP Server is a lightweight server you can run inside your IDE to expose database connections (MySQL, PostgreSQL, SQLite, MSSQL) over the Model Context Protocol (MCP). By running an MCP server locally, editor extensions and other tools that speak MCP can discover databases, inspect schemas, and run queries in a consistent, programmatic way without embedding database drivers in every tool. This simplifies integrations between language models, editor automation, and your databases.
Typical uses include connecting a code-assist or LLM-enabled tool inside VS Code to a development database, enabling schema introspection for automated code generation, and running ad‑hoc queries or migrations from within the editor. The server keeps credentials and connection logic centralized while presenting a stable, protocol-driven API to clients.
Features
- Connect to MySQL, PostgreSQL, SQLite and Microsoft SQL Server (MSSQL)
- Expose one or more database connections over MCP for in-IDE tooling
- Schema introspection: tables, columns, relations, indexes
- Execute SQL queries and return structured results (rows, metadata)
- Transaction control (begin/commit/rollback) via protocol commands
- Export query results to CSV/JSON (via tooling clients)
- Simple configuration file to declare connections and server options
- Works locally inside development environments (IDE extensions, test harnesses)
Installation / Configuration
Prerequisites:
- Node.js (if running the server from source)
- A copy of the DevDb MCP server (from the repository)
- Relevant database client libraries available to the server (usually handled by the project)
Quick start (development):
# clone the repo
# install dependencies (run from the MCP server package folder if monorepo)
# build (if needed)
# start MCP server (example command — adjust to your project layout)
Example MCP configuration (mcp-config.json)
Place this file next to the server binary or point the server to it with a CLI flag:
Security notes:
- Keep credentials out of source control (use environment variables or a secrets manager where possible).
- The MCP server listens on local ports by default; restrict network access unless intentionally exposing to other hosts.
Available Tools / Resources
The MCP server itself is a protocol endpoint. Typical clients/tools that can consume MCP-provided database connections include:
- IDE extensions (e.g., DevDb VS Code extension) for in-editor schema browsing and query running
- Language model integrations that request structured context about schemas and sample rows
- Test harnesses that need transient database access without embedding drivers
Useful resources:
- Repository: https://github.com/damms005/devdb-vscode
- Example configuration templates (in the repo)
- Database connection string references:
- PostgreSQL: postgres://user:pass@host:port/dbname
- MySQL: mysql://user:pass@host:port/dbname
- SQLite: file path to .sqlite or .db
- MSSQL: mssql://user:pass@host:port;database=dbname
Use Cases
Schema-aware code generation
- A code-assistant plugin queries the MCP server for table schemas and primary keys to generate typed data access code. Example flow:
- Client requests schema for
public.usersvia MCP - Server returns column names, types and constraints
- Client emits code templates using that metadata
- Client requests schema for
- A code-assistant plugin queries the MCP server for table schemas and primary keys to generate typed data access code. Example flow:
In-editor exploratory queries
- While working in VS Code, run ad-hoc SQL against a development database from the editor:
-- Example: count users created in last 30 days
SELECT COUNT(*) AS recent_users
FROM users
WHERE created_at >= NOW - INTERVAL '30 days';
- The MCP-enabled extension sends this SQL to the server, receives rows and displays results inline.
LLM-driven data analysis (safely)
- An LLM client requests a small sample of rows and column types to build context for an AI-assistant. The MCP server can enforce limits (e.g., max rows returned) and provide structured schema rather than raw dumps.
Migration testing and CI
- CI jobs spin up a temporary database, start the MCP server with a connection, and run migration scripts or verification queries through MCP-based clients. This centralizes database interaction logic for tests.
Troubleshooting & Tips
- If a connection fails, verify the connection string and database accessibility (ports, auth).
- For SQLite, ensure the server process has filesystem permissions for the specified file.
- Use logLevel set to “debug” when developing to see MCP messages and SQL executed.
- Run the MCP server on a dedicated local port and restrict access via firewall/netcat rules if sharing infrastructure.
This setup provides a reliable bridge between your IDE tooling, language models, and databases, letting clients consume database context via a simple, protocol-driven interface.