MCP Magic: AI-Powered Azure SQL Analysis in Plain English

Imagine being able to ask your database questions in plain English and getting visualizations quickly. Traditional SQL analysis requires expertise in SQL query language and separate visualization tools. However, by combining MSSQL and Charting MCP servers in VS Code with natural language, we can enable data analysis for both technical and non-technical users.

This powerful combination makes complex database querying and visualization accessible to everyone, regardless of their SQL expertise.

What is an MCP Server?

MCP (Model Context Protocol) servers are lightweight programs that each expose specific capabilities through the standardized Model Context Protocol. This allows your LLM to gather more context or take action using tools. There has been an explosion of MCP servers that provide capabilities like database querying, visualization, and more. Think of an MCP server like an API, except it’s designed to be consumed by an AI Agent rather than a traditional application.

Setting Up Your Environment

Prerequisites

  • Visual Studio Code
  • Azure SQL Database (like AdventureWorks)
  • Github Copilot Chat (in Agent mode) or similar AI Agent

Installing and Configuring MSSQL MCP Server

  1. Clone the MSSQL MCP server repository:
  1. Configure the server in VS Code settings.json:

Note – I had to modify the index.ts file to include tenantId information when obtaining an access token. You may need to do something similar. The code relies on Entra Auth for authentication.

Note – Ensure your firewall rules allow connections from your client IP address.

Adding Charting MCP Server for Visualization

  1. Add to your VS Code settings.json:
  1. Now start both MCP servers. In VS Code, you can do this by clicking “Start” above each MCP server JSON entry.

Verifying Connection

Try a simple natural language query like:

“What tables are in my database?”

Your response should include a list of tables from your Azure SQL Database.

Example Query and Visualization

Prompt:

“What time of day do we get the most orders placed? Visualize the data in a line chart.”

From here, the LLM will do several things:

  1. Utilize the MSSQL MCP server to gather more information about your database, such as listing each of the table names.
  1. Query for the columns on the tables of interest.
    1. If data is contained in multiple tables, it will perform joins automatically.
  1. From there, it will generate a query that aggregates the orders by time of day as raw data.
  1. Lastly, the LLM will proceed to use the visualization MCP tools to produce a chart and generate a .png file for you to download.
Line graph showing order counts by hour, with peaks at 8 AM and 1 PM (19 orders each), and lower activity in early morning and evening.

Summary

Using natural language, AI, and MCP servers in VS Code makes Azure SQL Database analysis much more approachable. You don’t have to be a SQL expert or juggle multiple tools—just ask questions and get answers, including charts, right in your editor. MCP servers are flexible, and there are plenty of options out there, from charting to automation. The ecosystem is expanding quickly, so it’s worth exploring what’s available and seeing how you can streamline your workflows.

A good place to start exploring is this repo that lists a lot of popular MCP servers: https://github.com/modelcontextprotocol/servers.

author avatar
Branden Barber Sr. Software Engineer
Branden (known as “Beebs” around the office) had the unique opportunity of testing the waters as a Don’t Panic Labs intern in 2011 while working toward his Computer Science degree at UNL. Don’t Panic Labs’s passion for building quality software and company culture is why he stuck around.

Related posts