mcp-server-mysql

mcp-server-mysql

1

This project is a Model Context Protocol server focused on providing read-only access to MySQL databases to enable LLMs to query and inspect data securely and efficiently. Key features include security measures to prevent SQL injection, performance optimizations, and comprehensive monitoring tools.

MCP Server for MySQL based on NodeJS

  • A Model Context Protocol server providing read-only access to MySQL databases.
  • Enables inspection of database schemas and execution of read-only queries by LLMs.

Features

  • Tools: Execute read-only SQL queries with features like prepared statements and result pagination.
  • Resources: JSON schema information for tables, including column names, data types, and relationships.
  • Security: SQL injection prevention, query whitelisting/blacklisting, and SSL encryption support.
  • Performance: Includes connection pooling, query caching, and plan analysis.
  • Monitoring: Features comprehensive logging, error tracking, and query statistics.

Installation

  • The server can be installed using Smithery, MCP Get, NPM, or PNPM.
  • Smithery and MCP Get provide automated setup; manual configuration requires editing configuration files.

Configuration

  • Automatic setup is provided if installed via Smithery.
  • For manual setup, environment variables and JSON configuration files are used, allowing detailed control over server behavior.

Testing

  • Tests include creating a test database and ensuring functionality using comprehensive script setups.

Troubleshooting

  • Detailed troubleshooting steps including checking server connection, performance, and security issues.