The Model Context Protocol (MCP) is an open standard designed to facilitate seamless integration between AI applications and various external systems, including tools, data sources, and resources. MCP aims to standardize how AI models, such as large language models (LLMs), interact with external tools and data sources. MCP enables developers to build AI applications that can easily connect to MCP servers, which expose specific capabilities through the standardized protocol. This protocol helps reduce development effort by allowing a “write once, work everywhere” approach, ensuring that any AI application can utilize MCP servers without additional work.
The Model Context Protocol (MCP) offers several key benefits that make it a compelling choice for integrating AI applications with external systems:
- Simplified integration: MCP provides a standardized way for AI models to interact with external tools and data sources, reducing the need for custom integration code for each service.
- Tool discovery and self-description: MCP servers can expose specific capabilities through the protocol, allowing AI models to discover and utilize these tools without additional configuration.
- Consistent security model: MCP ensures a consistent security framework for interactions between AI models and external systems, enhancing the overall security of the integration.
- Built for local and cloud Resources: MCP supports both local and cloud-based resources, making it versatile for various deployment scenarios.
- Enhanced developer experience: MCP's standardized approach reduces development effort by allowing a “write once, work everywhere” methodology, ensuring that any AI application can utilize MCP servers without additional work.
- Future-proofing your AI stack: MCP is designed to be adaptable to future advancements in AI technology, ensuring that your AI applications remain compatible with new tools and data sources.
These advantages make MCP a powerful protocol for developers looking to streamline their AI integration processes and enhance the capabilities of their AI applications.
Azure Database for MySQL MCP Server
We are thrilled to introduce an MCP Server for integrating your AI models with data hosted in Azure Database for MySQL. By utilizing this server, you can effortlessly connect any AI application that supports MCP to your MySQL flexible server (using either MySQL password-based authentication or Microsoft Entra authentication methods), enabling you to provide your business data as meaningful context in a standardized and secure manner.
This server exposes the following tools, which can be invoked by MCP Clients in your AI agents, AI applications or tools like Claude Desktop and Visual Studio Code:
- List all databases in your Azure Database for MySQL flexible server instance.
- List all tables in a database along with their schema information.
- Execute read queries to retrieve data from your database.
- Insert or update records in your database.
- Create a new table or drop an existing table in your database.
- List Azure Database for MySQL flexible server configuration, including its MySQL version, and compute and storage configurations. *
- Retrieve specific server parameter values. *
*Available when using Microsoft Entra authentication method
Getting started
In this section, we’ll show you how to use the MCP server with Claude Desktop and Visual Studio Code to gain valuable insights and visualizations from your databases through natural language queries!
Before diving in, please refer to our GitHub repository: azure-mysql/azure-mysql-mcp to ensure all the prerequisites are in place. You'll also find detailed onboarding guidance and the MCP server code available there.
Install the Azure Database for MySQL MCP Server
1. Clone the azure-mysql repository:
git clone https://github.com/Azure/azure-mysql.git
cd azure-mysql
cd azure-mysql-mcp
2. Create a virtual environment:
python -m venv azure-mysql-mcp-venv
.\azure-mysql-mcp-venv\Scripts\activate.bat
Note: The above commands are applicable to Windows OS. For users of other operating systems, please refer to the full guide in the GitHub repository.
3. Install the dependencies:
pip install mcp
pip install mysql-connector-python
pip install azure-mgmt-mysqlflexibleservers
pip install azure-identity
Use the MCP Server with Claude Desktop
1. In the Claude Desktop app, navigate to the “Settings” pane, select the “Developer” tab and click on “Edit Config”.
2. Open the “claude_desktop_config.json” file and add the following configuration to the “mcpServers” section to configure the Azure Database for MySQL MCP server:
{
"mcpServers": {
"azure-mysql-mcp": {
"command": "<path to the virtual environment>\\azure-mysql-mcp-venv\\Scripts\\python",
"args": [
"<path to azure_mysql_mcp.py file>\\azure_mysql_mcp.py"
],
"env": {
"MYSQLHOST": "<Fully qualified name of your Azure Database for MySQL instance>",
"MYSQLUSER": "<Your Azure Database for MySQL username>",
"MYSQLPASSWORD": "<Your Azure Database for MySQL password>"
}
}
}
}
Note: In this example, we use password-based authentication to connect the MCP Server to Azure Database for MySQL for testing purposes only. However, we recommend using Microsoft Entra authentication. Please refer to these instructions for guidance.
3. Restart the Claude Desktop app.
4. Upon restarting, Click on the “Search and tools” icon at the bottom of the input box. Selecting this icon will display the tools exposed by the MCP Server
You are now all set to start interacting with your data using natural language queries through Claude Desktop!
Here is an example of creating an interactive Histogram of the distribution of Petal Length in the iris dataset.
Here is an example of querying the server parameters:
Here is an example of querying the server properties:
Use the MCP Server with Visual Studio Code
1. In Visual Studio Code, navigate to “File”, select “Preferences” and then choose “Settings”.
2. Search for “MCP” and select “Edit in settings.json”.
3. Add the following configuration to the “mcp” section of the “settings.json” file:
{
"mcp": {
"inputs": [],
"servers": {
"azure-mysql-mcp": {
"command": "<path to the virtual environment>\\azure-mysql-mcp-venv\\Scripts\\python",
"args": [
"<path to azure_mysql_mcp.py file>\\azure_mysql_mcp.py"
],
"env": {
"MYSQLHOST": "<Fully qualified name of your Azure Database for MySQL instance>",
"MYSQLUSER": "<Your Azure Database for MySQL username>",
"MYSQLPASSWORD": "<Your Azure Database for MySQL password>"
}
}
}
}
}
Note: In this example, we use password-based authentication to connect the MCP Server to Azure Database for MySQL for testing purposes only. However, we recommend using Microsoft Entra authentication. Please refer to these instructions for guidance.
4. Select the “Copilot” icon in the upper-right corner to open the GitHub Copilot Chat window.
5. Next, choose “Agent mode” from the dropdown at the bottom of the chat input box.
6. Click on “Select Tools” to view the Tools exposed by the MCP Server.
You are now all set to start interacting with your data using natural language queries through Visual Studio Code!
What’s next?
Start using Model Context Protocol (MCP) today, to integrate your AI apps and agents with your data sources and services. We hope that the new Azure Database for MySQL MCP Server eases your MCP integration journey and helps you unlock the full combined potential of AI and your data stored in Azure Database for MySQL.
Stay tuned for updates as we further enhance the capabilities of the MCP Server to introduce new ways for AI models to interact with your business data. Meanwhile we look forward to your feedback and learning more about how this functionality benefits you.
Feel free to comment below or write to us with your feedback and queries at AskAzureDBforMySQL@service.microsoft.com.
Updated Jun 02, 2025
Version 1.0ramkumarchan
Microsoft
Joined July 29, 2024
Azure Database for MySQL Blog
Follow this blog board to get notified when there's new activity