Lesson 1 of 2 Model Context Protocol for SQL

Model Context Protocol Concepts

This lesson explains MCP hosts, clients, servers and tools, the two transports, and how SQL MCP Server exposes databases safely.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe how MCP clients discover and call server tools.
  • Distinguish between the stdio and streamable HTTP transports.
  • Explain how SQL MCP Server differs from a generic SQL execution tool.

Clients, servers and tools

An MCP host, such as VS Code with GitHub Copilot, runs an MCP client for each configured MCP server. When a session starts, the client asks each server for its capabilities and its list of tools; each tool has a name, a description and a JSON schema for its inputs. During a conversation, the model decides to call a tool, the client sends the call to the server (after the user approves it), and the server returns the result, which goes back to the model. Servers can also expose resources and prompts, but tools are the main way agents act on data.

Put in order

An MCP tool call

Exam skills 1.4.3 · 1.4.5

Put the steps of an MCP tool call in order.

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

Transports

MCP messages use JSON-RPC over one of two transports, compared in the following table.

stdio
How it runsThe client starts the server as a local process and talks over standard input and output
Typical useLocal development tools and CLIs
AuthenticationInherits the local user's environment
Choose when A tool installed on the developer's machine
Streamable HTTP
How it runsThe server runs as a web service at a URL, such as https://host/mcp
Typical useShared, hosted or remote servers
AuthenticationHTTP authentication such as Microsoft Entra bearer tokens
Choose when A server shared by a team or hosted in Azure
Sort into groups

stdio or Streamable HTTP?

Exam skills 1.4.5

Choose the MCP transport for each situation.

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

Database MCP servers and safety

A database MCP server decides what an agent can do. Some servers expose a generic tool that runs any SQL the model writes, which is flexible but risky because the model's SQL is non-deterministic and can be wrong or destructive. SQL MCP Server, part of Data API builder from version 1.7, takes a different approach: it intentionally does not run free-form SQL. It exposes only the tables, views and stored procedures listed in the DAB configuration through a fixed set of DML tools, and DAB's query builder generates the T-SQL deterministically under the configured role permissions, field restrictions and policies. Its tools are describe_entities, read_records, create_record, update_record, delete_record, execute_entity and aggregate_records, and stored procedures can be registered as named custom tools.

The following diagram contrasts a generic SQL tool with SQL MCP Server.

Two designs for a database MCP server. A generic server exposes a tool that runs any SQL the model writes, which is flexible but risky, because the model's SQL is non-deterministic and can be wrong or destructive. SQL MCP Server in Data API builder does not run free-form SQL: it exposes only the tables, views and stored procedures in the DAB configuration through fixed tools, and DAB generates the T-SQL deterministically under the configured roles, field restrictions and policies.
Deterministic tools keep agents inside configured permissions.
Match the pairs

SQL MCP Server tools

Exam skills 1.4.5 · 2.1.8

Match each SQL MCP Server tool with what it does.

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

Choosing a server design

A company wants a support agent to look up orders and create return requests in an Azure SQL database. Security requires that the agent can read only three views and call one procedure, and that it can never run arbitrary SQL. Which MCP approach meets the requirement?

Use SQL MCP Server in Data API builder with entities for the three views and the procedure only, permissions for the agent's role limited to read on the views and execute on the procedure, and the create, update and delete tools disabled. The agent can call only the generated tools, which never accept free-form SQL. A generic SQL-execution MCP server would let the model run any statement the login permits, so the restriction would depend entirely on database permissions and the model's behaviour.

Check yourself

Does SQL MCP Server let an agent run any SQL statement it writes?

Show answer

No. It exposes only configured entities through fixed DML tools and generates the T-SQL itself under DAB's permissions.

Exam Tips

Remember for the exam

  • MCP: clients discover and call server tools described by JSON schemas.
  • Local process: stdio; shared or hosted server: streamable HTTP.
  • SQL MCP Server (DAB 2.0 and later) exposes configured entities only and does not run free-form SQL.
  • Tool calls are approved by the user and governed by the server's permissions.