lucagdeluca.com
← writing
article12 min read

How to connect Claude Code to the Microsoft Fabric SQL MCP server

A step-by-step setup of Fabric's remote SQL MCP server in Claude Code, from the Entra app registration to the first query, tested on six questions about my own chess games.

  • Data engineering
  • Microsoft Fabric

Microsoft Fabric now has a remote MCP server for SQL, in preview, that lets an AI assistant query a warehouse or a lakehouse directly. Microsoft's docs show it with VS Code. I wanted to know how it works from Claude Code in a terminal: what the setup takes, what the assistant actually sends, and where it needs help.

To judge the answers I needed data I already knew, so I used my chess.com history, the same games behind a dashboard I built a few weeks ago. This post walks through the setup step by step, then shows how Claude works with a server that has a single tool.

Before you start: you need a Fabric capacity (a trial or any F SKU), a workspace you're admin of, Claude Code, and the right to register an app in Microsoft Entra. I used a small F2.

What I built

Fabric workspace chess-labchess.com APIpublic, no keyNotebookone PySpark cellLakehousetable dbo.gamesSQL endpointread-only T-SQLSQL MCP servertool: executeSQLClaude Codein my terminalT-SQL in, rows back, signed in as me
The setup: six parts, one Fabric workspace.

A notebook pulls the games from chess.com into a lakehouse table. Claude Code never touches the lakehouse itself: it sends T-SQL through Fabric's MCP server to the read-only SQL endpoint, signed in with my own Microsoft account.

The SQL MCP server in one minute

In short, the server gives Claude a way into the SQL endpoint, and Claude does the translating. It first queries the schema and metadata to learn which tables and columns exist, then turns each plain-English question into T-SQL, runs it, and answers from the rows that come back. The server itself doesn't interpret anything: it runs the queries Claude writes, as you.

Fabric's remote MCP servers are endpoints an AI client connects to over HTTP. The SQL one is the one that reads data:

  • One tool, executeSQL. It runs a T-SQL query and returns the rows. There's no schema browser and no list of tables.
  • One item per address. The URL names a workspace and one warehouse or SQL analytics endpoint, so a connection only sees that item.
  • Your own identity. You sign in with your Microsoft account through Entra, and every query runs with your permissions.
  • Read-only on a lakehouse. A lakehouse SQL analytics endpoint can't change data, so it's a safe first target.

It's separate from the Fabric Core MCP server, which manages workspaces and items but doesn't query them.

Step 1: a workspace and a lakehouse

In Fabric I created a workspace called chess-lab and assigned it to my capacity. Inside it, I created a lakehouse called chess, with schemas enabled.

The chess-lab workspace: the chess lakehouse, its SQL analytics endpoint and the load-games notebook

Creating the lakehouse also creates its SQL analytics endpoint, with the same name. That endpoint is what we'll point Claude at later. It's a read-only T-SQL view over the lakehouse tables, so nothing on the Claude side can change the data.

The SQL analytics endpoint, with the games table under dbo

I chose a lakehouse over a warehouse on purpose. The data arrives through a notebook, which writes Delta tables into a lakehouse by default, and the SQL endpoint comes for free.

Step 2: something to query

Any table works. I loaded my games with one PySpark cell in a notebook attached to the lakehouse, calling chess.com's free public API. It's the dashboard's extract, ported to Python.

import requests, datetime as dt
from zoneinfo import ZoneInfo

USER = "lucagdeluca"
H = {"User-Agent": "chess-lab-fabric-demo"}

# Every monthly archive, then every standard chess game in them, oldest first
archives = requests.get(f"https://api.chess.com/pub/player/{USER}/games/archives", headers=H).json()["archives"]
games = [g for url in archives for g in requests.get(url, headers=H).json().get("games", []) if g.get("rules") == "chess"]
games.sort(key=lambda g: g["end_time"])

# Hours in my local time: Brazil before the move, Central European time after
MOVED = dt.datetime(2023, 9, 1, tzinfo=dt.timezone.utc).timestamp()
local = lambda ts: dt.datetime.fromtimestamp(ts, dt.timezone.utc).astimezone(
    ZoneInfo("America/Sao_Paulo" if ts < MOVED else "Europe/Zurich"))

