The first step for any problem is to check the log file. Before the MCP transport ever starts,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.
Program.cs writes a startup block containing the process ID, working directory, .NET version, a masked copy of the connection string, and the result of a live SQL connection test. Most failures — missing credentials, wrong server name, bad authentication — are recorded here with a FATAL: prefix and a full stack trace. If the log file exists and is empty after FATAL: lines, the process exited before the MCP handshake could begin.
Log file locations
| Scenario | Log location |
|---|---|
LOG_FILE_PATH set to a file path | That exact file |
LOG_FILE_PATH set to a directory path | A new mssql-mcp-{yyyy-MM-dd-HHmmss}.log inside that directory |
| Default (Windows) | %LOCALAPPDATA%\MssqlMcp\Logs\mssql-mcp-{yyyy-MM-dd-HHmmss}.log |
| Default (Linux/macOS) | ~/.local/share/MssqlMcp/Logs/mssql-mcp-{yyyy-MM-dd-HHmmss}.log |
Common failures
MCP error -32000: Connection closed
MCP error -32000: Connection closed
The MCP client received a transport-level close before the handshake completed. This always means the server process exited early. Open the log file and look for
FATAL: lines near the top.Common root causes:CONNECTION_STRINGnot set (process exits with code1immediately)- SQL connection test failed (bad server name, port, or credentials)
- The executable path in the MCP client config is wrong and the process never started
Exit code 1 immediately after startup
Exit code 1 immediately after startup
The server exits with code Fix: add
1 when CONNECTION_STRING is not present in the environment. The log will contain:CONNECTION_STRING to the env block of your MCP client configuration and restart the server.Connection test failed at startup
Connection test failed at startup
The server found a
CONNECTION_STRING value but could not open a connection to SQL Server. The log will contain a FATAL: SQL Server connection test FAILED: line with the exception message and stack trace.Steps to diagnose:- Copy the connection string and test it outside the MCP server using
sqlcmdor SQL Server Management Studio (SSMS) - Verify the server name or IP address is reachable from the machine running the MCP server
- Check that the database name exists
- For SQL logins, confirm the username and password are correct
- For Windows or Entra auth, confirm the account running the process has login rights on the SQL instance
- If
TrustServerCertificate=False, ensure the SQL Server certificate is trusted or flip toTruefor local development
InstallInsightsLayer permission error
InstallInsightsLayer permission error
Installing the AI Insights layer creates a database-level DDL trigger (
DDL_Audit), which requires elevated permissions. If the database user lacks those permissions, InstallInsightsLayer will return an error.Fix: grant the database user ALTER ANY DATABASE DDL TRIGGER, or assign the user to the ddl_admin fixed database role. If you have sysadmin access, you can also run the install as sysadmin and then downgrade the account afterward.ExecuteSQL rejects a SELECT statement
ExecuteSQL rejects a SELECT statement
This is by design.
ExecuteSQL is a write/destructive tool and the SqlStatementClassifier will reject any SELECT statement passed to it, returning a message directing you to use ReadData instead.Fix: use the ReadData tool for all queries that return rows — including queries against sys.*, INFORMATION_SCHEMA, DMVs, and user tables.Insight tools return "layer is disabled"
Insight tools return "layer is disabled"
The AI Insights tools return a disabled-layer error when
USE_INSIGHTS_LAYER is set to a falsey value (false, 0, no, off, or disabled).Fix: remove the USE_INSIGHTS_LAYER variable from your MCP env block (the default is enabled), or explicitly set it to true. Restart the MCP server after changing the environment variable — the flag is read once at startup.Hardware fields are null in GetServerInfo
Hardware fields are null in GetServerInfo
GetServerInfo reads hardware metrics from SQL Server DMVs (dynamic management views) that require the VIEW SERVER STATE permission. When the database user lacks this permission, those fields are omitted or returned as null, and a hardware.warning field is included in the response explaining the degradation.This is expected behavior for restricted accounts. If you need hardware metrics, grant VIEW SERVER STATE to the login:Missing .NET runtime error
Missing .NET runtime error
If you are running the development build (from
dotnet build), the .NET 9.0 Runtime must be installed on the target machine. Download it from https://dotnet.microsoft.com/download/dotnet/9.0.If you used publish-release.ps1 to produce the single-file self-contained executable, the runtime is bundled inside MssqlMcp.exe and no separate .NET installation is required.Diagnosing startup failures
Open the log file
Locate the most recently created log file using the table above. On Windows the default path is
%LOCALAPPDATA%\MssqlMcp\Logs\. Open the file in any text editor.Look for FATAL: lines near the top
The startup block always appears first. Any
FATAL: line indicates the process exited before the MCP transport started. Read the message and exception text carefully — it usually identifies the problem directly.Check the masked connection string
A few lines into the log you will see
Connection String: <masked value>. Verify that the server name, database, and authentication method visible in the masked string are correct. Password fields are replaced with ***MASKED***; all other parts of the string are logged in plain text.Find the SQL connection test result line
Look for either
SQL Server connection test SUCCESSFUL (with server and database names) or SQL Server connection test FAILED (with exception details). A failed test always logs the full exception and stack trace — use those details to diagnose the specific connection problem.If the log file does not exist
The server could not create or write to the log path. This can happen if
LOG_FILE_PATH points to a directory that does not exist or to a file the process does not have write permission to create. Check the path value and the filesystem permissions, or unset LOG_FILE_PATH to fall back to the default location under %LOCALAPPDATA%.