mcp -mssqlserver
A comprehensive Model Context Protocol (MCP) server for MSSQL Server with advanced DDL support, granular permission control, comprehensive operation logging, and enterprise-grade connection management.
claude mcp add --transport stdio liliangshan-mcp-server-mssqlserver node path/to/server.js \ --env ALLOW_DDL="false" \ --env ALLOW_DROP="false" \ --env MSSQL_PORT="1433" \ --env MSSQL_USER="your-username" \ --env MCP_LOG_DIR="./logs" \ --env ALLOW_DELETE="false" \ --env MCP_LOG_FILE="mcp-mssqlserver.log" \ --env MSSQL_SCHEMA="dbo" \ --env MSSQL_SERVER="your-mssql-server-host" \ --env MSSQL_ENCRYPT="false" \ --env MSSQL_DATABASE="your-database" \ --env MSSQL_PASSWORD="your-password" \ --env MSSQL_TRUST_SERVER_CERTIFICATE="true"
How to use
This MCP server implements the Model Context Protocol for MSSQL Server, enabling editors and tools to interact with a MSSQL database through a standardized set of MCP operations. It provides full DDL and DML support, granular permission controls, and comprehensive logging and connection management. The available tools include sql_query for executing SQL statements with parameterized safety, get_database_info to discover database and configuration details, get_operation_logs to review operational activity, and check_permissions to verify current permission settings. You can use these tools from MCP-compatible editors (like Cursor or VS Code MCP extensions) to manage schemas, run queries, and audit activity within a MSSQL database. Start the server in your environment and then invoke the built-in tools via the MCP protocol or editor integrations to perform tasks such as creating tables, querying data, and reviewing logs.
How to install
Prerequisites:
- Node.js and npm installed on your machine.
- Access to a MSSQL Server instance.
- A suitable environment to run the server (development machine or server).
Step-by-step installation:
-
Install the MCP server package globally or locally (sample commands shown):
- Global installation (recommended for CLI usage): npm install -g @liangshanli/mcp-server-mssqlserver
- Local installation: npm install @liangshanli/mcp-server-mssqlserver
-
Clone the repository (if you prefer source): git clone https://github.com/liliangshan/mcp-server-mssqlserver.git cd mcp-server-mssqlserver npm install
-
Configure environment variables for MSSQL and permissions (example): export MSSQL_SERVER=your-mssql-server-host export MSSQL_PORT=1433 export MSSQL_USER=your-username export MSSQL_PASSWORD=your-password export MSSQL_DATABASE=your-database export MSSQL_SCHEMA=your-schema export ALLOW_DDL=true export ALLOW_DROP=true export ALLOW_DELETE=true export MCP_LOG_DIR=./logs export MCP_LOG_FILE=mcp-mssqlserver.log
-
Start the server (one of the supported methods): npm start
or
npm run server
or
npm run start-managed
or
npm run dev
Additional notes
Notes and tips:
- Ensure the MSSQL connection settings (server, port, user, password, database) are correct before starting.
- The environment variables ALLOW_DDL, ALLOW_DROP, and ALLOW_DELETE control the permission surface; adjust according to your security requirements.
- Logs are written to MCP_LOG_DIR/MCP_LOG_FILE; ensure the directory is writable by the process.
- For multi-tenant deployments, you can enable schema auto-prefixing to simplify cross-tenant isolation.
- If you encounter connection pool issues, monitor health, adjust pool size, and enable health checks in the environment configuration if supported by your deployment.
- This server adheres to the MCP protocol, exposing tools such as sql_query, get_database_info, get_operation_logs, and check_permissions for integration with MCP-enabled editors and tooling.
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.