MCP MS SQL Server
About
An MCP server for executing queries on a Microsoft SQL Server database.
Details
- Author
- techybolek
- Categories
- Database, Other
Jump to
Setup
Install MCP MS SQL Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/techybolek/mcp_sql_server2
Follow the installation instructions in the repository README, then restart your MCP client.
A Model Context Protocol (MCP) server that provides a standardized interface for AI models to interact with MS SQL Server databases. This server implements the MCP specification to enable seamless database operations through a consistent API.
- Execute SQL queries with parameter support
- List all tables in the database
- Describe table schemas
- Support for both stdio and HTTP transport modes
- Comprehensive logging system
- Environment-based configuration
- Error handling and graceful shutdown
- Node.js (version that supports ES modules)
- MS SQL Server instance
- Access credentials for the database
- Clone the repository
- Install dependencies:
You can also install the package globally:
- Create a.envfile in the project root with the following required variables:
DB_SERVER=your_server_address DB_USER=your_username DB_PASSWORD=your_password DB_DATABASE_NAME=your_database_name
The server can be started in two different transport modes:
The server implements the JSON-RPC 2.0 protocol with the following key methods:
- initialize- Initialize the server connection:
{ "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2024-11-05", "capabilities": { "tools": {} }, "clientInfo": { "name": "your-client", "version": "1.0.0" } } }
- tools/list- List available tools
- tools/call- Call a specific tool
The package includes a test client (test.package.js) that demonstrates how to interact with the MCP server:
The test client implements anMCPTestClientclass that:
- Spawns a server process usingnpx mcp-mssql-server
- Initializes the connection with protocol version '2024-11-05'
- Lists available tools
- Executes sample queries including:
- Listing all tables
- Running a specific SQL query to count documents
{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "execute_sql_query", "arguments": { "query": "SELECT COUNT() as document_count FROM document_new" } } }
The test client provides a simple way to verify the server's functionality and can serve as a reference for implementing your own client.
The server provides the following MCP tools:
Execute SQL queries against the database with optional parameterization.
{ "query": "SELECT FROM Users WHERE id = @userId", "parameters": [ { "name": "userId", "type": "int", "value": 1 } ] }
List all available tables in the connected database.
Get detailed schema information for a specific table.
{ "table_name": "Users" }
- error.log: Error-level logs
- combined.log: All logs
In HTTP mode, logs are also output to the console.
- @modelcontextprotocol/sdk: ^1.13.0
- dotenv: ^16.4.5
- express: ^5.1.0
- mssql: ^11.0.1
- winston: ^3.11.0
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
Official MCP server for dbt (data build tool) providing integration with dbt Core/Cloud CLI, project metadata discovery, model information, and semantic layer querying capabilities.
Open source MCP server specializing in easy, fast, and secure tools for Databases.
Query and analyze data with MotherDuck and local DuckDB
Query Streams securely connects MCP clients to live databases through the Query Streams Cloud Network, with no VPNs, inbound ports, or complex setup.
Interact with the SingleStore database platform
Official Supabase MCP server for managing Supabase projects, databases, auth, storage, edge functions, and SQL workflows from AI agents.
A collection of tools for managing the platform, addressing data quality and reading and writing to Teradata Database.
Multi-database agent access (PostgreSQL, SQLite, MySQL, Oracle, SQL Server) with batch queries, pre-configured connections, and SQLGlot-enforced read-only safety
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





