A Model Context Protocol (MCP) server that gives AI agents safe, structured access to MySQL and PostgreSQL for schema inspection, read queries, and controlled write operations.
Detailed setup guide: INSTALLATION.md
This server is designed for Copilot/MCP workflows where an agent needs database access with explicit tool boundaries.
- Supports multiple configured database servers (MySQL and PostgreSQL)
- Exposes typed MCP tools with clear purpose and input contracts
- Requires human-readable intent (
explanation) for query/write operations - Blocks dangerous destructive operations (
DROP TABLE,DROP DATABASE) - Provides HTTP health endpoint when running in HTTP/SSE mode
Registered MCP tools:
list_available_serverslist_all_databasesinspect_single_table_schemaexecute_select_queryexecute_write_statement
go build -o databases-mcp-serverCreate a .env file with at least one database server definition.
A full example is available in INSTALLATION.md.
./databases-mcp-serverExample MCP client configuration:
{
"servers": {
"database-server": {
"command": "${workspaceFolder}/databases-mcp-server",
"args": [],
"envFile": "${workspaceFolder}/.env"
}
}
}- Call
list_available_serversto discover configured server names. - Call
list_all_databaseswithserver_name. - Call
inspect_single_table_schemawithserver_name,database_name(or schema for PostgreSQL), andtable_name. - Call
execute_select_queryfor reads (requiresserver_name,explanation,sql). - Call
execute_write_statementfor writes (requiresserver_name,explanation,sql).
execute_select_queryis intended for read-onlySELECTstatements.execute_write_statementrejectsDROP TABLEandDROP DATABASE.inspect_single_table_schemavalidates table/database identifiers.- Query and write tools require non-empty
explanationfor auditability.
- Go 1.25.0+
- Access to at least one MySQL or PostgreSQL instance
- Full installation and configuration: INSTALLATION.md
- License: LICENSE
Issues and pull requests are welcome at:
https://github.com/vcrobe/databases-mcp-server
This project is licensed under the MIT License. See LICENSE.