DRAWS = {"agreed", "repetition", "stalemate", "insufficient", "50move", "timevsinsufficient"}
me = lambda g: "white" if g["white"]["username"].lower() == USER else "black"
them = lambda g: "black" if me(g) == "white" else "white"
outcome = lambda g: "win" if g[me(g)]["result"] == "win" else ("draw" if g[me(g)]["result"] in DRAWS else "loss")
ending = lambda g: g[them(g)]["result"] if outcome(g) == "win" else g[me(g)]["result"]
opening = lambda g: g.get("eco", "").rstrip("/").split("/")[-1].replace("-", " ")

rows = [dict(
    game_no=i + 1,
    month=local(g["end_time"]).strftime("%Y-%m"),
    weekday=local(g["end_time"]).strftime("%a"),
    hour=local(g["end_time"]).hour,
    time_class=g["time_class"],
    colour=me(g),
    result=outcome(g),
    ending=ending(g),
    opening=opening(g),
    rating=g[me(g)]["rating"],
    gap_hours=None if i == 0 else round((g["end_time"] - games[i - 1]["end_time"]) / 3600, 1),
) for i, g in enumerate(games)]

df = spark.createDataFrame(rows)
df.write.mode("overwrite").option("overwriteSchema", "true").saveAsTable("games")
display(df.groupBy("time_class", "result").count().orderBy("time_class", "result"))

The table has no opponents, game links or exact timestamps. Two columns matter later, because their meaning isn't obvious from the name: hour is already local time (Brazil before September 2023, Central European time after), and gap_hours, the time from the end of the previous game to the end of this one, is rounded to a tenth of an hour.

The Spark session started in 14 seconds and the cell ran in under a minute. The result: a games table with 6,858 rows, 5,703 of them blitz. It showed up in the SQL endpoint under dbo.games.

The notebook after the run: 9 Spark jobs succeeded, and games counted by time control and result

Step 3: register an app and add the server

The server's address is built from two IDs, both in the SQL endpoint's URL in the Fabric portal: the workspace ID and the endpoint's item ID.

https://api.fabric.microsoft.com/v1/mcp/dataPlane/workspaces/<workspace-id>/items/<sql-endpoint-id>/sqlEndpoint

Claude Code adds remote servers with claude mcp add, but it can't sign in to this one by itself. By default it tries to register itself with the server's sign-in provider, and Microsoft Entra doesn't allow that. So you register an app once and give Claude Code its ID.

  1. In the Microsoft Entra admin center, go to App registrations and create a new one. Single tenant is enough.
  2. Under Authentication, add a mobile and desktop platform with the redirect URI http://localhost:8765/callback.
  3. Under API permissions, add delegated Power BI Service permissions: Item.Read.All, Item.Execute.All, Workspace.Read.All, SQLEndpoint.Read.All and SQLEndpoint.Execute.All. None of them need admin consent.
  4. Copy the application (client) ID.

Then add the server, with the same port as the redirect:

claude mcp add --transport http --client-id <your-app-id> --callback-port 8765 fabric-chess https://api.fabric.microsoft.com/v1/mcp/dataPlane/workspaces/<workspace-id>/items/<sql-endpoint-id>/sqlEndpoint

Inside Claude Code, run /mcp, pick the server, choose Authenticate and sign in in the browser. The status turns to connected, with 1 tool.

fabric-chess in /mcp: connected, authenticated, 1 tool (IDs blurred)

Two tips from the first run:

  • Keep only one Fabric server enabled. I also had the Fabric Core server connected, and Claude started by listing my workspaces through it instead of querying the table.
  • Name the server in your first question. "Using the fabric-chess MCP server, …" sends Claude straight to the right tool instead of searching your files for config.

Step 4: how Claude works with one tool

From here it's conversation. Each time Claude wants to run a query, Claude Code shows the executeSQL call and asks for approval, so nothing reaches Fabric without you seeing it. I asked six questions about data I knew well, which made a wrong answer easy to spot.

Discovering the schema

My first question was "What's in the games table?". With no schema tool, Claude looked the columns up with SQL first, then summarised: 6,858 rows at game grain, January 2018 to November 2026, 11 columns. It also noticed something I hadn't asked about, that only 84 of the 107 months have games. Expect this round trip at the start of each new conversation. It's the price of a single tool.

