MSSQL Database MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MSSQL Database MCP Server
UPDATE
This project is modified from
https://github.com/Azure-Samples/SQL-AI-samples/blob/main/MssqlMcp/Node/README.md
Authentication Change
Original:
The original project authenticated to SQL Server using Entra (Azure Active Directory) authentication, which requires Azure AD setup and user login flow.
Current:
This version now uses SQL Server authentication with the sa username and password. This is a simpler and more widely compatible method, especially for local development, on-premises servers, or cloud servers where Entra is not configured.
Why This Change?
Easier setup: No need for Azure AD or Entra configuration.
Works everywhere: Compatible with local, on-premises, and cloud SQL Server instances.
No browser login: Credentials are provided directly in environment variables or config files.
How To Use
Set your SQL credentials in your configuration:
SQL_USER: The SQL Server username (e.g.,sa)SQL_Password: The password for the SQL Server userTRUST_SERVER_CERTIFICATE: Set to"true"if your server uses a self-signed certificate (common for local/dev setups)
Example configuration:
{ "SERVER_NAME": "localhost", "DATABASE_NAME": "your-database", "SQL_USER": "sa", "SQL_Password": "yourStrong(!)Password", "TRUST_SERVER_CERTIFICATE": "true" }No Entra/Azure AD login required.
The server will connect using the credentials you provide.
Security Note
Never use the
saaccount in production unless absolutely necessary.
Create a dedicated SQL user with only the permissions required for your use case.Protect your credentials:
Do not commit passwords to source control. Use environment variables or secure secrets management.
Troubleshooting
If you see a
self-signed certificateerror, setTRUST_SERVER_CERTIFICATE=truein your environment or config.If you get login errors, double-check your username, password, and SQL Server settings.
This update makes the MCP server easier to run in most environments, especially for development and testing.
What is this? 🤔
This is a server that lets your LLMs (like Claude) talk directly to your MSSQL Database data! Think of it as a friendly translator that sits between your AI assistant and your database, making sure they can chat securely and efficiently.
Quick Example
You: "Show me all customers from New York"
Claude: *queries your MSSQL Database database and gives you the answer in plain English*Related MCP server: MSSQL Database MCP Server
How Does It Work? 🛠️
This server leverages the Model Context Protocol (MCP), a versatile framework that acts as a universal translator between AI models and databases. It supports multiple AI assistants including Claude Desktop and VS Code Agent.
What Can It Do? 📊
Run MSSQL Database queries by just asking questions in plain English
Create, read, update, and delete data
Manage database schema (tables, indexes)
Secure connection handling
Real-time data interaction
Quick Start 🚀
Prerequisites
Node.js 14 or higher
Claude Desktop or VS Code with Agent extension
Set up project
Install Dependencies
Run the following command in the root folder to install all necessary dependencies:npm installBuild the Project
Compile the project by running:npm run build
Configuration Setup
Option 1: VS Code Agent Setup
Install VS Code Agent Extension
Open VS Code
Go to Extensions (Ctrl+Shift+X)
Search for "Agent" and install the official Agent extension
Create MCP Configuration File
Create a
.vscode/mcp.jsonfile in your workspaceAdd the following configuration:
{ "servers": { "mssql-nodejs": { "type": "stdio", "command": "node", "args": ["q:\\Repos\\SQL-AI-samples\\MssqlMcp\\Node\\dist\\index.js"], "env": { "SERVER_NAME": "your-server-name.database.windows.net", "DATABASE_NAME": "your-database-name", "READONLY": "false", "SQL_USER": "sa", "SQL_Password": "Passw0rd", "TRUST_SERVER_CERTIFICATE":"true" } } } }Alternative: User Settings Configuration
Open VS Code Settings (Ctrl+,)
Search for "mcp"
Click "Edit in settings.json"
Add the following configuration:
{
"mcp": {
"servers": {
"mssql": {
"command": "node",
"args": ["C:/path/to/your/Node/dist/index.js"],
"env": {
"SERVER_NAME": "your-server-name.database.windows.net",
"DATABASE_NAME": "your-database-name",
"READONLY": "false",
"SQL_USER": "sa",
"SQL_Password": "Passw0rd",
"TRUST_SERVER_CERTIFICATE":"true"
}
}
}
}
}Restart VS Code
Close and reopen VS Code for the changes to take effect
Verify MCP Server
Open Command Palette (Ctrl+Shift+P)
Run "MCP: List Servers" to verify your server is configured
You should see "mssql" in the list of available servers
Option 2: Claude Desktop Setup
Open Claude Desktop Settings
Navigate to File → Settings → Developer → Edit Config
Open the
claude_desktop_configfile
Add MCP Server Configuration Replace the content with the configuration below, updating the path and credentials:
{ "mcpServers": { "mssql": { "command": "node", "args": ["C:/path/to/your/Node/dist/index.js"], "env": { "SERVER_NAME": "your-server-name.database.windows.net", "DATABASE_NAME": "your-database-name", "READONLY": "false", "SQL_USER": "sa", "SQL_Password": "Passw0rd", "TRUST_SERVER_CERTIFICATE":"true" } } } }Restart Claude Desktop
Close and reopen Claude Desktop for the changes to take effect
Configuration Parameters
SERVER_NAME: Your MSSQL Database server name (e.g.,
my-server.database.windows.net)DATABASE_NAME: Your database name
READONLY: Set to
"true"to restrict to read-only operations,"false"for full accessPath: Update the path in
argsto point to your actual project location.CONNECTION_TIMEOUT: (Optional) Connection timeout in seconds. Defaults to
30if not set.TRUST_SERVER_CERTIFICATE: (Optional) Set to
"true"to trust self-signed server certificates (useful for development or when connecting to servers with self-signed certs). Defaults to"false".
Sample Configurations
You can find sample configuration files in the src/samples/ folder:
claude_desktop_config.json- For Claude Desktopvscode_agent_config.json- For VS Code Agent
Usage Examples
Once configured, you can interact with your database using natural language:
"Show me all users from New York"
"Create a new table called products with columns for id, name, and price"
"Update all pending orders to completed status"
"List all tables in the database"
Security Notes
The server requires a WHERE clause for read operations to prevent accidental full table scans
Update operations require explicit WHERE clauses for security
Set
READONLY: "true"in production environments if you only need read access
You should now have successfully configured the MCP server for MSSQL Database with your preferred AI assistant. This setup allows you to seamlessly interact with MSSQL Database through natural language queries!
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Query, explore, and manage your databases through natural conversation.
Work with your database from AI tools: ask, export, approved changes, and scheduled jobs.
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Microsoft SQL Server databases through query execution, schema discovery, CRUD operations, stored procedures, and data export with built-in safety controls.1864 PyPIApache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely interact with Microsoft SQL Server databases to query data, inspect schemas, and retrieve metadata with read-only operations by default and optional write capabilities.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Microsoft SQL Server databases through a standardized interface. Supports executing SQL queries, browsing database schemas, and viewing table data with flexible authentication options for both local and Azure SQL databases.5MIT
- FlicenseNot gradedqualityDmaintenanceProvides direct SQL query access to Microsoft SQL Server databases with full CRUD operations, enabling AI assistants to execute queries, modify data, and manage database objects through a simplified interface.-