- Home
- MCP servers
- MSSQL
MSSQL
- typescript
6
GitHub Stars
typescript
Language
6 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": {
"knight0zh-mssql-mcp-server": {
"command": "mssql-mcp-server",
"args": [],
"env": {
"MSSQL_HOST": "localhost",
"MSSQL_PORT": "1433",
"MSSQL_USER": "sa",
"MSSQL_ENCRYPT": "false",
"MSSQL_DATABASE": "master",
"MSSQL_PASSWORD": "yourpassword",
"MSSQL_CONNECTION_STRING": "Server=localhost;Database=master;User Id=sa;Password=yourpassword;",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}This MSSQL MCP Server lets you connect to Microsoft SQL Server databases through a Model Context Protocol (MCP) endpoint. It exposes tools to execute SQL queries and manage database connections from MCP clients, enabling seamless integration with your SQL-backed workflows.
How to use
Connect to the MSSQL MCP Server from your MCP client and use the built-in query tool to run SQL against your SQL Server databases. You will configure a server entry with the proper connection details, then call the query tool with a SQL statement to retrieve data or perform updates. The server handles connection management and exposes the results back to your client for easy consumption.
How to install
# Install via Smithery (for Claude Desktop integration)
npx -y @smithery/cli install @knight0zh/mssql-mcp-server --client claude
Or install directly as a local package.
npm install mssql-mcp-server
Additional configuration and usage notes
Configure the MSSQL MCP Server in your MCP settings to establish a connection to your SQL Server instance. You can provide either a full connection string or individual connection parameters. The supported environment variables are shown in the example configuration.
{
"mcpServers": {
"mssql": {
"command": "mssql-mcp-server",
"env": {
"MSSQL_CONNECTION_STRING": "Server=localhost;Database=master;User Id=sa;Password=yourpassword;",
// Or individual connection parameters:
"MSSQL_HOST": "localhost",
"MSSQL_PORT": "1433",
"MSSQL_DATABASE": "master",
"MSSQL_USER": "sa",
"MSSQL_PASSWORD": "yourpassword",
"MSSQL_ENCRYPT": "false",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}
Tools available
The server exposes a tool named query that runs SQL against your MSSQL database. You supply the query and connection details, and the tool returns the results.
const result = await use_mcp_tool({
server_name: 'mssql',
tool_name: 'query',
arguments: {
host: 'localhost',
username: 'sa',
password: 'yourpassword',
query: 'SELECT * FROM Users',
},
});
Development
You can install dependencies, run in development mode, build, test, lint, and format the codebase using the following commands.
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build
npm run build
# Run tests
npm test
# Run linter
npm run lint
# Format code
npm run format
Available tools
query
Executes a SQL query against a MSSQL database. You provide connection details and the SQL statement; the tool returns the results.