Command Palette

Search for a command to run...

UnylyUnyly
Browse all

SqlExecutorMCP

FreeNot checked

MCP server that lets AI agents work SQL Server and MySQL safely: allowlisted targets, statement-type gating, and destructive ops split into their own tools.

GitHubEmbed

About

MCP server that lets AI agents work SQL Server and MySQL safely: allowlisted targets, statement-type gating, and destructive ops split into their own tools.

README

Python MCP SQL Server MySQL License: MIT

An MCP server that lets AI agents work with real databases without handing them the keys to the kingdom. It speaks to SQL Server and MySQL over named connections, and every request passes through an allowlist and a statement-type gate before it touches an engine.

I built it because I point Claude at working databases every day, and "the agent can run whatever SQL it wants" was never going to fly. It's wired into my own Claude Code sessions as I type this.

The safety model

This is the part I care about. Three layers, all enforced server-side:

  1. Named connections only. The agent never sees a connection string. It asks for a connection by name, and credentials live in a local config.json that never leaves the machine.
  2. Per-connection allowlists. Each connection declares which databases and schemas are fair game ("*" is available, but it's an explicit opt-in). Anything outside the list raises a permission error before any SQL runs.
  3. Statement-type gating. Every statement is parsed with sqlparse and its type is checked against the tool that submitted it:
    • execute_query accepts SELECT and CALL, nothing else
    • execute_statement accepts INSERT, UPDATE, CREATE, ALTER, and MERGE
    • DELETE and DROP each require their own dedicated tool, so a destructive statement can't ride in on a generic call
    • TRUNCATE is blocked everywhere, full stop

Transactions get the same treatment: execute_transaction runs a batch of DML atomically, and the MySQL adapter knows that DDL there commits implicitly, so it won't pretend a DDL rollback would have worked.

Tools

Tool What it does
list_connections Show the named connections and what they allow
list_databases List databases visible on a connection
list_tables List tables in a database
describe_table Columns, types, and nullability for a table
get_table_constraints Keys, foreign keys, and constraints
get_schema Broader schema snapshot for orientation
preview_table Peek at the first rows without writing SQL
execute_query Read-only SELECT / CALL
execute_statement Gated writes: INSERT, UPDATE, CREATE, ALTER, MERGE
execute_transaction A batch of DML statements, all-or-nothing
delete_statement DELETE, and only DELETE
drop_statement DROP, and only DROP

Setup

pip install -e .
cp config.template.json config.json   # connections + allowlist, see the template

Then register it with your MCP client (Claude Code / Claude Desktop shown):

{
  "mcpServers": {
    "sql-executor": { "command": "sql-executor-mcp" }
  }
}

Stack

Python 3.10+ · FastMCP · pyodbc · mysql-connector-python · sqlparse

from github.com/TylerBuilds-Official/SqlExecutorMCP

Install SqlExecutorMCP in Claude Desktop, Claude Code & Cursor

Recommended · one command, every IDE
unyly install sqlexecutormcp

Installs into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.

First time? Get the CLI: curl -fsSL https://unyly.org/install | sh

Or configure manually

Run in your terminal:

claude mcp add sqlexecutormcp -- uvx --from git+https://github.com/TylerBuilds-Official/SqlExecutorMCP sql-executor-mcp

Step-by-step: how to install SqlExecutorMCP

FAQ

Is SqlExecutorMCP MCP free?

Yes, SqlExecutorMCP MCP is free — one-click install via Unyly at no cost.

Does SqlExecutorMCP need an API key?

No, SqlExecutorMCP runs without API keys or environment variables.

Is SqlExecutorMCP hosted or self-hosted?

Self-hosted: the server runs locally on your machine via the install command above.

How do I install SqlExecutorMCP in Claude Desktop, Claude Code or Cursor?

Open SqlExecutorMCP on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.

Related MCPs

Compare SqlExecutorMCP with

Not sure what to pick?

Find your stack in 60 seconds

Author?

Embed badge for your README

Browse similar

All data MCPs