sql-mcp
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-mcplist databases and then select the 'sales' 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 MCP Gateway (NestJS)
NestJS-based MCP server for MySQL with session-level database selection and SQL safety controls.
Features
MCP tools:
list_databasesconnect_mysql_userselect_databaseexecute_sql
Two transports:
HTTP (
/mcp) via streamable HTTP sessionsstdio (
--stdio) for command-based MCP auto-start
SQL controls:
SQL_MODE:SAFE|WRITE|FULLmode categories:
SAFE=>DQLWRITE=>DQL,DMLFULL=>DQL,DML,DDL,TCL,DCL
hard block on destructive statements like
DROP,TRUNCATE,ALTER DATABASE/SCHEMA,RENAME TABLE
Related MCP server: KatCoder MySQL MCP Server
Project Structure
src/
main.ts
app.module.ts
config/
sql/
mcp/
scripts/
run-stdio.shSetup
npm install
cp .env.example .env.env.example:
MCP_HOST=0.0.0.0
MCP_PORT=8787
MCP_PATH=/mcp
MCP_SERVER_NAME=sql-mcp
MCP_SERVER_VERSION=2.0.0
DATABASE_HOST=127.0.0.1
DATABASE_PORT=3306
SQL_MODE=SAFERun
HTTP mode (manual)
npm startEndpoint: http://localhost:8787/mcp
stdio mode (auto-start via command MCP)
Build once:
npm run buildThen run:
scripts/run-stdio.shOr:
node build/main.js --stdioMCP_TRANSPORT=stdio also enables stdio mode.
Cursor Config (~/.cursor/mcp.json)
Recommended: command mode (auto-start)
{
"mcpServers": {
"sql-mcp": {
"command": "/ABSOLUTE/PATH/TO/sql-mcp/scripts/run-stdio.sh",
"env": {
"MCP_SQL_USER": "your_mysql_user",
"MCP_SQL_PASSWORD": "your_mysql_password"
}
}
}
}Notes:
Replace
/ABSOLUTE/PATH/TO/sql-mcpwith your actual repo path.MCP_SQL_USER/MCP_SQL_PASSWORDare optional. If omitted, useconnect_mysql_userfrom chat.
Alternative: URL mode (manual server)
{
"mcpServers": {
"sql-mcp": {
"url": "http://localhost:8787/mcp",
"headers": {
"x-sql-user": "your_mysql_user",
"x-sql-password": "your_mysql_password"
}
}
}
}Use this only when the HTTP server is running.
Tool Workflow
If credentials are preconfigured (command env or URL headers)
list_databasesselect_databaseexecute_sql
If credentials are not preconfigured
connect_mysql_userselect_databaseexecute_sql
Security
Keep credentials only in user-level
~/.cursor/mcp.json.Do not commit project-level
.cursor/mcp.json.
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.
Related MCP Servers
- Alicense-qualityDmaintenanceA TypeScript-based MCP server that facilitates SQL query execution and MySQL database connectivity using environment variables.85MIT
- Flicense-qualityDmaintenanceA secure MySQL Model Context Protocol server that enables AI agents to interact with MySQL databases through standardized operations. Features comprehensive security with SQL injection prevention, connection pooling, and configurable tool access for database operations.1
- Flicense-qualityDmaintenanceA high-performance MCP server that enables AI assistants to safely interact with MySQL databases through secure CRUD operations, schema inspection, and parameterized queries with built-in SQL injection prevention.1
- FlicenseBqualityCmaintenanceAn MCP server for MySQL that enables users to execute SQL queries, inspect table structures, and explore database schemas through a clean, SOLID-based architecture. It includes built-in security validations to protect against dangerous operations and ensure safe interaction with database resources.2
Related MCP Connectors
MCP server for managing Prisma Postgres.
MCP (Model Context Protocol) server for Appwrite
MCP server for interacting with the Supabase platform
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/arpitg-cashify/sql-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server