Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g.,@MCP MS SQL Server list all tables in the database
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
You can also use deployed servers via HTTP endpoints. For instructions, see How to Test MCP Streamable HTTP Endpoints Using cURL.
mcp-mssql-server
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.
Features
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
Prerequisites
Node.js (version that supports ES modules)
MS SQL Server instance
Access credentials for the database
Installation
Clone the repository
Install dependencies:
You can also install the package globally:
Create a
.envfile in the project root with the following required variables:
Usage
The server can be started in two different transport modes:
stdio Mode (Default)
HTTP Mode
Development Mode
JSON-RPC Protocol
The server implements the JSON-RPC 2.0 protocol with the following key methods:
initialize- Initialize the server connection:
tools/list- List available toolstools/call- Call a specific tool
Testing
The package includes a test client (test.package.js) that demonstrates how to interact with the MCP server:
The test client implements an MCPTestClient class that:
Spawns a server process using
npx mcp-mssql-serverInitializes 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
Handles server responses and errors through stdio streams
Includes proper error handling and process cleanup
Example test query from the client:
The test client provides a simple way to verify the server's functionality and can serve as a reference for implementing your own client.
Available Tools
The server provides the following MCP tools:
1. execute_sql_query
Execute SQL queries against the database with optional parameterization.
2. list_tables
List all available tables in the connected database.
3. describe_table
Get detailed schema information for a specific table.
Logging
Logs are stored in the logs directory:
error.log: Error-level logscombined.log: All logs
In HTTP mode, logs are also output to the console.
Dependencies
Main dependencies:
@modelcontextprotocol/sdk: ^1.13.0
dotenv: ^16.4.5
express: ^5.1.0
mssql: ^11.0.1
winston: ^3.11.0
Development dependencies:
axios: ^1.10.0
License
MIT
Contributing
Fork the repository
Create your feature branch
Commit your changes
Push to the branch
Create a new Pull Request