- Home
- MCP servers
- MS SQL Server
MS SQL Server
- javascript
2
GitHub Stars
javascript
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"bymcs-mssql-mcp": {
"command": "npx",
"args": [
"-y",
"mssql-mcp@latest"
],
"env": {
"DB_PORT": "1433",
"DB_USER": "your-username",
"DB_SERVER": "your-server.com",
"DB_ENCRYPT": "true",
"DB_DATABASE": "your-database",
"DB_PASSWORD": "your-password",
"DB_REQUEST_TIMEOUT": "30000",
"DB_CONNECTION_TIMEOUT": "30000",
"DB_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}This MCP server lets you interact with Microsoft SQL Server using Model Context Protocol-enabled IDEs. You connect, run queries, inspect schemas, and manage data through a consistent, scriptable interface that integrates with editors like Claude Desktop, Cursor, Windsurf, and VS Code.
How to use
You connect to your SQL Server instance and start issuing operations through an MCP-enabled client. Use it to connect, execute parameterized queries, inspect database schemas, retrieve data with pagination, and run stored procedures. The server manages a pool of connections for efficient resource use and returns structured results that your editor can display or process.
How to install
# Prerequisites
- Node.js and npm installed on your machine
# Install the MCP server globally
npm install -g mssql-mcp
Configuration and usage notes
Configure your MCP client to point at this server. The server runs via a local command that invokes the MCP package with the latest release, and you supply your database credentials through environment variables. The following environment variables are supported.
{
"mcpServers": {
"mssql": {
"command": "npx",
"args": ["-y", "mssql-mcp@latest"],
"env": {
"DB_SERVER": "your-server.com",
"DB_DATABASE": "your-database",
"DB_USER": "your-username",
"DB_PASSWORD": "your-password",
"DB_ENCRYPT": "true",
"DB_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}
Environment variables you may set
The server accepts these environment variables. Required ones are indicated where applicable.
DB_SERVER
DB_DATABASE
DB_USER
DB_PASSWORD
DB_PORT
DB_ENCRYPT
DB_TRUST_SERVER_CERTIFICATE
DB_CONNECTION_TIMEOUT
DB_REQUEST_TIMEOUT
Azure SQL and local development notes
For Azure SQL Database, encryption is enabled by default and you should set the certificate trust to false.
{ "DB_ENCRYPT": "true", "DB_TRUST_SERVER_CERTIFICATE": "false" }
Security and best practices
Use parameterized queries to prevent SQL injection. Store credentials securely (e.g., in your editor's secret store or a managed vault) and limit the permissions of the database user to the minimum required for your tasks.
Available tools
connect_database
Connect to database using environment variables
disconnect_database
Close current database connection
connection_status
Check connection state with pool info
execute_query
Execute any SQL query with parameters
get_schema
List database objects such as tables, views, and procedures
describe_table
Get detailed structure of a specific table
get_table_data
Retrieve data with pagination
execute_procedure
Execute stored procedures
list_databases
List all databases