Unlocking Database Intelligence with SQL MCP Server

A Practical Guide to the Model Context Protocol and Data API Builder

Artificial intelligence agents are changing how we access and manipulate data. Instead of writing queries and building custom APIs, AI can now interact with databases through a standard protocol that’s both safe and production ready. At the heart of this shift is the SQL MCP Server—a bridge between AI agents and your SQL data.

In this article we’ll walk through what SQL MCP Server is, how it works, how to deploy it to Azure Container Apps, and how to use it in real scenarios. You’ll get hands-on workshop style examples and pointers to the official docs for deeper exploration.


What is SQL MCP Server

Imagine asking a chatbot to list customers, update records, or summarize sales without ever writing SQL. That’s the promise of SQL MCP Server. It uses the Model Context Protocol (MCP) to expose database operations as well-defined tools that AI agents can call in a predictable way.

Under the covers SQL MCP Server is built on Data API Builder (DAB). Data API Builder gives you a way to declare your data model, security roles, and endpoints once. SQL MCP Server then surfaces those same operations as MCP tools, so agents can perform typed CRUD (Create, Read, Update, Delete) actions without unpredictable natural language SQL generation.

The design here is intentional: avoid nondeterministic translation from text to SQL, and instead provide controlled, secure access. That means you get safe database interactions and consistent behavior across environments.


Architecture: How It All Fits Together

SQL MCP Server is essentially an MCP endpoint that wraps your SQL database through Data API Builder. Here’s a high-level look at the architecture:

  • AI Agent (MCP Client): This lives in your application or tool that needs data access, like an AI assistant.
  • MCP Server: Hosted by Data API Builder, this endpoint exposes a set of tools representing database actions.
  • Database Backend: Your SQL Server, Azure SQL, or compatible database that stores the actual data.

The Model Context Protocol defines how clients discover tools exposed by the MCP server, what inputs those tools expect, and the structure of the outputs. This creates a predictable interaction model for agents.


Data Manipulation Tools Explained

Once SQL MCP Server is configured, it provides a suite of tools that agents can use. Here are typical operations you’ll find:

  • List Tables – Returns all available tables in the database.
  • Describe Table – Returns schema and column metadata.
  • Read Rows – Runs a typed read against a specified entity.
  • Insert, Update, Delete – Perform controlled data updates with defined permissions.

These tools replace the need for agents to generate raw SQL. Instead, an agent asks for a documented operation, the server executes it, and the result returns in a structured, typed format. The arrangement simplifies integration and keeps security tight.

A practical example: an agent might call the Read Rows tool with a filter on OrderDate > '2026-01-01' and receive a structured dataset without SQL text generation or risk. This makes agent actions deterministic and auditable.


Workshop: Getting Started

Below are examples you can try in a workshop or hands-on session.

Example One – Local MCP Server with Visual Studio Code

  1. Install the Data API Builder CLI.
dotnet new tool-manifest
dotnet tool install microsoft.dataapibuilder --prerelease

2. Create a configuration file (dab-config.json) with your database connection and entities you want exposed.

3. Start the MCP server locally.

dab run

4. Connect from Visual Studio Code using an MCP client extension and explore tools like List Tables.

This is a great way to explore how structured data access works without cloud deployment.

Example Two – Deploy to Azure Container Apps

  1. Package your SQL MCP Server configuration and container image.
  2. Deploy to Azure Container Apps with public ingress.
  3. Use the endpoint URL in your AI agent or application.

Once deployed, you can integrate with tools like Azure AI Foundry or a custom MCP client.


How-To Guide: Enhance Entity Metadata

To make your MCP interface even more useful, you can add descriptions and metadata to entities. This helps agents understand context and reduces ambiguity in tool discovery and invocation. In your Data API Builder config, include descriptive fields for tables and properties. Then regenerate your MCP interface before connecting clients.

Additionally, configuring authentication ensures that only authorized agents can access the MCP endpoint. You can use JSON Web Tokens (JWTs) or role mappings defined in your DAB config to control access.


Deployment: Azure Container Apps

Azure Container Apps gives you a scalable platform to run SQL MCP Server in production. After you’ve tested locally:

  • Create a container image with your configuration and Data API Builder engine.
  • Push it to a container registry.
  • Deploy to Azure Container Apps with public ingress so your agent can target the MCP endpoint.

This setup is production ready, includes integrated telemetry, and works with RBAC defined in your Data API Builder configuration.


Model Context Protocol: The Glue

At its core, MCP is an open standard for discovery, calling, and interacting with tools from AI agents. It defines how tools are described, how inputs and outputs are structured, and how clients and servers communicate. This standardized handshake lets you build one MCP server that any MCP-compatible AI agent can talk to.

Agents first discover tools exposed by your MCP server, then invoke them with structured inputs. The server executes and returns defined outputs. This avoids unpredictable natural language parsing and gives developers control over what actions an AI can take.


Real-World Example

Here’s a typical agent request in an MCP world:

Agent: “List the available tables in the Sales database.”
MCP Server Tool Invocation: Calls List Tables tool.
Result: Structured JSON list of table names.

Because this uses a defined tool contract, the agent doesn’t guess SQL or interpret free text. It simply calls a known operation and handles the result.


Why This Matters

AI systems are powerful but can be unpredictable when translating natural language to structured commands. SQL MCP Server and MCP sidestep that by exposing a typed, discoverable API surface backed by a secure, declarative configuration. This means:

  • Predictable AI behavior
  • Controlled access to data operations
  • Clear audit trails for agent actions
  • A single integration point for multiple agents

That’s a big step toward safe, enterprise-ready agentic applications.


Reference Materials

Here are the most relevant official docs you can explore next:

  • Microsoft’s documentation on SQL MCP Server in the Azure Data API Builder docs.
  • Data API Builder overview for deeper context and configuration.
  • The official Model Context Protocol specification.

Wrap-Up

SQL MCP Server is a powerful way to bring safe, deterministic database access to intelligent agents. It takes proven API practices from Data API Builder and extends them with the Model Context Protocol to create a predictable, secure workflow for agentic applications. Whether you’re building internal assistants or next-generation data tools, this approach gives you a solid foundation without exposing your raw database to uncontrolled queries.


Discover more from SQLyard

Subscribe to get the latest posts sent to your email.

Leave a Reply

Discover more from SQLyard

Subscribe now to keep reading and get access to the full archive.

Continue reading