Claude's overview of dbo.games

Reading the T-SQL it sends

For "How did my blitz rating change year by year, and when did I peak?", I pressed ctrl+o to open the detailed view. It shows the exact T-SQL Claude sent through the server and the rows Fabric sent back. That's the part to read when you try this on your own data, because it tells you whether an answer comes from a real aggregate or from a guess.

The detailed view: the T-SQL Claude sent through fabric-chess and the rows Fabric sent back (IDs blurred)

4006008001000120014002018: low 321, high 996, ended at 996, 475 blitz games2018475 games2019: low 940, high 1078, ended at 940, 342 blitz games2019342 games2020: low 934, high 1018, ended at 991, 28 blitz games202028 games2021: low 839, high 1170, ended at 1101, 1,409 blitz games20211,409 games2022: low 1074, high 1106, ended at 1074, 7 blitz games20227 games2023: low 1008, high 1229, ended at 1200, 767 blitz games2023767 games2024: low 916, high 1224, ended at 1147, 1,206 blitz games20241,206 games2025: low 1045, high 1267, ended at 1127, 862 blitz games2025862 games2026: low 1007, high 1342, ended at 1260, 607 blitz games2026607 games1342 peak
Blitz rating by year, from the rows Claude got back. Each line runs from the year's lowest to highest rating; the dot is where the year ended.

Charted from those rows: a peak of 1342 in September 2026. In 2021, my busiest year with 1,409 blitz games, I gained only about 90 points.

Turning a vague question into SQL

"Do I play worse late at night?" has no column to look up. Claude made its own time-of-day buckets from hour, said which hours each one covers, and then broke out single hours where a bucket hid something.

Late night turned out fine. The weak spot was 8 to 9am: 43.3% over 501 games, against 56.5% at midnight. Claude added a caveat I liked: matchmaking pushes every win rate towards 50%, so gaps like these understate the real effect.

Because the dashboard had already shown me 56% after midnight and 48% in the morning, I could check the answer. It matched, and went one level finer than the dashboard does.

Claude's answer on win rate by hour

When the data can't answer the question as asked

I asked: "After a loss, if I start the next game within 5 minutes, does my win rate drop?" gap_hours is rounded to 0.1 hours, so a 5-minute cut isn't possible. Claude said so before answering, and used 0.0 hours (about 3 minutes or less) as "instant" instead. That's the behaviour you want from an assistant that only sees column names.

The answer: after a loss, the "instant" next game won 40.4% of the time (213 games), against about 49% otherwise. It looked like proof of tilt, until a second look showed a catch that neither Claude nor I had seen. gap_hours runs from the end of one game to the end of the next, so it includes the length of the next game. "Instant" really means "the next game was over within about 3 minutes", which mixes quick requeues with short games. So it's a hint of tilt, not proof. Measuring it properly needs a start-time column, which chess.com's PGN headers provide.

Claude's tilt check

Follow-ups are just more queries

The last two questions, on openings and on whether moving from Brazil to Europe in 2023 changed anything, each took a few executeSQL calls and no new setup. The short versions: the Scandinavian is my best defence as black (58.0% over 1,645 games), and the move changed when I play, not how well. The 8 to 9am slump shows up in both countries.

Claude's answer on the move: blitz win rate by time of day, Brazil against Europe

What I'd tell you before you try it

  • It's a preview, and it shows. The SQL server has one tool, executeSQL. There's no schema tool, so Claude spends its first query or two working out your columns.
  • Your column names are your documentation. Claude guessed most meanings right, but it couldn't know that hour was already local time or how gap_hours was measured. It flagged the rounding, but not that the gap includes the next game's length, and I'd forgotten that myself. A short description per column would have caught both.
  • Read-only is a feature. The lakehouse SQL endpoint can't change data, so letting an assistant loose on it is low risk.
  • Approve every call, at least at first. Seeing each T-SQL query before it runs is how you learn what the assistant is actually doing with your data.

The setup is one app registration and one command. After that, a Fabric table becomes something you can question in plain English, with every query visible before it runs. For my chess, the clearest answer was: don't play blitz at 8am. Your own data will have its own questions.