MCP.so
Sign In
Servers

mysqldb-mcp-server MCP server

@burakdirin

An MCP server implementation that enables Claude AI to interact with MySQL databases.

Overview

What is mysqldb-mcp-server?

mysqldb-mcp-server is a Model Context Protocol (MCP) server that provides tools to connect to and query MySQL databases. It is designed for AI assistants, like Claude, that need to interact directly with MySQL databases through natural language or structured commands.

How to use mysqldb-mcp-server?

Install the package using pip install mysqldb-mcp-server or uv pip install mysqldb-mcp-server. Configure it with environment variables for MySQL connection (host, user, password, optional database, read-only mode). Then add it to your MCP client (e.g., Claude Desktop) by editing the client’s configuration file and specifying the command and environment variables. You can also install it automatically via Smithery.

Key features of mysqldb-mcp-server

  • Connects to a MySQL database using the connect_database tool.
  • Executes SQL queries with the execute_query tool.
  • Supports multiple semicolon-separated queries in one call.
  • Offers an optional read-only mode to prevent data modification.
  • Configurable via environment variables for host, user, and password.

Use cases of mysqldb-mcp-server

  • Let an AI assistant query a MySQL database to answer user questions.
  • Execute administrative SQL statements (e.g., SELECT, INSERT) from a chat interface.
  • Interact with a development or testing database in read-only mode to avoid accidental writes.

FAQ from mysqldb-mcp-server

What environment variables are required?

MYSQL_HOST (default “localhost”), MYSQL_USER (default “root”), and MYSQL_PASSWORD (default empty). MYSQL_DATABASE is optional, and MYSQL_READONLY disables write queries when set to “1” or “true”.

What tools does mysqldb-mcp-server provide?

It provides two tools: connect_database (takes a database string) and execute_query (takes a query string). Both return results in JSON format.

How do I install mysqldb-mcp-server?

You can install it via pip (pip install mysqldb-mcp-server) or uv (uv pip install mysqldb-mcp-server). For use with Claude Desktop, add a configuration entry pointing to the installed package via uvx.

Can I execute multiple queries in one call?

Yes. The execute_query tool accepts multiple SQL statements separated by semicolons and returns results for all queries.

How do I enable read-only mode?

Set the environment variable MYSQL_READONLY to “1” or “true”. When enabled, the server will refuse any queries that attempt to modify data.

Tags

More from Other