<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/sql-mcp-server-bringing-ai-agents-to-your-sql-data-mg2yl4bcr" -->

---
title: SQL MCP Server: Bringing AI Agents to Your SQL Data
description: A Microsoft principal architect walks through building a SQL MCP server on top of Data API Builder (DAB), letting AI agents query SQL Server, Azure SQL, or SQL...
canonical: https://daily.dev/posts/sql-mcp-server-bringing-ai-agents-to-your-sql-data-mg2yl4bcr
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: SQL MCP Server: Bringing AI Agents to Your SQL Data | daily.dev
og:description: A Microsoft principal architect walks through building a SQL MCP server on top of Data API Builder (DAB), letting AI agents query SQL Server, Azure SQL, or SQL...
og:url: https://daily.dev/posts/sql-mcp-server-bringing-ai-agents-to-your-sql-data-mg2yl4bcr
og:image: https://api.daily.dev/og/posts/MG2Yl4bCr.png
og:image:alt: SQL MCP Server: Bringing AI Agents to Your SQL Data
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# SQL MCP Server: Bringing AI Agents to Your SQL Data

**[Microsoft Developer](https://daily.dev/sources/microsoftdeveloper)** · 75 min read · 2 upvotes · 0 comments

## Summary

A Microsoft principal architect walks through building a SQL MCP server on top of Data API Builder (DAB), letting AI agents query SQL Server, Azure SQL, or SQL in Fabric through natural language without the model or app ever writing SQL. Live demos in Visual Studio Code with GitHub Copilot and Claude Opus show how DAB exposes tables, views, and stored procedures via REST, GraphQL, or MCP through a JSON configuration file, with built-in tools like describe_entities and read_records, role-based access control, pagination, and parameterized queries generated server-side to avoid SQL injection and model-authored SQL.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=geK_ijU0YC8>

## Questions this post answers

### How does SQL MCP Server let an AI agent query a database without the model writing SQL?

SQL MCP Server, built on Data API Builder (DAB), exposes tools like describe_entities, read_records, aggregate, and execute_entity that the AI model selects based on tool descriptions in a JSON config file. The model never generates SQL; DAB executes parameterized queries (using sp_executesql) behind the scenes and returns JSON results, avoiding the unreliable queries produced by natural-language-to-SQL approaches.

_daily.dev surfaces practical breakdowns like this for developers wiring AI agents into production databases safely._

### How do I enable MCP support on an existing Data API Builder configuration?

Add the model context protocol as an allowed runtime protocol alongside REST and GraphQL in the DAB JSON configuration file, then restart the DAB process. No additional code is required; DAB automatically becomes an MCP server exposing the tables, views, and stored procedures defined in the config as callable tools for AI models.

_developers configuring DAB for AI workflows can track setup details like this via daily.dev._

### How do you handle complex queries like joins when using SQL MCP Server since the read_records tool can't join tables?

Since the read_records tool only supports basic filtering with no join capability, complex queries requiring joins must be implemented as a SQL view or a stored procedure, then exposed in the DAB config as a table/view entity or as a custom tool. A custom tool with a clear description (e.g., for a bill-of-materials lookup) helps the model pick the right tool instead of relying on the generic execute_entity method.

_engineers deciding between views, stored procedures, and custom tools for AI data access can follow discussions like this on daily.dev._

## Similar posts on daily.dev

- [DBmaestro MCP Server Puts Natural Language in Control of Database Pipelines](https://daily.dev/posts/dbmaestro-mcp-server-puts-natural-language-in-control-of-database-pipelines-tx3aumpiw) · InfoQ · 0 upvotes · 0 comments
- [Build and Deploy an App Prototype with an AI Agent using MCP in an Afternoon](https://daily.dev/posts/build-and-deploy-an-app-prototype-with-an-ai-agent-using-mcp-in-an-afternoon-hdtdzu1ly) · SingleStore · 0 upvotes · 0 comments

---

Tags: [#github](https://daily.dev/tags/github), [#ai-agents](https://daily.dev/tags/ai-agents), [#mcp](https://daily.dev/tags/mcp), [#microsoft-sql-server](https://daily.dev/tags/microsoft-sql-server)

[View this post on daily.dev](https://daily.dev/posts/sql-mcp-server-bringing-ai-agents-to-your-sql-data-mg2yl4bcr)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"SQL MCP Server: Bringing AI Agents to Your SQL Data","url":"https://daily.dev/posts/sql-mcp-server-bringing-ai-agents-to-your-sql-data-mg2yl4bcr","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/sql-mcp-server-bringing-ai-agents-to-your-sql-data-mg2yl4bcr"},"datePublished":"2026-08-17T16:24:12.226Z","dateModified":"2026-09-14T07:17:46.458Z","description":"A Microsoft principal architect walks through building a SQL MCP server on top of Data API Builder (DAB), letting AI agents query SQL Server, Azure SQL, or SQL...","image":"https://i.ytimg.com/vi/geK_ijU0YC8/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/geK_ijU0YC8/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Microsoft Developer","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Microsoft Developer","logo":"https://media.daily.dev/image/upload/s--xZzU3zUq--/f_auto/v1746714872/logos/microsoftdeveloper","url":"https://daily.dev/sources/microsoftdeveloper"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/sql-mcp-server-bringing-ai-agents-to-your-sql-data-mg2yl4bcr","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"github,ai-agents,mcp,microsoft-sql-server","timeRequired":"PT75M","video":{"@type":"VideoObject","name":"SQL MCP Server: Bringing AI Agents to Your SQL Data","description":"A Microsoft principal architect walks through building a SQL MCP server on top of Data API Builder (DAB), letting AI agents query SQL Server, Azure SQL, or SQL...","thumbnailUrl":"https://i.ytimg.com/vi/geK_ijU0YC8/sddefault.jpg","uploadDate":"2026-08-17T16:24:12.226Z","duration":"PT75M","url":"https://api.daily.dev/r/MG2Yl4bCr","embedUrl":"https://www.youtube.com/embed/geK_ijU0YC8"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Microsoft Developer","item":"https://daily.dev/sources/microsoftdeveloper"},{"@type":"ListItem","position":3,"name":"SQL MCP Server: Bringing AI Agents to Your SQL Data"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/sql-mcp-server-bringing-ai-agents-to-your-sql-data-mg2yl4bcr#faq","mainEntity":[{"@type":"Question","name":"How does SQL MCP Server let an AI agent query a database without the model writing SQL?","acceptedAnswer":{"@type":"Answer","text":"SQL MCP Server, built on Data API Builder (DAB), exposes tools like describe_entities, read_records, aggregate, and execute_entity that the AI model selects based on tool descriptions in a JSON config file. The model never generates SQL; DAB executes parameterized queries (using sp_executesql) behind the scenes and returns JSON results, avoiding the unreliable queries produced by natural-language-to-SQL approaches. daily.dev surfaces practical breakdowns like this for developers wiring AI agents into production databases safely."}},{"@type":"Question","name":"How do I enable MCP support on an existing Data API Builder configuration?","acceptedAnswer":{"@type":"Answer","text":"Add the model context protocol as an allowed runtime protocol alongside REST and GraphQL in the DAB JSON configuration file, then restart the DAB process. No additional code is required; DAB automatically becomes an MCP server exposing the tables, views, and stored procedures defined in the config as callable tools for AI models. developers configuring DAB for AI workflows can track setup details like this via daily.dev."}},{"@type":"Question","name":"How do you handle complex queries like joins when using SQL MCP Server since the read_records tool can't join tables?","acceptedAnswer":{"@type":"Answer","text":"Since the read_records tool only supports basic filtering with no join capability, complex queries requiring joins must be implemented as a SQL view or a stored procedure, then exposed in the DAB config as a table/view entity or as a custom tool. A custom tool with a clear description (e.g., for a bill-of-materials lookup) helps the model pick the right tool instead of relying on the generic execute_entity method. engineers deciding between views, stored procedures, and custom tools for AI data access can follow discussions like this on daily.dev."}}]}
```

