About SQL-Server-MCP
SQL-Server-MCP is a stdio MCP server for connecting to Microsoft SQL Server and inspecting or querying databases. It is suited to MCP clients that need schema discovery and direct SQL execution, with credentials supplied at connection time.
Key features
- 01Connect to SQL Server
- 02Execute arbitrary SQL queries
- 03Return SQL Server version
- 04List databases and schemas
- 05List tables by optional schema
Use cases
- 01Inspect database structure from an MCP client
- 02Run SQL queries through MCP tools
MCP support
It exposes connection, query, version, and database-discovery tools to MCP clients over stdio. Credentials are passed when connecting and are not stored.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMESQL Server MCP (Model Context Protocol) Server
A lightweight MCP stdio server that connects to Microsoft SQL Server using provided credentials and exposes tools to query and discover schema.
Features
- connect: Connect by
server,port,user,password, optionaldatabase,encrypt. - disconnect: Close the pool.
- info: Return
@@VERSION. - query: Execute arbitrary SQL and return recordset.
- list_databases: List databases.
- list_schemas: List schemas.
- list_tables: List tables, with optional
schemafilter.
Quickstart
- Node.js >= 18
- Install deps and build:
npm install npm run build - Run as an MCP stdio server (for MCP-compatible clients):
npm start
The server starts over stdio and waits to be driven by an MCP client (e.g., Claude Desktop or other MCP-aware tooling). Use the tools in this order:
connectwith your SQL Server credentialsinfo,list_*, orquery
MCP Tools and Schemas
- connect args:
{ "server": "host or host\\\u005Cinstance", "port": 1433, "user": "sa", "password": "<secret>", "database": "master", "encrypt": true } - query args:
{ "sql": "SELECT TOP 1 * FROM sys.databases" } { "sql": "SELECT * FROM INFORMATION_SCHEMA.TABLES" } - Other tools take no args or optional
schema.
Security
- Credentials are provided at call-time and are not stored. Prefer secure MCP clients and environments. TLS
encryptdefaults to true.
Development
- Scripts:
npm run devto run with ts-nodenpm run buildto emit JS todist/npm startto run built server (dist/server.js)
Commits
- chore: init project scaffolding with TypeScript, tsconfig, and deps
- feat: implement MCP stdio server with SQL Server tools (connect, query, info, list_*)
- docs: add execution plan outline and usage notes
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.