db
A Rust-based MCP server that enables AI assistants to interact with SQL databases (SQLite, PostgreSQL, MySQL) safely and efficiently.
claude mcp add --transport stdio alariczq-db-mcp-server db-mcp-server
How to use
This DB MCP Server is a Rust-based MCP server that lets AI assistants safely interact with SQL databases (SQLite, PostgreSQL, MySQL). It supports both stdio transport for CLI integrations and an HTTP mode with Server-Sent Events for web clients, with Bearer token authentication available for HTTP. The server enforces read-only defaults, protects against dangerous operations, and provides per-database lazy connection pools along with dynamic connection management. Tools are divided into read-only, write, and connection-management categories, enabling you to list connections and tables, describe schemas, run safe reads, modify data with explicit writable permissions, and manage connections at runtime.
To use it, start the server and connect via the transport you prefer. In HTTP mode, supply an auth token if you enable authentication, and use the provided tools to perform queries, explain plans, manage transactions, and inspect server/state information. The server supports mixed environments where you can define multiple databases, either in a single command, via environment variables, or through Claude/Codex/Claude Desktop configurations that map logical names to database URLs. Tools like list_connections, query, list_tables, describe_table, and explain help you retrieve data safely, while begin_transaction, commit, and rollback enable transactional work across multiple calls with transaction IDs.
How to install
Prerequisites:
- Rust toolchain (stable) with cargo installed
- Internet access to fetch crates
Option A — Install from source (recommended for development):
- Ensure Rust and Cargo are installed. Verify with: rustc --version cargo --version
- Clone the repository and navigate to the project root.
- Build and install the MCP server: cargo install --path . This installs the binary (db-mcp-server) to your Cargo bin directory.
Option B — Build a release binary locally:
- Ensure Rust is installed.
- From the project root, build in release mode: cargo build --release
- The binary will be at target/release/db-mcp-server. You can run it directly or move it to a location in your PATH.
Option C — Prerequisites for Docker-based workflows (if applicable):
- Docker installed and running if you choose containerized usage (not required for this Rust build).
Additional notes
Notes and tips:
- Default behavior is read-only; to perform writes, include ?writable=true in the database connection string.
- Use server-level connections to connect to a server without selecting a default database.
- The dangerous operation guard prevents DROP, TRUNCATE, and unqualified DELETE/UPDATE unless skip_sql_check is explicitly set to true.
- For HTTP mode, provide a Bearer token via an Authorization header: Authorization: Bearer <token>.
- You can manage connections at runtime with add_connection, update_connection, and delete_connection; be mindful of active transactions when updating or deleting connections.
- Output formatting options include json, table, and markdown for query results and explain plans.
Related MCP Servers
hyper
📦️ A fast, secure MCP server that extends its capabilities through WebAssembly plugins.
SmartDB_MCP
Universal database MCP server connecting to MySQL, PostgreSQL, SQL Server, MariaDB,DM8,Oracle,not only provides basic database connection such as OAuth 2.0 authentication , health checks, SQL optimization, and index health detection
knowledgegraph
MCP server for enabling persistent knowledge storage for Claude through a knowledge graph with multiple storage backends and fuzzy search
gemini-cli
> Gemini Rust Suite 🦀: A powerful, modular Rust toolkit for interacting with Google Gemini. Features a feature-rich CLI, persistent semantic memory (LanceDB), and extensible tool integration via the Model Context Protocol (MCP).
engram-rs
Memory engine for AI agents — time axis (3-layer decay/promotion) + space axis (self-organizing topic tree). Hybrid search, LLM consolidation. Single Rust binary.
mcp
✨ MCP Server for Effortless Dependency Updates