MSSQL MCP Server is configured entirely through environment variables. The server itself reads no config files — every setting is consumed from the process environment at startup. The correct place to supply these variables is theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/A-Point-Systems-ltd/ms-sql-mcp/llms.txt
Use this file to discover all available pages before exploring further.
env block of your MCP client’s JSON configuration, which scopes them to the server process only and avoids exposing credentials machine-wide.
Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
CONNECTION_STRING | Yes | — | ADO.NET connection string for the target SQL Server or Azure SQL Database instance. Validated for presence and tested with a live connection before the MCP transport starts. Process exits with code 1 if unset or if the connection fails. |
USE_INSIGHTS_LAYER | No | enabled | Opt-out switch for the AI Insights cache layer. Set to false, 0, no, off, or disabled to disable. Any other value — including leaving the variable unset — leaves the layer enabled. |
INSIGHTS_AUTOPOPULATE | No | enabled | Opt-out switch for automatic baseline insight generation. When enabled (and USE_INSIGHTS_LAYER is also enabled), the server auto-creates mechanical baseline insights and attaches enrichment directives during introspection calls. Set to any falsey value to disable auto-population while keeping the layer itself active. |
LOG_FILE_PATH | No | %LOCALAPPDATA%\MssqlMcp\Logs\ (Windows) or ~/.local/share/MssqlMcp/Logs/ (Linux/macOS) | Full path to a log file, or a path to a directory. When a directory is given (or the value ends with a path separator), the server creates a timestamped file named mssql-mcp-<yyyy-MM-dd-HHmmss>.log inside it. |
Connection string examples
CONNECTION_STRING inside the env block of your MCP client config. See the Quickstart for a full example config block.
Insights layer interaction
When bothUSE_INSIGHTS_LAYER and INSIGHTS_AUTOPOPULATE are enabled — which is the default when neither variable is set — the server activates a set of derived behaviors. There are no separate environment variables for these; they are all controlled by the two flags above:
- Baseline row-count probing — lightweight metadata queries run during introspection to populate mechanical baselines.
- Baseline refresh during DDL scans — when the background
InsightDdlProcessingQueueprocesses DDL audit rows, it rebuilds baselines for any objects whose insights were archived due to schema changes. insightEnrichmentresponse directives — baseline insight rows setenrichmentSuggested: trueand include a pre-filledUpsertInsightpayload that MCP-aware agents can use to upgrade the baseline to a richer, LLM-authored insight (protocolMCP-Insight-Enrichment-v1).
USE_INSIGHTS_LAYER is disabled, all eight insight tools return errors or empty status, and introspection tools (DescribeTable, DescribeView, GetObject) skip insight enrichment entirely. When USE_INSIGHTS_LAYER is enabled but INSIGHTS_AUTOPOPULATE is disabled, the layer is active and insights can be read and written manually, but the server will not auto-generate baselines during introspection.
Log file
The log file is written by the server process itself — independently of the MCP transport — so diagnostics are available even when the server exits before the handshake completes. Each log entry is timestamped and the file contains:- Process ID, working directory, app base directory, .NET version, OS version, machine name, and user
- The connection string with password fields masked (
Password=***MASKED***,Pwd=***MASKED***) - Result of the startup SQL connection test (server name, database name, or error message and stack trace)
- MCP host build and startup milestones
- Fatal errors and stack traces on unhandled exceptions
- Exit code on process termination