mcp_sql_demo
Verified Safeby FatherOfCurses
Overview
Provides secure, multi-database access for LLMs to inspect MySQL schemas and execute SQL queries, supporting both read and configurable write operations with fine-grained schema-specific permissions.
Installation
npx @benborla29/mcp-server-mysqlEnvironment Variables
- MYSQL_HOST
- MYSQL_PORT
- MYSQL_USER
- MYSQL_PASS
- MYSQL_DB
- ALLOW_INSERT_OPERATION
- ALLOW_UPDATE_OPERATION
- ALLOW_DELETE_OPERATION
- ALLOW_DDL_OPERATION
- SCHEMA_INSERT_PERMISSIONS
- SCHEMA_UPDATE_PERMISSIONS
- SCHEMA_DELETE_PERMISSIONS
- SCHEMA_DDL_PERMISSIONS
- MULTI_DB_WRITE_MODE
- MYSQL_DISABLE_READ_ONLY_TRANSACTIONS
- IS_REMOTE_MCP
- REMOTE_SECRET_KEY
- PORT
- ENABLE_LOGGING
- MYSQL_LOG_LEVEL
- MYSQL_POOL_SIZE
- MYSQL_QUERY_TIMEOUT
- MYSQL_CACHE_TTL
- MYSQL_RATE_LIMIT
- MYSQL_MAX_QUERY_COMPLEXITY
- MYSQL_SSL
- MYSQL_SSL_REJECT_UNAUTHORIZED
- MYSQL_SOCKET_PATH
Security Notes
The server demonstrates strong security practices: it defaults to read-only mode, enforces schema-specific permissions for write/DDL operations, uses prepared statements to prevent SQL injection (implicitly via mysql2 library), and requires a `REMOTE_SECRET_KEY` for remote access. The primary security risks would stem from misconfiguration (e.g., granting excessive MySQL user privileges, setting `MULTI_DB_WRITE_MODE=true` without granular schema permissions, or using a weak `REMOTE_SECRET_KEY`). The `scripts/setup-test-db.ts` file uses hardcoded `mcp_test_password` but this is strictly for a test environment.
Similar Servers
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.
postgres-mysql-mcp-server
A Model Context Protocol (MCP) server that enables AI assistants to query PostgreSQL and MySQL databases for schema introspection and data retrieval.
mcp-server-generator
Generate Model Context Protocol (MCP) servers from database datasources for integration with AI agents, using a visual canvas interface for tool creation and management.
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.