SJSINGLE_AI SQL Server MCP
Click on "Deploy 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., "@SJSINGLE_AI SQL Server MCPwhat are the top 10 most expensive stones?"
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.
SJSINGLE_AI SQL Server MCP
Production-ready Model Context Protocol server for Microsoft SQL Server, configured for the SJSINGLE_AI database.
Features
SQL Server MCP tools for schema discovery and safe read-only queries
SJSINGLE_AIconfigured as the default databaseOptional multi-database catalog through
databases.jsonRead-only by default, with DDL/admin commands blocked
Row limits and query timeout controls
Live schema metadata discovery
LangChain-powered natural-language read-only SQL tool
stdio transport for Cursor and optional streamable HTTP transport
Related MCP server: MSSQL MCP Python Server
Setup
cd D:\DHRUVI_MCP_SERVER\DHRUVI_MCP_SERVER
copy .env.example .envEdit .env and set the real SQL Server password:
MSSQL_SERVER=4.240.84.65
MSSQL_PORT=1433
MSSQL_DATABASE=SJSINGLE_AI
MSSQL_DATABASES=SJSINGLE_AI
MSSQL_USER=sjreadonly
MSSQL_PASSWORD=your-secure-password
MSSQL_MAX_ROWS=10
AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/
AZURE_OPENAI_DEPLOYMENT=your-foundry-model-deployment-name
AZURE_OPENAI_API_KEY=your-azure-openai-key
AZURE_OPENAI_API_VERSION=2024-10-21Install dependencies:
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"Run tests:
.\.venv\Scripts\python.exe -m pytestStart the MCP server:
.\.venv\Scripts\python.exe -m sqlserver_mcpFor HTTP mode, keep these values in .env:
MCP_TRANSPORT=streamable-http
MCP_HTTP_HOST=127.0.0.1
MCP_HTTP_PORT=8765Then start the same command. The endpoint is:
http://127.0.0.1:8765/mcpCursor MCP
Use mcp.json.example as the Cursor MCP configuration template. It points at this folder and starts:
.\.venv\Scripts\python.exe -m sqlserver_mcpKeep PYTHONPATH=D:\DHRUVI_MCP_SERVER\DHRUVI_MCP_SERVER\src in the MCP environment so
Cursor loads the current source files, not an older installed package.
Runtime MCP instructions are passed inline from src/sqlserver_mcp/server.py through
FastMCP. AGENT_INSTRUCTIONS.md is kept as human-readable documentation and does
not need to be loaded into the MCP runtime.
Main tools:
list_databaseslist_schemaslist_tablesdescribe_tablesearch_objectstable_column_countsrecommend_business_view
get_stone_detailexecute_queryexecute_parameterized_queryanswer_question_with_langchainget_database_info
Safety
The server is read-only unless MSSQL_ALLOW_WRITE=true. Even then, destructive/admin SQL such as DROP, ALTER, CREATE, EXEC, TRUNCATE, BACKUP, and DBCC remains blocked.
LangChain
answer_question_with_langchain uses LangChain to generate one read-only T-SQL query from
a natural-language question. The generated query is still executed through the MCP server's
normal SQL validator and row cap.
Business questions are routed to preferred MCP views before SQL generation:
Stone detail, stock, inventory, packet, or diamond questions:
MCP.VIEW_STOCK_STONE_DATAParty eBid, bid, bidding, auction, or eBid result questions:
MCP.VIEW_EBID_RESULT_DETAILS_DATAParty, party detail, customer profile, customer expression, interest, or preference questions:
MCP.VIEW_CUSTOMER_PROFILE_DATAandMCP.VIEW_CUSTOMER_EXPRESSION_DATAWebsite activity, last activity, user tracking, page visit, or login activity questions:
MCP.VIEW_USER_TRACKING_LOG_DATA
Preferred input columns:
MCP.VIEW_CUSTOMER_EXPRESSION_DATA:PARTY_COMPANY_NAMEMCP.VIEW_CUSTOMER_PROFILE_DATA:WEB_USER_NAMEorCOMPANY_NAMEMCP.VIEW_SALES_STONE_DATA:SERIAL_NOMCP.VIEW_STOCK_STONE_DATA:SerialNoorCOMPANY_NAMEMCP.VIEW_USER_TRACKING_LOG_DATA:COMPANY_NAMEMCP.VIEW_EBID_RESULT_DETAILS_DATA:PARTY_COMPANY_NAME
Query responses are capped at 10 rows.
For a direct stock stone serial lookup, use get_stone_detail(serial_no="533007").
It performs one query against [MCP].[VIEW_STOCK_STONE_DATA] with a SerialNo
filter.
Equivalent direct SQL:
SELECT TOP (1) * FROM [MCP].[VIEW_STOCK_STONE_DATA] WHERE [SerialNo] = SerialNoFor more than one serial, use IN and do not add TOP (10):
SELECT * FROM [MCP].[VIEW_STOCK_STONE_DATA] WHERE [SerialNo] IN (SerialNo1, SerialNo2)For highest stock cost, calculate cost as GRATE * CARAT:
SELECT TOP (1)
[SERIAL_NO],
[STONE_ID],
[GRATE],
[CARAT],
([GRATE] * [CARAT]) AS [CalculatedCost]
FROM [MCP].[VIEW_STOCK_STONE_DATA]
ORDER BY ([GRATE] * [CARAT]) DESCFor highest sale discount, run the direct sales view query once:
SELECT TOP 1 * FROM [MCP].[VIEW_SALES_STONE_DATA] ORDER BY [discount] DESCConfigure:
# Azure AI Foundry / Azure OpenAI
AZURE_OPENAI_ENDPOINT=https://your-resource-name.openai.azure.com/
AZURE_OPENAI_DEPLOYMENT=your-foundry-model-deployment-name
AZURE_OPENAI_API_KEY=your-azure-openai-key
AZURE_OPENAI_API_VERSION=2024-10-21
LANGCHAIN_MODEL=gpt-4o-mini
LANGCHAIN_TEMPERATURE=0
LANGCHAIN_SCHEMA_TABLE_LIMIT=30
LANGCHAIN_INCLUDE_SQL=falseSchema discovery tools read live metadata from SQL Server on each call.
This server cannot be deployed
Maintenance
Related MCP Connectors
Official Microsoft MCP Server to query Microsoft Entra data using natural language
- mcpOAuthcom.gibsonai
GibsonAI MCP server: manage your databases with natural language
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that connects AI assistants to Microsoft SQL Server databases, enabling schema exploration and read-only queries safely.495 npm4MIT
- AlicenseNot gradedqualityAmaintenanceMCP server for safely exposing SQL Server database capabilities to LLM clients, with read-only mode, security features, and observability.28MIT
- AlicenseAqualityAmaintenanceSecurity-first, read-only MCP server for Microsoft SQL Server, enabling safe natural-language querying of databases.57 npmMIT
- AlicenseAqualityBmaintenanceMCP server for Microsoft SQL Server that lets LLMs explore schema and execute read-only SELECT queries, with optional stored procedure execution when explicitly enabled.348 npmMIT