SQL Server MCP Server (Diamond Inventory)
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., "@SQL Server MCP Server (Diamond Inventory)list all tables in the DiamondInventory 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.
SQL Server MCP Server (Diamond Inventory)
Production-ready Model Context Protocol server for Microsoft SQL Server, preconfigured for the Diamond Inventory database on your Ubuntu VM.
Connect from Cursor, Claude Desktop, or any MCP client to explore schema and run safe read-only queries.
Features
Multiple databases on one SQL Server instance (pools per database)
Connection pooling with startup health check per database
Read-only by default — blocks DDL,
EXEC, and writes unlessMSSQL_ALLOW_WRITE=trueRow limits — auto-applies
TOP (n)onSELECTwhen missingParameterized queries —
?placeholders via pyodbcSchema tools — list databases/schemas/tables, describe columns, search objects, column null counts
Production MCP prompts — explore, performance audit, data quality, packet analysis, health check
stdio transport for Cursor; optional Streamable HTTP for remote use
Related MCP server: Enhanced MCP MSSQL Server
Multiple databases (one server)
Configure several databases that share the same host, port, and login.
Option A — databases.json (recommended)
copy databases.json.example databases.json
# Edit names/descriptions; set default_databaseOption B — comma-separated in .env
MSSQL_DATABASE=SJSINGLE
MSSQL_DATABASES=SJSINGLE,SJWEB,WEBCRMEvery tool accepts an optional database argument. Call list_databases first.
Setting | Purpose |
| Comma-separated DB names |
| Names, descriptions, per-DB |
|
|
MCP prompts (better AI results)
Use Prompts in Cursor MCP panel:
Prompt | Use when |
| Start — which DB to use |
| Discover schemas/tables |
| Deep-dive one table |
| Diamond |
| Slow procedures / indexes |
| Nulls, duplicates, bad values |
| Answer a business question safely |
| Diff two databases |
| Size, backups, sessions |
| Top slow procedures |
Prerequisites
On your Windows machine (MCP client)
Python 3.11+
uv (recommended) or pip
Microsoft ODBC Driver 18 for SQL Server
On your Ubuntu VM (SQL Server host)
Ensure SQL Server accepts remote TCP connections on port 1433 and that firewall allows your client IP.
# Example: allow port (adjust for your setup)
sudo ufw allow 1433/tcpCreate / verify the Diamond Inventory database and a SQL login for MCP (avoid sa in production):
CREATE DATABASE DiamondInventory;
GO
USE DiamondInventory;
-- CREATE USER mcp_reader WITH PASSWORD = '...';
-- GRANT SELECT ON SCHEMA::dbo TO mcp_reader;Quick start
cd D:\DEVOPS_PROJECTS\MCPSERVER
# Copy and edit credentials
copy .env.example .env
# Install and run
uv sync
uv run sqlserver-mcpConfigure .env
Variable | Description |
| Ubuntu VM IP or hostname |
| Default |
|
|
| SQL login |
|
|
| Max rows per query (default |
Cursor integration
Add to Cursor Settings → MCP (or merge into .cursor/mcp.json):
{
"mcpServers": {
"sqlserver-diamond-inventory": {
"command": "uv",
"args": [
"run",
"--directory",
"D:\\DEVOPS_PROJECTS\\MCPSERVER",
"sqlserver-mcp"
],
"env": {
"MSSQL_SERVER": "192.168.1.100",
"MSSQL_PORT": "1433",
"MSSQL_DATABASE": "DiamondInventory",
"MSSQL_USER": "mcp_reader",
"MSSQL_PASSWORD": "your-password",
"MSSQL_DRIVER": "ODBC Driver 18 for SQL Server",
"MSSQL_TRUST_SERVER_CERTIFICATE": "true",
"MSSQL_ALLOW_WRITE": "false"
}
}
}
}Restart Cursor. You should see tools: list_schemas, list_tables, describe_table, execute_query, execute_parameterized_query, get_database_info.
MCP tools
Tool | Purpose |
| All schemas in the database |
| Tables/views (optional |
| Column metadata + primary keys |
| Read-only T-SQL ( |
| Read queries with |
| Current DB, server name, config summary |
Example prompts in Cursor
"List all tables in the Diamond Inventory database."
"Describe the Products table and show 5 sample rows."
"How many items are low on stock?" (agent will use
execute_query)
REST API for Node.js (and other apps)
Run a simple HTTP API on port 8766 (separate from Cursor MCP stdio):
uv sync
uv run sqlserver-mcp-apiAPI base URL: http://127.0.0.1:8766
Endpoint | Method | Body |
| GET | — |
| POST |
|
| POST |
|
| POST |
|
| GET | — |
Optional: set MCP_API_KEY in .env and send header X-API-Key.
Node.js example
const API = "http://127.0.0.1:8766";
const headers = {
"Content-Type": "application/json",
// "X-API-Key": "your-secret-key", // if MCP_API_KEY is set
};
// Send text (SQL) from your app — you handle the JSON response
const res = await fetch(`${API}/api/v1/run`, {
method: "POST",
headers,
body: JSON.stringify({
text: "SELECT TOP 10 LOT_CODE, CARAT FROM Single.PACKET_MASTER",
database: "SJSINGLE",
}),
});
const data = await res.json();
if (data.ok) {
console.log(data.result.rows); // array of rows
console.log(data.result.columns); // column names
} else {
console.error(data.error);
}
// Or call a specific tool
const tables = await fetch(`${API}/api/v1/invoke`, {
method: "POST",
headers,
body: JSON.stringify({
tool: "list_tables",
arguments: { database: "SJSINGLE", schema: "Single" },
}),
}).then((r) => r.json());Note: This API runs SQL and schema tools only. Free-form natural language (e.g. “how many stones?”) needs your Node app to turn text into SQL, or use an LLM in Node, then call /api/v1/run or /api/v1/query.
HTTP transport (optional)
For non-stdio clients:
$env:MCP_TRANSPORT = "streamable-http"
$env:MCP_HTTP_PORT = "8765"
uv run sqlserver-mcpEndpoint: http://127.0.0.1:8765/mcp (bind to localhost only unless behind a reverse proxy with auth).
Security notes
Never commit
.envor passwords.Use a read-only SQL user for MCP; keep
MSSQL_ALLOW_WRITE=false.Blocked always:
DROP,ALTER,CREATE,EXEC,TRUNCATE,BACKUP, etc.Queries are validated before execution; results are capped by
MSSQL_MAX_ROWS.
Development
uv sync --extra dev
uv run pytest
uv run mcp dev src/sqlserver_mcp/server.pyTroubleshooting
Issue | Fix |
| Install ODBC Driver 18; set |
| Check user/password; enable SQL auth on SQL Server |
| Open port 1433; verify VM IP; SQL Server listening on TCP |
| Set |
License
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/DhruviPatel712/mcp_server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server