Labsco
rbatis logo

RBDC MCP Server

β˜… 24

from rbatis

An MCP-based database server with support for SQLite, MySQL, PostgreSQL, and MSSQL.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup

RBDC MCP Server

A database server based on Model Context Protocol (MCP), supporting SQLite, MySQL, PostgreSQL, MSSQL, DuckDB, and Turso databases.

πŸ‡¨πŸ‡³ δΈ­ζ–‡ζ–‡ζ‘£ / Chinese Documentation: readme_cn.md

Advantages

  • Multiple Database Support: Seamlessly work with SQLite, MySQL, PostgreSQL, MSSQL, DuckDB, and Turso using a unified interface
  • AI Integration: Native integration with Claude AI through the Model Context Protocol
  • Zero Configuration: Automatic management of database connections and resources
  • Security: Controlled access to your database through AI-driven natural language queries
  • Simplicity: Use natural language to query and modify your database without writing SQL

πŸ—„οΈ Database Support

DatabaseConnection URL Format
SQLitesqlite://path/to/database.db
MySQLmysql://user:password@host:port/database
PostgreSQLpostgres://user:password@host:port/database
MSSQLmssql://user:password@host:port/database
DuckDBduckdb://path/to/database.duckdb
Tursoturso://database-url?token=your-token

πŸ› οΈ Available Tools

  • sql_query: Execute a single read-only SQL statement. Pass optional alias to target a non-default database; defaults to default.
  • sql_exec: Execute INSERT/UPDATE/DELETE operations when the server is not in read-only mode. Pass optional alias to target a non-default database.
  • db_status: Inspect connection pool state for a database. Pass optional alias.
  • test_connection: Ping a registered database. Pass optional alias.
  • list_databases: List all registered database aliases along with their URL and detected type.
  • add_database: Register a new database connection under an alias and start a pool at runtime. Supported URL schemes: sqlite://, mysql://, pg:// / postgres://, mssql:// / sqlserver://, duckdb://, turso:// / libsql://.
  • remove_database: Unregister a previously-added alias. The reserved default alias cannot be removed.

πŸ”Œ Dynamic Multi-Database

rbdc-mcp is a multi-database server from a single process. You can start it with no database URL at all (args: [] in your MCP client config) and let the AI register databases on the fly through MCP tools. When a URL is provided via --database-url, it becomes the default alias; the AI can then register more databases at runtime and route queries to any of them by alias.

Zero-URL Startup (Dynamic Mode)

When the server starts with no --database-url, the list_databases tool returns an empty list and any operation targeting the default alias will suggest using add_database first. The AI can register the first (or any) database under any alias it chooses:

  1. add_database(alias="inventory", url="sqlite://./inventory.db") β€” register a database.
  2. list_databases β€” confirm it is now registered.
  3. sql_query({ alias: "inventory", sql: "SELECT * FROM products" }) β€” query it.

Tip: You can also register a database with alias="default" if you prefer to omit alias from subsequent queries.

Pre-declared Startup (Static Mode)

Tool flow the AI follows:

  1. list_databases β€” see all currently registered aliases.
  2. add_database(alias="orders_mysql", url="mysql://user:pass@host/orders") β€” register a new database and start a pool for it.
  3. sql_query({ alias: "orders_mysql", sql: "SELECT COUNT(*) FROM orders" }) β€” route a query to that database. Omit alias to use the default one.
  4. remove_database(alias="orders_mysql") β€” tear down the pool and unregister the alias when finished.

Two ways to register databases

PathWhenHow
CLI pre-declaredStable list, you want the AI to see every database at bootRepeat --database-url and pair --alias (the first URL becomes default).
Runtime add_databaseAd-hoc / exploratory / zero-URL startupThe AI calls the add_database MCP tool.

Both paths write into the same in-memory alias β†’ pool registry, so the result is identical from the AI's point of view: list_databases returns every alias regardless of where it was registered.

Why this matters

  • One MCP server process, many databases β€” no need to spawn rbdc-mcp-mysql, rbdc-mcp-postgres, etc. for each database.
  • All aliases are discoverable via list_databases, so the AI can dynamically pick the right target per query.
  • When a --database-url is provided, the default alias is reserved for it and cannot be removed.
  • Each alias has its own independent connection pool β€” concurrent queries against different aliases do not block each other.

Example prompt you can give the AI

"Connect to my MySQL orders database at mysql://root:pwd@10.0.0.5/orders and tell me the total revenue by month."

The AI will call add_database(...), then sql_query(...) against that alias without restarting the MCP server β€” works the same whether you provided a --database-url at startup or not.

Read-Only Mode

--read-only disables the sql_exec tool, preventing any data modifications. Additionally, sql_query validates submitted SQL and rejects statements containing write keywords (INSERT, UPDATE, DELETE, etc.) or multi-statement input.

πŸ“Έ Screenshots

Step 1: Configuration Configuration

Step 2: Usage in Claude Usage