generic-mcp-db-server
Verified Safeby stucchi
Overview
This server acts as an API gateway for AI agents, providing read-only access to MySQL and optionally MongoDB databases via the Model Context Protocol.
Installation
docker run -d --name mcp-db -p 3000:3000 -e API_KEY="your-api-key-here" -e MYSQL_HOST=your-mysql-host -e MYSQL_USER=your-mysql-user -e MYSQL_PASSWORD=your-mysql-password -e MYSQL_DATABASE=your-database ghcr.io/stucchi/generic-mcp-db-server:latestEnvironment Variables
- API_KEY
- MYSQL_HOST
- MYSQL_USER
- MYSQL_PASSWORD
- MYSQL_DATABASE
Security Notes
The server implements API key authentication and CORS for network security. For MySQL, it explicitly restricts queries to `SELECT`, `SHOW`, and `DESCRIBE` operations, preventing accidental or malicious writes/deletes. Table names in `mysql_describe` are sanitized, and `mysqlPool.execute` is used for queries, which generally aids in preventing SQL injection if used correctly with parameters. MongoDB queries accept filter objects, which while generally safer, could potentially be exploited by an unconstrained AI for resource exhaustion if not managed at the AI layer. The default API_KEY 'your-secret-api-key-change-this' is a minor security risk if not changed immediately, but is clearly flagged.
Similar Servers
tmcp
A server implementation for the Model Context Protocol (MCP) to enable LLMs to access external context and tools.
mcp-mysql-server
Provides an MCP-compliant interface for AI models to securely interact with a MySQL database for CRUD operations, schema inspection, and performance analysis.
mysql-mcp
Provides an MCP (Model Context Protocol) server for MySQL, enabling AI agents to programmatically interact with and manage MySQL databases.
mysql_mcp_server
This server provides a Model Context Protocol (MCP) interface to a MySQL database, enabling AI models to execute SQL queries and retrieve database schema information.