Skip to main content

Documentation 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.

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 the 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

VariableRequiredDefaultDescription
CONNECTION_STRINGYesADO.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_LAYERNoenabledOpt-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_AUTOPOPULATENoenabledOpt-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_PATHNo%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

Server=.;Database=MyDb;Trusted_Connection=True;TrustServerCertificate=True
These strings are passed as the value of CONNECTION_STRING inside the env block of your MCP client config. See the Quickstart for a full example config block.

Insights layer interaction

When both USE_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 InsightDdlProcessingQueue processes DDL audit rows, it rebuilds baselines for any objects whose insights were archived due to schema changes.
  • insightEnrichment response directives — baseline insight rows set enrichmentSuggested: true and include a pre-filled UpsertInsight payload that MCP-aware agents can use to upgrade the baseline to a richer, LLM-authored insight (protocol MCP-Insight-Enrichment-v1).
When 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
Password fields in the connection string are masked in logs, but all other parts — server name, database name, user ID, authentication mode — are logged in plain text. Prefer Windows Authentication or Azure Entra ID to avoid storing passwords anywhere. Never commit real credentials to your repository. Store CONNECTION_STRING only in the MCP client config env block, which is local to your machine.

Build docs developers (and LLMs) love