Skip to content

Basic Configuration

The safest way to configure the server is through environment variables. Copy the example template:

Ventana de terminal
cp .env.example .env

Edit .env with your database credentials.

Linux/macOS:

Ventana de terminal
source .env

Windows PowerShell:

Ventana de terminal
Get-Content .env | ForEach-Object {
$name, $value = $_ -split '=', 2
[Environment]::SetEnvironmentVariable($name, $value)
}
VariableDescription
MSSQL_SERVERSQL Server hostname or IP
MSSQL_DATABASEDatabase name
MSSQL_USERSQL Server username
MSSQL_PASSWORDSQL Server password
VariableDefaultDescription
MSSQL_PORT1433SQL Server port
DEVELOPER_MODEfalsetrue for development, false for production
MSSQL_READ_ONLYfalseRead-only mode
MSSQL_WHITELIST_TABLES(empty)Tables allowed for modification in read-only mode
MSSQL_AUTHsqlAuthentication mode (sql, integrated, azure)
MSSQL_CONNECTION_STRING(empty)Custom connection string (overrides other variables)
Ventana de terminal
DEVELOPER_MODE=true go run main.go

In development mode:

  • Self-signed certificates are allowed
  • Errors show technical details
  • Encryption can be disabled for local SQL Server
Ventana de terminal
DEVELOPER_MODE=false ./mcp-go-mssql

In production mode:

  • Valid TLS certificates are required
  • Errors are generic (no technical details)
  • Encryption is mandatory
Ventana de terminal
cd test
go run test-connection.go