Labsco
MCP SERVER

MSSQL MCP Server

by c0h1b4

Query Microsoft SQL Server from an assistant, list its databases and tables, and read a table's full schema.

Relational SQL Databases
Summary
describe_table returns the parts of a schema you actually need to write correct SQL.

Columns are the easy half; foreign keys, indexes and triggers are what tell you whether a join is cheap and whether an insert has side effects, and they all come back in one call. Dangerous statements — DROP, TRUNCATE, ALTER, EXEC and the like — are blocked before they reach the server, so the useful default is read work.

What it is

A SQL Server client over MCP. It runs parameterised queries against a connection built from environment variables, and exposes the catalogue — databases, tables, and a table's columns, indexes, keys and triggers.

What you get
  • query — run SQL with named parameters, optionally against a different database, with a per-call timeout; results come back as result sets with rows, rows affected and column metadata
  • list_databases — the databases on the server, with size, owner, creation date and state, filterable with a LIKE pattern
  • list_tables — the tables in a database and schema, with row counts and modification dates, filterable
  • describe_table — columns with types, nullability, defaults, primary keys and identity, plus indexes, foreign keys and triggers
  • Named error codes to branch on, including INVALID_QUERY, PARAMETER_MISMATCH, DATABASE_NOT_FOUND, PERMISSION_DENIED and TIMEOUT
Requirements

Install from npm as mssql-mcp-server. Connection details go in the client config, either as MSSQL_CONNECTION_STRING or as the individual parts — MSSQL_HOST, MSSQL_PORT, MSSQL_DATABASE, MSSQL_USER, MSSQL_PASSWORD, with MSSQL_ENCRYPT and MSSQL_TRUST_SERVER_CERTIFICATE for TLS. Pool size, query timeout and debug logging have their own variables.

Setup effort

One command plus a key — npm install mssql-mcp-server, then supply credentials