MySQL MCP Server logo

MySQL MCP Server

by ganganbiz1

A MySQL Model Context Protocol (MCP) server implemented with FastMCP 2.0 and Python. It allows executing SQL queries and retrieving database schema information via MCP functions.

View on GitHub

Last updated: N/A

What is MySQL MCP Server?

This is a MySQL MCP server that uses FastMCP 2.0 and Python to provide access to a MySQL database via the Model Context Protocol. It allows users to execute SQL queries and retrieve database schema information.

How to use MySQL MCP Server?

To use the server, integrate it with a tool like Cursor by adding the provided configuration to your ~/.cursor/mcp.json file. Ensure Docker is running and the necessary environment variables (MYSQL_HOST, MYSQL_PORT, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE) are set. You can also build the Docker image separately using the provided Dockerfile.

Key features of MySQL MCP Server

  • Execute SQL queries via MCP functions

  • Get database schema information

  • Fully containerized with Docker and docker-compose

  • Packaged with Poetry for dependency management

Use cases of MySQL MCP Server

  • Integrating MySQL databases with MCP-compatible tools

  • Automating database schema discovery

  • Executing SQL queries remotely

  • Providing a standardized interface for database interaction

FAQ from MySQL MCP Server

What is MCP?

Model Context Protocol (MCP) is a protocol for interacting with data models.

What is FastMCP 2.0?

FastMCP 2.0 is a framework used to implement MCP servers.

How do I configure the server?

Configure the server by setting the environment variables for MySQL connection details.

How do I build the Docker image?

Use the command docker build -t mysql-mcp-server . in the directory containing the Dockerfile.

What MCP tools are provided?

The server provides tools like execute_query, execute_update, get_tables, get_table_schema, and describe_database.