mssql
MCP server for MS SQL Server
claude mcp add --transport stdio dperussina-mssql-mcp-server node server.js \ --env HOST="0.0.0.0" \ --env PORT="3333" \ --env DEBUG="false" \ --env DB_USER="your_username" \ --env DB_SERVER="your_server_name_or_ip" \ --env TRANSPORT="stdio" \ --env SERVER_URL="http://localhost:3333" \ --env DB_DATABASE="your_database_name" \ --env DB_PASSWORD="your_password" \ --env QUERY_RESULTS_PATH="/path/to/query_results"
How to use
This MS SQL MCP Server provides an AI-friendly interface to explore and query your Microsoft SQL Server databases without coding. It exposes tools to discover database structure, inspect table details, perform safe read-only queries, and generate SQL from natural language prompts. The server supports a bundled interactive client and optional HTTP/SSE transport for network access, allowing Claude or other AI assistants to navigate tables, view schemas, and run constrained queries. Typical usage involves discovering tables, selecting a target table for details, running a read-only query, and iterating with natural language prompts to generate appropriate SQL queries. The system is designed to keep credentials local and queries read-only by default for safety.
How to install
Prerequisites:
- Node.js v14 or higher
- Access to a Microsoft SQL Server instance (on-premises or Azure)
Installation steps:
- Clone the repository git clone https://github.com/dperussina/mssql-mcp-server.git
- Navigate to the project directory cd mssql-mcp-server
- Install dependencies npm install
- Copy the example environment file cp .env.example .env
- Configure your database connection in .env (example variables shown below) DB_USER=your_username DB_PASSWORD=your_password DB_SERVER=your_server_name_or_ip DB_DATABASE=your_database_name PORT=3333 HOST=0.0.0.0 TRANSPORT=stdio SERVER_URL=http://localhost:3333 DEBUG=false QUERY_RESULTS_PATH=/path/to/query_results
- Start the server
npm start
or with HTTP/SSE transport
npm run start:sse - (Optional) Run the interactive client npm run client
Additional notes
Notes and tips:
- This server emphasizes security by defaulting to read-only queries. To allow data modification, you would need to adjust query handling and permissions accordingly (not recommended for production AI access).
- Ensure your .env QUERY_RESULTS_PATH directory exists and is writable, as query results may be cached there.
- If you run into connection issues, verify DB_SERVER, DB_USER, and DB_PASSWORD are correct, and check DEBUG logs for details.
- The server can be exposed via HTTP/SSE transport for networked AI clients; adjust TRANSPORT and SERVER_URL accordingly.
- The included tools include:
- mcp_SQL_mcp_discover_database(): Discover database structure
- mcp_SQL_mcp_table_details({ tableName }): Inspect table schema
- mcp_SQL_mcp_execute_query({ sql, returnResults }): Run a read-only SQL query and get results
- mcp_SQL_mcp_discover_tables({ namePattern }): Find tables by name pattern
- mcp_SQL_mcp_get_query_results({ uuid }): Retrieve saved large results
- For best results with AI prompting, combine discovery and table detail steps before crafting queries.
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.