概览
What is Databasemcpserver?
Databasemcpserver is a database operation MCP (Model Context Protocol) server that supports 34 database types, configured via environment variables, enabling AI assistants to safely and conveniently execute database operations. It is built on .NET and SqlSugar ORM, and is distributed as a .NET Global Tool.
How to use Databasemcpserver?
Install the .NET Global Tool with dotnet tool install --global DatabaseMcpServer, then configure an MCP client (e.g., VS Code) by creating an mcp.json file that specifies the command DatabaseMcpServer and the required environment variables DB_CONNECTION_STRING and DB_TYPE. Alternative installation methods include using the dnx command or running from local source code.
Key features of Databasemcpserver
- Supports 34 database types (mainstream, domestic, distributed, time-series)
- Dangerous operation detection and SQL injection protection
- Sensitive information protection (passwords hidden, logs sanitized)
- Environment variable configuration – no per-call parameters
- 47 MCP tools for query, operation, and schema management
- Production-ready with transactions, batch operations, and stored procedures
- Cross‑platform (Windows, macOS, Linux) via .NET Global Tool
Use cases of Databasemcpserver
- Querying, inserting, updating, and deleting data via natural language prompts
- Performing transaction operations (e.g., inter-account transfers)
- Inspecting database schema (tables, columns, indexes, primary keys)
- Calling stored procedures with simple or output parameters
- Executing parameterised and multi-result-set queries for reporting
FAQ from Databasemcpserver
What databases are supported by Databasemcpserver?
Databasemcpserver supports 34 database types, including MySQL, SQL Server, SQLite, PostgreSQL, Oracle, domestic databases (e.g., Dameng, Kingbase, Oscar, HGDB), distributed databases (e.g., OceanBase, TiDB, PolarDB, Doris), and time-series databases (e.g., TDengine, QuestDB, ClickHouse).
How does Databasemcpserver protect against dangerous operations?
The server automatically detects and blocks high-risk SQL like DROP TABLE, TRUNCATE TABLE, ALTER TABLE, and DELETE/UPDATE without WHERE conditions. To perform such operations, specialised schema tools (e.g., drop_table, truncate_table) must be used, which provide explicit risk prompts.
How do I install Databasemcpserver?
The recommended method is as a .NET Global Tool: dotnet tool install --global DatabaseMcpServer. Alternatively, install via dnx [email protected] --yes or clone the repository and run dotnet run from the source directory.
Do I need to specify the database type every time?
No. The database type is set once via the DB_TYPE environment variable (default MySql). Similarly, the connection string is set via DB_CONNECTION_STRING. These environment variables are read from the MCP client configuration.
Can I execute stored procedures with Databasemcpserver?
Yes. Databasemcpserver provides call_stored_procedure for simple calls and call_stored_procedure_with_output for procedures with output parameters, both accessible through natural language prompts.