MCP SQL Server
Provides SQL database connectivity and query execution capabilities for MySQL databases through SQLAlchemy, enabling AI agents to run SELECT queries, DML operations (INSERT, UPDATE, DELETE), and DDL statements (CREATE, ALTER) with configurable safety restrictions.
Provides SQL database connectivity and query execution capabilities for PostgreSQL databases through SQLAlchemy, enabling AI agents to run SELECT queries, DML operations (INSERT, UPDATE, DELETE), and DDL statements (CREATE, ALTER) with configurable safety restrictions.
Provides SQL database connectivity and query execution capabilities for SQLite databases through SQLAlchemy, enabling AI agents to run SELECT queries, DML operations (INSERT, UPDATE, DELETE), and DDL statements (CREATE, ALTER) with configurable safety restrictions.
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 Servershow me the top 10 customers by total purchase amount"
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 Server (Development)
A professional MCP server to connect any MCP-compatible LLM to a SQL database and execute:
Queries (
SELECT,WITH,SHOW, etc.)DML (
INSERT,UPDATE,DELETE)DDL (
CREATE,ALTER, and optionallyDROP/TRUNCATE)
This server is designed for personal use in assisted development.
Features
MCP protocol via stdio (compatible with MCP clients).
Multi-engine connection via
SQLAlchemy(sqlite,postgresql,mysql,mssql, etc.).MCP tools focused on daily operations:
sql_capabilitiessql_list_tablessql_describe_tablesql_runsql_run_script
Destructive DDL blocking by default (
DROP/TRUNCATEblocked).Configurable row and statement limits per script.
Related MCP server: FastMCP MySQL Server
Installation
python -m venv .venv
source .venv/bin/activate
pip install -e .Configuration (environment variables)
Prefix: MCP_SQL_
MCP_SQL_DATABASE_URL: SQLAlchemy URL. Default:sqlite:///./dev.dbMCP_SQL_MAX_ROWS: maximum rows returned per query. Default:200MCP_SQL_MAX_SCRIPT_STATEMENTS: maximum statements per script. Default:100MCP_SQL_ALLOW_DESTRUCTIVE_DDL:true/falseto allowDROPandTRUNCATE. Default:false
Example
export MCP_SQL_DATABASE_URL='postgresql+psycopg://dev_user:dev_pass@localhost:5432/devdb'
export MCP_SQL_MAX_ROWS=500
export MCP_SQL_ALLOW_DESTRUCTIVE_DDL=falseRunning the server
mcp-sql-serverYou can also run it as a module:
python -m mcp_sql_server.serverDouble-click startup on Windows
The file start_mcp_sql_server.bat is included to facilitate startup:
Automatically creates
.venv(if it doesn't exist).Installs/updates dependencies.
Starts the MCP server.
Just double-click that .bat file.
Configuration in an MCP client (generic example)
{
"mcpServers": {
"sql-dev": {
"command": "mcp-sql-server",
"env": {
"MCP_SQL_DATABASE_URL": "sqlite:///./dev.db",
"MCP_SQL_MAX_ROWS": "200",
"MCP_SQL_ALLOW_DESTRUCTIVE_DDL": "false"
}
}
}
}Recommended workflow
sql_capabilitiesto verify active configuration.sql_list_tablesto explore the schema.sql_describe_tableto inspect metadata.sql_runfor specific queries or DML.sql_run_scriptfor batches of controlled changes.
Best practices for assisted development
Use database users with minimal privileges.
Work on a local development DB or disposable snapshot.
Keep
MCP_SQL_ALLOW_DESTRUCTIVE_DDL=falseby default.Version structural changes with migrations.
Security note
This project is not hardened for production. It is oriented toward local productivity in development environments.
Claude in VS Code guide
Check README_CLAUDE_VSCODE.md for a complete configuration and usage example.
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
- AlicenseBqualityDmaintenanceAn MCP server that connects AI assistants to Microsoft SQL Server databases, enabling schema exploration and read-only queries safely.49234MIT
- AlicenseNot gradedqualityDmaintenanceA secure and efficient MCP server for MySQL database operations, enabling LLMs to execute SQL queries with read-only access by default and optional write permissions.3MIT
- AlicenseNot gradedqualityBmaintenanceA multi-database MCP server that enables LLMs to safely interact with MySQL, PostgreSQL, SQLite, and others through a unified tool interface, with permission modes and schema resources.2065MIT
- AlicenseAqualityAmaintenanceA read-only MCP server that exposes SQL database access to LLMs, supporting multiple database types, compact columnar results, pagination, and file export.622MIT
Related MCP Connectors
GibsonAI MCP server: manage your databases with natural language
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
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/miguel1603/MCP-SQL'
If you have feedback or need assistance with the MCP directory API, please join our Discord server