mssql-mcp
This is a read-only Microsoft SQL Server MCP server that connects via AWS Secrets Manager credentials, enabling safe database exploration and querying without exposing credentials in config files. It runs cross-platform (macOS, Linux, Windows) with no native or ODBC dependencies.
Schema Discovery
list_schemas— List all user-defined schemas in the databaselist_tables— List tables, optionally filtered by schemadescribe_table— Inspect columns, data types, nullability, identity flags, primary keys, and defaultslist_indexes— View indexes on a table (one row per index/column combination)list_foreign_keys— View foreign key relationships originating from a table
View & Procedure Inspection
list_views— List views, optionally filtered by schemaget_view_definition— Retrieve the SQL source of a viewlist_procedures— List stored procedures, optionally filtered by schemaget_procedure_definition— Retrieve the SQL source of a stored procedure (does not execute it)
Data Querying
sample_rows— Preview up to 100 rows from any table (default: 10)run_select— Execute a customSELECTorWITH(CTE) query, capped at 1000 rows; DML/DDL/EXEC statements are strictly rejected
Credential Management
refresh_secret— Re-fetch credentials from AWS Secrets Manager and reconnect, useful after an SSO session expires or a secret is rotated — no server restart needed
Enables the MCP server to retrieve SQL Server connection secrets from AWS Secrets Manager, supporting read-only database exploration and querying.
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., "@mssql-mcp list all tables in the database"
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.
mssql-mcp
A read-only Microsoft SQL Server MCP server using connection details from AWS Secrets Manager at tool-call time — nothing is read from disk or environment variables except the secret reference itself.
This is a light-weight mcp meant for local development use. It avoids database credentials in your agent config, works nicely with a credential process and tools like aws-vault, and allows for readonly database access and schema discovery.
Cross-platform: it's a pure-JavaScript MCP server (no native or ODBC
dependencies), so it runs identically on macOS, Linux, and Windows via
npx.
Configure in .claude.json
{
"mcpServers": {
"my-db": {
"command": "npx",
"args": ["-y", "@dhipskind253/mssql-mcp"],
"env": {
"AWS_ACCOUNT_ID": "123456789012",
"SECRET_NAME": "my-aws-secret",
"AWS_REGION": "us-east-1",
"TRUST_SERVER_CERTIFICATE": "false"
}
}
}
}Env var | Required | Default | Description |
| yes | — | The AWS account where the secret lives. Combined with name + region into a full ARN. |
| yes | — | The Secrets Manager secret name (no ARN suffix needed). |
| yes | — | AWS region the secret is in (e.g. |
| no |
| Skip TLS cert validation to the SQL Server. Accepts |
Standard AWS SDK env vars (AWS_PROFILE, AWS_ACCESS_KEY_ID, etc.) are
honored via the default credential provider chain. Most users just need
aws sso login to be current.
Related MCP server: MSSQL MCP Python Server
Required secret JSON
The secret value must be a JSON document with at least these fields:
{
"host": "myserver.database.windows.net",
"port": 1433,
"database": "mydb",
"username": "ro_user",
"password": "..."
}database may also be supplied as dbname — the field name AWS uses
in its built-in RDS-credentials secret template. If both are present,
database wins.
Optional fields (with defaults shown):
Field | Default | Notes |
|
| |
|
| TLS to the server. |
TLS cert trust is not read from the secret — set
TRUST_SERVER_CERTIFICATEin the MCP server'senvblock instead. AnytrustServerCertificatefield in the secret JSON is ignored.
Read-only by design
This server cannot insert, update, or delete data. Two layers enforce that:
The
run_selecttool lexically rejects anything that isn't a singleSELECTorWITH(CTE) statement — includingINSERT,UPDATE,DELETE,EXEC,MERGE,DROP,ALTER,SELECT INTO, etc.No other tool emits write SQL.
get_procedure_definitionreturns procedure source — it does not run procedures.
Courtesy note: treat the lexical check as UX, not a security boundary. As a courtesy to your future self, configure the credentials you put in Secrets Manager to be a read-only database login — one with
SELECTandVIEW DEFINITIONonly. That way an accidental write (or a future bug here) is rejected by SQL Server itself.
Refreshing AWS credentials without restarting
Because the server uses the default AWS credential chain, an expired SSO session can be recovered without restarting Claude or the MCP server:
Run
aws sso loginin any terminal.Ask Claude to call the
refresh_secrettool.Continue working.
If a tool call fails because of AWS auth, the error message will tell you exactly that and prompt the same flow. Errors are tagged with stable prefixes:
Prefix | Meaning |
| SSO session expired or no credentials available. |
| Principal lacks |
| Secret name / account / region mismatch. |
| Secret JSON is missing fields or malformed. |
| Could not reach the SQL Server instance. |
| SQL Server returned an error executing the query. |
| The submitted query violated the read-only rules. |
Tools
Tool | Purpose |
| User schemas in the database. |
| Tables, optionally filtered by schema. |
| Columns, types, nullability, identity, PK, defaults. |
| Indexes on a table (one row per index/column). |
| Outgoing FKs from a table. |
| Views, optionally filtered by schema. |
| View source SQL. |
| Stored procedures, optionally filtered by schema. |
| Procedure source SQL (does not execute). |
|
|
| Single SELECT/CTE, capped at |
| Re-fetch the secret and reconnect. |
Local development
npm install
npm run build
# point your .claude.json command at the local build:
# "command": "node",
# "args": ["/absolute/path/to/mssql-mcp/dist/index.js"]Available Tools
12 toolsdescribe_tableA
Return columns, data types, nullability, identity, primary key, and defaults for a table.
Inputs: schema (required), table (required).
get_procedure_definitionA
Return the SQL definition of a stored procedure. (Definitions are read-only — this server cannot EXEC procedures.)
Inputs: schema (required), procedure (required).
get_view_definitionC
Return the SQL definition of a view.
Inputs: schema (required), view (required).
list_foreign_keysC
List foreign keys originating from a table.
Inputs: schema (required), table (required).
list_indexesB
List indexes on a table, one row per (index, column).
Inputs: schema (required), table (required).
list_proceduresB
List stored procedures, optionally filtered by schema.
Inputs: schema.
list_schemasA
List user-defined schemas in the configured database.
Inputs: no named parameters.
list_tablesB
List tables, optionally filtered by schema.
Inputs: schema.
list_viewsC
List views, optionally filtered by schema.
Inputs: schema.
refresh_secretA
Re-fetch the database credentials from AWS Secrets Manager and reconnect. Call this after running aws sso login to recover from an expired session, or after the secret has been rotated.
Inputs: no named parameters.
run_selectA
Run a single SELECT or WITH (CTE) statement. DML/DDL/EXEC are rejected before reaching the server. Results are capped at max_rows (default 100, hard max 1000).
Inputs: query (required), max_rows.
sample_rowsA
Return up to N rows from a table (SELECT TOP N *). Default 10, max 100.
Inputs: schema (required), table (required), n.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool has a clearly distinct purpose: listing metadata (tables, views, schemas, procedures, indexes, foreign keys), retrieving definitions, running SELECT queries, sampling rows, and refreshing credentials. No two tools can be confused.
All tool names follow a consistent verb_noun pattern in snake_case, e.g., 'describe_table', 'list_procedures', 'run_select'. There are no deviations or mixed conventions.
12 tools is appropriate for a database exploration and querying server. The set covers all common operations without being excessive or sparse.
The tool surface is nearly complete for read-only database interaction: metadata listing, definition retrieval, SELECT querying, and sampling. Minor gaps include absence of database-level listing or system views, but the core use case is well-covered.
Maintenance
Related MCP Connectors
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Official Microsoft MCP Server to query Microsoft Entra data using natural language
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceRead-only SQL Server MCP server enabling safe database queries, table listing, and schema inspection with built-in security protections.MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for safely exposing SQL Server database capabilities to LLM clients, with read-only mode, security features, and observability.29MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Microsoft SQL Server enabling safe read-only queries, schema discovery, and natural-language query via LangChain.MIT
- AlicenseAqualityCmaintenanceSecurity-first, read-only MCP server for Microsoft SQL Server, enabling safe natural-language querying of databases.59 npmMIT