sql-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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 deployed
Maintenance
Related MCP Connectors
Hosted MySQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
The official MCP Server for the Mux API
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA TypeScript-based MCP server that facilitates SQL query execution and MySQL database connectivity using environment variables.299 npmMIT
- AlicenseNot gradedqualityDmaintenanceA 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.1MIT
- FlicenseNot gradedqualityDmaintenanceA 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-
- AlicenseBqualityDmaintenanceAn 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.2MIT