Lesson 2 of 2 Model Context Protocol for SQL

Connecting to SQL and Fabric MCP Servers

This lesson explains how MCP clients are configured and how agents reach SQL Server, Azure SQL and Fabric lakehouse data.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how servers are configured in an MCP client.
  • Identify the ways to start SQL MCP Server.
  • Explain how agents reach lakehouse data through the SQL analytics endpoint.

Configuring the client

An MCP client is configured with a list of servers. In VS Code, a JSON configuration file (for example .vscode/mcp.json in a workspace, or the user profile's configuration) contains a servers object in which each server has a type and either a command with arguments (stdio) or a URL (HTTP). Secrets are supplied through prompted input variables or environment variables, never written in the file, and the file can be committed so a team shares the same servers. After the client starts a server, its tools appear in the tools picker in agent mode. VS Code's MCP configuration options continue to evolve, so the current documentation describes the exact file names and formats.

{
  "servers": {
    "sql-inventory": {
      "type": "http",
      "url": "https://dab-inventory.contoso.azurecontainerapps.io/mcp"
    },
    "sql-local": {
      "type": "stdio",
      "command": "dab",
      "args": ["start", "--mcp-stdio", "role:reader", "--config", "dab-config.json"]
    }
  }
}
Spot the bug

A shared MCP configuration

Exam skills 1.4.5

Find the lines that should not be committed in this team's .vscode/mcp.json.

Log in to try this activity Interactive activities are free with an account.

SQL Server and Azure SQL

For SQL Server, Azure SQL Database, Azure SQL Managed Instance and SQL database in Fabric, there are two common paths. SQL MCP Server runs with dab start, serving streamable HTTP at /mcp by default, or with dab start --mcp-stdio for a local stdio server, where an optional role:name selects the DAB role (anonymous by default). Hosted instances, for example in Azure Container Apps, authenticate callers with Microsoft Entra ID and connect to the database with a managed identity. The MSSQL extension for VS Code also gives Copilot agent tools for a connected database, using the extension's connection and the developer's identity.

True or false

SQL MCP Server hosting

Exam skills 1.4.5

Decide whether each statement about running SQL MCP Server is true.

Log in to try this activity Interactive activities are free with an account.

Fabric lakehouse

A Fabric lakehouse stores Delta tables in OneLake and automatically provides a SQL analytics endpoint, a read-only T-SQL endpoint over those tables. An agent reaches lakehouse data by connecting a SQL-capable MCP server to that endpoint's connection string with Microsoft Entra authentication, which gives read-only access governed by the identity's workspace role and item permissions. Microsoft also provides Fabric MCP servers for working with Fabric itself, such as workspaces and items; the remote Fabric MCP server is in preview. Writes to lakehouse tables happen through Spark notebooks or pipelines, not through the SQL analytics endpoint.

Worked example

One agent, two data sources

An analyst's agent must look up current orders in an Azure SQL database through approved entities and read historical sales from Delta tables in a Fabric lakehouse. Both connections must use Microsoft Entra identities, and the agent must not be able to change lakehouse data. How should the MCP connections be configured?

Configure two servers in the client: a SQL MCP Server (DAB) instance over the Azure SQL database with entities and permissions for the approved data, and an MCP server connected to the lakehouse's SQL analytics endpoint with the analyst's Entra identity. The SQL analytics endpoint is read-only, so lakehouse data cannot be modified through it, and DAB limits the database to its configured entities. Connecting with a SQL login would violate the identity requirement.

Check yourself

Can an agent update Delta tables through a lakehouse's SQL analytics endpoint?

Show answer

No. The SQL analytics endpoint is read-only; writes go through Spark or pipelines.

Exam Tips

Remember for the exam

  • Client configuration: a servers list with stdio commands or HTTP URLs; secrets from inputs or environment.
  • SQL MCP Server: dab start (HTTP /mcp) or dab start --mcp-stdio.
  • Lakehouse data through SQL: the read-only SQL analytics endpoint.
  • Use Microsoft Entra identities with least-privilege roles for every MCP connection.