Back to Home
stucchi icon

generic-mcp-db-server

Verified Safe

by 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

Run Command
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:latest

Environment 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

Stats

Interest Score0
Security Score8
Cost ClassMedium
Avg Tokens1000
Stars0
Forks0
Last Update2025-12-13

Tags

MCPDatabaseMySQLMongoDBAI Tools