mcp-sql-multi
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-sql-multilist databases"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-sql-multi
One MCP server that fronts several SQL Server / Azure SQL / Synapse databases
at once. Each tool takes a database argument naming a target declared in
connections.json; call list_databases first to see what's available.
Tools
Tool | Purpose |
| List configured targets (name, server, database, read-only). |
| List base tables in a target (optional schema filter). |
| Columns, types, lengths, nullability for a table. |
| Run a query, return up to 1000 rows as JSON (writes blocked on read-only targets). |
Related MCP server: mssql-explorer-mcp
Prerequisites
Python 3.10+
Microsoft ODBC Driver 18 for SQL Server — install from https://learn.microsoft.com/sql/connect/odbc/download-odbc-driver-for-sql-server (the connection strings use
DRIVER={ODBC Driver 18 for SQL Server}).Network access / firewall allowance to each database server.
Setup (step by step)
1. Install
git clone https://github.com/rajivdatta/mcp-sql-multi.git
cd mcp-sql-multi
python -m venv .venv
.venv\Scripts\activate # Windows (source .venv/bin/activate on macOS/Linux)
pip install -r requirements.txt2. Define your databases (connections.json)
Copy the example and edit it:
copy connections.example.json connections.jsonconnections.json is git-ignored (it holds your server names and logins).
Each top-level key is a target name you'll pass to the tools. Example:
{
"dev": {
"server": "your-dev.database.windows.net", // host
"port": 1433,
"database": "YourDevDb",
"auth": "sql", // see auth modes below
"user": "your_login",
"password_env": "DEV_PASSWORD", // env var holding the password
"trust_cert": true,
"readonly": false
},
"prod": {
"server": "your-prod.database.windows.net",
"port": 1433,
"database": "YourProdDb",
"auth": "aad-broker", // Windows WAM broker, silent after first sign-in, no secret
"trust_cert": false,
"readonly": true
}
}Per-target field reference
Field | Required | Notes |
| yes | Hostname (e.g. |
| optional | Defaults to |
| yes | Database/pool name. |
| yes | One of the auth modes below. |
| for | SQL login name. |
| for | Name of an env var holding the password (never the password itself). |
| for | App id + env var holding its secret. |
| optional |
|
| optional |
|
Auth modes (auth)
Value | Use | Needs |
| SQL login |
|
| Entra via the Windows WAM broker; signs in once, then silently reuses the OS-cached token on every later start (recommended for prod/Synapse) | nothing — no secret stored; needs |
| Azure AD via your signed-in Windows/Entra identity (silent SSO) | nothing — no secret stored |
| Azure AD with a browser sign-in popup (every new process) | nothing |
| Azure AD app/service principal |
|
Tip: mark prod or shared targets "readonly": true.
3. Supply passwords (.env)
Only needed for sql targets. Copy .env.example to .env and set each
variable you referenced via password_env:
DEV_PASSWORD=your-dev-sql-password.env is git-ignored. aad-broker / aad-integrated / aad-interactive
targets need no secret here.
4. Test a connection standalone
.venv\Scripts\activate
python -c "import db; print(db.list_targets())" # config loads, targets listed
python -c "import server; print(server.list_tables('dev','dbo'))" # real query against 'dev'aad-broker targets sign in once via the Windows WAM broker, then connect
silently on later runs; aad-interactive targets pop a browser sign-in on the
first query of every new process.
5. Register with your MCP host
See examples/mcp.json — point command at the venv's
Python and args at server.py. Keep passwords in this folder's .env, not
in the host's env block: host config files are routinely pasted into issues and
chat threads when troubleshooting, and a secret in one leaks with it.
{
"mcpServers": {
"sql-multi": {
"command": "C:\\path\\to\\mcp-sql-multi\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\mcp-sql-multi\\server.py"],
"env": {}
}
}
}Restart your MCP client, then try: "using sql-multi, list databases" → "list tables in dev".
Use with Claude Desktop
Claude Desktop reads its MCP servers from
claude_desktop_config.json. Open it from Settings → Developer → Edit Config
(this creates the file if it doesn't exist), or edit it directly:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add this server under mcpServers, using absolute paths to the venv's
Python and server.py (passwords stay in .env, never in env):
{
"mcpServers": {
"sql-multi": {
"command": "C:\\path\\to\\mcp-sql-multi\\.venv\\Scripts\\python.exe",
"args": ["C:\\path\\to\\mcp-sql-multi\\server.py"],
"env": {}
}
}
}On macOS the paths are POSIX, e.g. "command": "/Users/you/mcp-sql-multi/.venv/bin/python".
Save the file and fully quit and reopen Claude Desktop (use Quit from the
tray/menu-bar icon — closing the window isn't enough). The server's tools then
appear in the tools (🔌) menu of a new chat.
Safety
The readonly flag is a typo-catcher, not the security boundary. The real
boundary is the permission set of the login behind each target. A keyword
blocklist alone is bypassable — SELECT ... INTO t creates a table without using
a blocked keyword, and T-SQL lets a stored procedure be invoked as the first
statement of a batch with no EXEC at all. So:
Back every read-only target with a read-only principal (
db_datareader, or an explicitCONNECT+SELECTgrant and nothing more). If the login can write, the target can be written to eventually, whatever this server does.In-server enforcement on read-only targets is two layers, applied after comments are stripped and string literals are blanked (so a keyword appearing in data no longer causes a false refusal):
a blocklist of mutating/escalating/locking constructs — including
INTO,sp_*/xp_*,OPENROWSET,WAITFORand the lock hints; andan allowlist requiring every statement to open with
SELECT,WITH,DECLARE,SETorPRINT, so unanticipated syntax is refused by default rather than permitted by omission.
Results capped at 1000 rows, and a truncated result is labelled as such — do not total or summarise a result carrying that warning.
60-second query timeout.
Connections use
Encrypt=yes. Leavetrust_certatfalsefor Azure SQL (it presents a valid certificate);trueskips certificate validation and should be reserved for genuinely self-signed dev servers.connections.jsonand.envare git-ignored, so server names, logins, and passwords are never committed.
License
MIT (c) 2026 Rajiv Datta
This server cannot be deployed
Maintenance
Related MCP Connectors
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Paid remote MCP for governed database query review, SQL simulation, approvals, and audits.
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- FlicenseAqualityDmaintenanceAn MCP server for Microsoft SQL Server that enables executing read-only queries, listing tables, and describing database schemas. It offers specialized support for custom ports and multiple authentication methods including SQL credentials, NTLM, and Windows Integrated Auth.3-
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server for exploring on-premises, multi-instance Microsoft SQL Server estates from AI clients, with read-only enforcement and Windows authentication support.Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables read-only SQL querying and schema inspection across MSSQL, PostgreSQL, and MySQL databases via MCP tools.ISC
- AlicenseAqualityCmaintenanceEnables MCP clients to securely query databases, list tables, inspect table schemas, and test connections across Oracle, SQL Server, MySQL, PostgreSQL, and SQLite using read-only SQL tools.4MIT