Skip to main content
Glama

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 optionally DROP/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_capabilities

    • sql_list_tables

    • sql_describe_table

    • sql_run

    • sql_run_script

  • Destructive DDL blocking by default (DROP/TRUNCATE blocked).

  • 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.db

  • MCP_SQL_MAX_ROWS: maximum rows returned per query. Default: 200

  • MCP_SQL_MAX_SCRIPT_STATEMENTS: maximum statements per script. Default: 100

  • MCP_SQL_ALLOW_DESTRUCTIVE_DDL: true/false to allow DROP and TRUNCATE. 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=false

Running the server

mcp-sql-server

You can also run it as a module:

python -m mcp_sql_server.server

Double-click startup on Windows

The file start_mcp_sql_server.bat is included to facilitate startup:

  1. Automatically creates .venv (if it doesn't exist).

  2. Installs/updates dependencies.

  3. 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"
      }
    }
  }
}
  1. sql_capabilities to verify active configuration.

  2. sql_list_tables to explore the schema.

  3. sql_describe_table to inspect metadata.

  4. sql_run for specific queries or DML.

  5. sql_run_script for 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=false by 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.

Install Server
F
license - not found
A
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    B
    quality
    D
    maintenance
    An MCP server that connects AI assistants to Microsoft SQL Server databases, enabling schema exploration and read-only queries safely.
    49
    23
    4
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A 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.
    3
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    A 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.
    20
    65
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    A read-only MCP server that exposes SQL database access to LLMs, supporting multiple database types, compact columnar results, pagination, and file export.
    6
    22
    MIT

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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