mcp-sql-console
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-sql-consolelist all tables"
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.
MCP SQL Console
Production-ready monorepo that connects to Microsoft SQL Server LocalDB via:
An MCP server (stdio) for Cursor / Claude Desktop tools & resources
An HTTP API bridge sharing the same database service layer
A React + Vite + TypeScript console UI (search, sort, pagination)
Features
Connect to SQL Server or LocalDB with Windows Authentication or SQL Authentication
Expose the same database layer through MCP tools and a REST HTTP API
Run natural-language queries with local-first routing and optional LLM fallback
Browse tables, inspect columns, and view paginated records from the React console
Keep SQL execution read-only for safety in the console and MCP workflows
Quick start
git clone <your-repo-url>
cd mcp-sql-console
copy server\.env.example server\.env
npm install
npm approve-scripts msnodesqlv8 esbuild
npm rebuild msnodesqlv8
npm run devThen open:
Project structure
mcp-sql-console/
├── package.json # npm workspaces root
├── server/
│ ├── .env.example
│ ├── package.json
│ ├── scripts/sample-schema.sql
│ └── src/
│ ├── index.ts # MCP stdio entry
│ ├── http-server.ts # REST API for the React app
│ ├── config.ts
│ ├── db/sqlServerService.ts
│ ├── mcp/server.ts
│ ├── mcp/tools.ts
│ └── queries/predefined.ts
└── client/
├── .env.example
├── package.json
└── src/ # React UIPrerequisites
Node.js 20+
Microsoft SQL Server LocalDB (or full SQL Server)
ODBC Driver 17 or 18 for SQL Server (already common with SSMS / Azure Data Studio)
Windows Authentication via the native
msnodesqlv8driverVisual C++ Build Tools (only if the native addon needs to compile)
Start LocalDB if needed:
& "C:\Program Files\Microsoft SQL Server\170\Tools\Binn\SqlLocalDB.exe" start MSSQLLocalDBSetup
cd C:\Users\manoj.kumar\Projects\mcp-sql-console
copy server\.env.example server\.env
npm install
# Allow native install scripts (required once for msnodesqlv8 / esbuild)
npm approve-scripts msnodesqlv8 esbuild
npm rebuild msnodesqlv8Default connection (matches Azure Data Studio / SSMS):
Setting | Value |
Server |
|
Auth | Windows Authentication |
Database |
|
ODBC driver |
|
Encrypt |
|
Trust server certificate |
|
Optional sample table:
# Run server/scripts/sample-schema.sql in Azure Data Studio against LocalDBRun locally
Frontend + HTTP API (recommended for the UI)
npm run devHTTP API only
npm run dev:serverMCP server only (stdio)
npm run dev:mcpCursor MCP config example
Add to your Cursor MCP settings:
{
"mcpServers": {
"sql-console": {
"command": "npx",
"args": ["tsx", "src/index.ts"],
"cwd": "C:\\Users\\manoj.kumar\\Projects\\mcp-sql-console\\server",
"env": {
"DB_SERVER": "(localdb)\\MSSQLLocalDB",
"DB_DATABASE": "master",
"DB_USE_WINDOWS_AUTH": "true",
"DB_ENCRYPT": "true",
"DB_TRUST_SERVER_CERTIFICATE": "true"
}
}
}
}Natural language queries
Ask any question about the connected database. The MCP server owns the full flow for every call:
Read the live schema
Generate a read-only SQL query for that question
Execute it
Return JSON rows + the generated SQL
Examples that work against whatever tables exist:
list Departmentshow many Projectslist SalariesEmployees with DepartmentsAttendance where Status is Present
Engine selection (NL_ENGINE in server/.env):
Value | Behavior |
| Local/rich first; LLM only as fallback when needed |
| Always LLM |
| Never LLM |
Performance (minimal LLM)
Already implemented:
One-shot schema introspection — single SQL for all tables/columns (not N+1)
Schema cache (
NL_SCHEMA_CACHE_TTL_MS, default 5 min) + startup warm-upAnswer cache (
NL_ANSWER_CACHE_TTL_MS, default 1 min) — identical questions return instantlySQL plan cache (
NL_PLAN_CACHE_TTL_MS, default 10 min) — skips NL, re-runs SQL for fresh rowsIn-flight dedupe — concurrent identical asks share one pipeline
Local-first routing — rich/local before any LLM call
Relevant-schema LLM prompts — fewer tokens when LLM runs
Recommended .env:
NL_ENGINE=auto
LLM_MODEL=gpt-4o-mini
NL_SCHEMA_CACHE_TTL_MS=300000
NL_ANSWER_CACHE_TTL_MS=60000
NL_PLAN_CACHE_TTL_MS=600000For open-ended phrasing (aggregations, nuanced filters, multi-hop joins), set:
LLM_API_KEY=sk-...
NL_ENGINE=autoUI: Natural language mode at http://localhost:5173 (suggestion chips are generated from your live tables)
HTTP:
POST /api/askwith{ "question": "..." }MCP tool:
ask_natural_languageSchema:
GET /api/schema/ MCPget_schema
MCP tools
Tool | Purpose |
| NL → SQL → rows (recommended) |
| Connectivity check |
| Catalog of named queries |
| Execute a named query by id |
| Run a read-only |
| User tables in the current database |
| Columns for a table |
| Parameterized paginated table read |
Resource: sql://predefined-queries
HTTP API
Method | Path | Description |
GET |
| DB health |
GET |
| Predefined queries |
POST |
| Run predefined query |
POST |
| Body: |
POST |
| Body: |
GET |
| List tables |
GET |
| List columns |
GET |
| Paginated records |
Security notes
Console / MCP
execute_sqlallows read-onlySELECT/WITHstatements only.Table reads use parameterized
OFFSET/FETCHand validated identifiers.Prefer predefined queries for recurring access patterns.
Do not expose the HTTP API beyond localhost without auth / network controls.
SQL authentication fallback
If msnodesqlv8 cannot be installed, set in server/.env:
DB_USE_WINDOWS_AUTH=false
DB_USER=sa
DB_PASSWORD=YourStrong!Passw0rd
DB_SERVER=localhost(Tedious requires a TCP-reachable SQL Server instance; LocalDB usually needs the native driver.)
Expected UI
Matches the Phase 0 reference:
Purple “PHASE 0” badge, MCP SQL Console title, short description
Large SQL textarea + purple Run button
Status line (
N row(s) returned)Search box, sortable headers, paginated table, loading spinner, error state
Troubleshooting
If the native SQL driver fails to install, run
npm approve-scripts msnodesqlv8 esbuildandnpm rebuild msnodesqlv8again.If LocalDB is not reachable, start it with the PowerShell command shown above and verify that the server name matches your environment.
If you see missing ODBC errors, install ODBC Driver 17 or 18 for SQL Server.
For SQL Authentication fallback, set the
DB_USE_WINDOWS_AUTH,DB_USER, andDB_PASSWORDvalues in the server environment file.
Contributing
Contributions are welcome. If you plan to improve the UI, add new MCP tools, or refine the natural-language pipeline, please:
Fork the repository
Create a feature branch
Make your changes and test locally
Open a pull request with a clear summary
Publish to GitHub
If you want to publish this repository on GitHub, run:
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/<your-username>/<your-repo-name>.git
git push -u origin mainLicense
This project is licensed under the MIT License. See the LICENSE file for details.
Scripts
Command | Description |
| API + React together |
| HTTP API with reload |
| Vite only |
| MCP stdio server |
| Build server + client |
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/ManojPabani/mcp-sql-console'
If you have feedback or need assistance with the MCP directory API, please join our Discord server