mysql-mcp-server

mysql-mcp-server

0

The MySQL Database Access MCP Server is designed to provide read-only access to MySQL databases through the Model Context Protocol (MCP). It features tools for listing databases, tables, and executing queries while ensuring security with read-only permissions and query validation.

MySQL Database Access MCP Server

This MCP server provides read-only access to MySQL databases. It allows you to:

  • List available databases
  • List tables in a database
  • Describe table schemas
  • Execute read-only SQL queries

Security Features

  • Read-only access: Only SELECT, SHOW, DESCRIBE, and EXPLAIN statements are allowed
  • Query validation: Prevents SQL injection and blocks any data modification attempts
  • Query timeout: Prevents long-running queries from consuming resources
  • Row limit: Prevents excessive data return

Installation

  1. Install from NPM
  2. Build from Source

Configure environment variables for server operation, and add the configuration to your MCP settings.

Available Tools

  • list_databases: Lists all accessible databases.
  • list_tables: Lists all tables in a specified database.
  • describe_table: Shows the schema for a specific table.
  • execute_query: Executes read-only SQL queries.

Testing

Use test scripts to verify functionality with your MySQL setup.

Troubleshooting

  • Check server logs for error messages.
  • Verify MySQL credentials and connection details.
  • Ensure user permissions and query formats.