β οΈ EXPERIMENTAL USE ONLY β This MCP Server is provided for educational and experimental purposes. It is NOT intended for production use. Use appropriate security measures and test thoroughly before any deployment.
An MCP (Model Context Protocol) server that lets AI assistants like Claude, Cursor, and other LLM-powered tools query and manage your Microsoft SQL Server database using natural language.
You: "Show me all customers from New York"
AI: *queries your MSSQL database and returns the results in plain English*
- Natural language to SQL β Ask questions in plain English
- CRUD operations β Create, read, update, and delete data
- Schema management β Create tables, indexes; describe and drop tables
- Multi-database support β Connect to multiple databases on the same server
- Read-only mode β Restrict to SELECT-only for safer environments
- Secure by default β WHERE clauses required for reads/updates; SQL injection safeguards
- Claude Desktop
- Cursor (VS Code with AI)
- VS Code Agent extension
- Any MCP-compatible client
Click Add to Cursor or Install in VS Code above to add the MCP server. Edit the config to add your database credentials (DB_USER, DB_PASSWORD, etc.). No cloning requiredβruns via npx.
- Node.js 18 or higher
- SQL Server (local, Azure SQL, or remote)
- An MCP-compatible AI client (Claude Desktop, Cursor, etc.)
From npm (recommended):
npx -y @eamonboyle/mssql-mcpOr install globally: npm install -g @eamonboyle/mssql-mcp
From source (for development):
git clone https://github.com/eamonboyle/mssql-mcp.git
cd mssql-mcp
npm install
npm run build| Variable | Required | Description |
|---|---|---|
SERVER_NAME |
Yes | SQL Server host (e.g., localhost, my-server.database.windows.net) |
DATABASE_NAME |
Yes | Default database name |
DB_USER |
Yes* | SQL Server username (for SQL authentication) |
DB_PASSWORD |
Yes* | SQL Server password (for SQL authentication) |
READONLY |
No | "true" for read-only mode, "false" for full access (default: "false") |
DATABASES |
No | Comma-separated list for multi-database access (e.g., ProdDB,StagingDB) |
CONNECTION_TIMEOUT |
No | Timeout in seconds (default: 30) |
TRUST_SERVER_CERTIFICATE |
No | "true" for self-signed certs (e.g., local dev) (default: "false") |
* Required for SQL authentication. For Windows/Integrated authentication, consult the mssql package documentation.
- Create or edit
.vscode/mcp.jsonin your workspace:
{
"mcpServers": {
"mssql": {
"command": "npx",
"args": ["-y", "@eamonboyle/mssql-mcp"],
"env": {
"SERVER_NAME": "localhost",
"DATABASE_NAME": "YourDatabase",
"DB_USER": "your_username",
"DB_PASSWORD": "your_password",
"READONLY": "false"
}
}
}
}- Restart Cursor/VS Code.
- Open File β Settings β Developer β Edit Config
- Add the MCP server configuration:
{
"mcpServers": {
"mssql": {
"command": "npx",
"args": ["-y", "@eamonboyle/mssql-mcp"],
"env": {
"SERVER_NAME": "localhost",
"DATABASE_NAME": "YourDatabase",
"DB_USER": "your_username",
"DB_PASSWORD": "your_password",
"READONLY": "false"
}
}
}
}- Restart Claude Desktop.
To allow queries across multiple databases:
"env": {
"SERVER_NAME": "your-server.database.windows.net",
"DATABASE_NAME": "ProdDB",
"DATABASES": "ProdDB,StagingDB,AnalyticsDB",
"DB_USER": "your_username",
"DB_PASSWORD": "your_password",
"READONLY": "false"
}All tools accept an optional databaseName parameter. When omitted, DATABASE_NAME is used.
See src/samples/ for example configs:
claude_desktop_config.jsonβ Claude Desktopvscode_agent_config.jsonβ VS Code Agent
Once configured, you can ask things like:
- "Show me all users from New York"
- "Create a new table called products with columns for id, name, and price"
- "Update all pending orders to completed status"
- "List all tables in the database"
- "Describe the schema of the customers table"
| Tool | Read-only | Description |
|---|---|---|
read_data |
β | Execute SELECT queries |
list_table |
β | List tables in a database |
describe_table |
β | Get table schema |
insert_data |
Insert rows | |
update_data |
Update rows (requires WHERE) | |
create_table |
Create tables | |
create_index |
Create indexes | |
drop_table |
Drop tables |
- Credentials β Never commit
DB_USER/DB_PASSWORDor config files with secrets. Use environment variables or a secrets manager. - Read-only mode β Set
READONLY: "true"when you only need queries. - WHERE clauses β Read and update operations require explicit WHERE clauses to reduce accidental full-table operations.
- SQL injection β The server validates and restricts dangerous SQL patterns.
Contributions are welcome! Please read CONTRIBUTING.md for guidelines. By participating, you agree to uphold our Code of Conduct.
MIT License β see LICENSE for details.