AI assistants
SQL Server MCP server

SQL Server MCP server

Connect Claude, ChatGPT or Claude Code to Microsoft SQL Server over MCP (Model Context Protocol), without putting a connection string on anyone's laptop. The assistant reads the schema, writes SQL and runs it, and Thunderduck checks every query before it reaches SQL Server.

The problem: an assistant with a connection string

The usual way to give an assistant SQL Server is a local MCP server started with a connection string. It works on day one, and it leaves you with three problems once the database is a real one:

  • The credential lives in a config file on every machine that uses it, usually a login with more rights than the assistant needs.
  • Nothing checks the cost of a query. An assistant exploring a table it does not know will happily run a SELECT * or an unfiltered join against the production database your application depends on.
  • The assistant only sees names and types. Amt could include tax or not, and StatusID = 3 means nothing without the application code, so plausible SQL returns wrong numbers.

How Thunderduck solves it

Thunderduck runs a hosted MCP server in front of the database, at https://mcp.thunderduck.ai/mcp.

  • No connection string on any laptop. The SQL Server password goes to a secrets manager when you add the database. People sign in to the assistant with their own Thunderduck account (OAuth), and the assistant never sees the password.
  • Read-only, always. SQL Server catalogs cannot write. INSERT, UPDATE, DELETE and DDL are refused whatever the user's token allows.
  • Every query is priced before it runs. Thunderduck plans the SQL first and refuses it above the per-query or daily limit. See Scopes & costs.
  • Filters run in SQL Server. Filters and LIMIT are pushed down, so only matching rows leave the database. Each statement carries a comment naming the Thunderduck user, so you can find it in SQL Server's own logs.
  • Columns come with meanings. Thunderduck infers a description and a unit for each column and lets your team correct them. The assistant reads them before it writes SQL. See Column meanings.
  • One server for every database. The same connection reaches your PostgreSQL, MySQL, BigQuery and S3 data, and one query can join them with SQL Server.

Set it up

1. Create a read-only login

Run this in SQL Server. Change the database name and the password:

CREATE LOGIN thunderduck_ro WITH PASSWORD = '…';
USE shop;
CREATE USER thunderduck_ro FOR LOGIN thunderduck_ro;
ALTER ROLE db_datareader ADD MEMBER thunderduck_ro;

2. Add the database as a catalog

In the console, Catalogs → Create catalog → SQL Server. Give it a short lowercase name such as mssql, then enter the host, port (default 1433), database and the login from step 1. Encrypt is on by default.

With Encrypt on, the server needs a certificate signed by a public CA or by Amazon RDS. For a self-signed certificate, turn on Trust server certificate. The database must be reachable from Thunderduck: over the internet, or as a private RDS instance in the same VPC.

All fields are on the Oracle & SQL Server page.

3. Connect your assistant

Claude (claude.ai and Claude Desktop): Settings → Connectors → Add custom connector, paste the URL below, and sign in.

https://mcp.thunderduck.ai/mcp

Claude Code:

claude mcp add --transport http thunderduck https://mcp.thunderduck.ai/mcp \
  --client-id thunderduck-mcp-cli --callback-port 33418

ChatGPT: add a connector with the same URL.

More on each client in Connecting Claude & ChatGPT.

4. Ask a question

Which ten customers ordered the most this quarter, and how many orders did each place?

The assistant calls get_catalog_context('mssql') to read the tables, keys and column meanings, checks the price with estimate_query_cost, then runs something like:

SELECT c.CompanyName,
       count(*)      AS orders,
       sum(o.Total)  AS revenue
FROM   mssql.dbo.Orders    o
JOIN   mssql.dbo.Customers c ON c.CustomerID = o.CustomerID
WHERE  o.OrderDate >= DATE '2026-10-01'
GROUP  BY c.CompanyName
ORDER  BY revenue DESC
LIMIT  10;

Tables are addressed as catalog.schema.table, with dbo as the usual schema. The query is written in Thunderduck's SQL (DuckDB), not T-SQL, so it uses LIMIT rather than TOP. The date filter runs inside SQL Server.

What the assistant can do

List schemas, tables and columnsYes
Read column meanings, keys and joinsYes
Run SELECTYes, within the cost limits
Export a large result to Parquet or CSVOnly with the export scope
INSERT, UPDATE, DELETE, DDLNo: SQL Server catalogs are read-only

The full list is on the Tools page.

Good to know

  • LIKE is not pushed down. A LIKE filter runs in Thunderduck after the rows arrive, so combine it with a filter that is pushed, such as a date range.
  • Comparisons follow the database collation. SQL Server collations are usually case-insensitive, so 'a' = 'A' can match on the SQL Server side even though it would not in DuckDB.
  • At most 16 SQL Server tables in one query.

Compared with a local open-source server

Open-source SQL Server MCP servers run on your own machine with a connection string. For a local SQL Server, or a quick look at a dev database, that is the simpler choice: no account, nothing hosted, and T-SQL with nothing in between.

Thunderduck fits when the database is shared or in production: when more than one person will connect, when the password should not sit in config files, when queries need a cost check, or when the questions span SQL Server and your other databases.

Related