home / mcp / sql mcp server

SQL MCP Server

Provides SQL database access (MySQL/PostgreSQL) via a configurable MCP gateway.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "algonacci-mcp-sql": {
      "command": "uv",
      "args": [
        "--directory",
        "%USERPROFILE%/Documents/GitHub/mcp-sql",
        "run",
        "python",
        "main.py"
      ]
    }
  }
}

This MCP server lets clients access SQL databases (MySQL and PostgreSQL) through a lightweight, configurable gateway. It enables you to run SQL queries and retrieve results without exposing direct database connections to your clients, improving security and control.

How to use

You run the SQL MCP server as part of your MCP environment and connect to it through your MCP client. The server is configured to start a Python-based script via a lightweight runner, exposing SQL access capabilities to authorized clients. Use it to execute queries against your supported databases and return results to your applications. Ensure your client is set up to target this MCP server by using its configured name and environment as part of your MCP workspace.

How to install

Prerequisites you need before getting started: Python 3.x installed on your system.

Create or verify your MCP configuration directory and the MCP config snippet that defines this server.

Steps to set up and run the SQL MCP server use the following flow. Adapt paths to your environment as needed.

# Step 1: Create the MCP configuration and include the SQL MCP server
# Use your preferred MCP manager to apply configuration. The example below follows the provided snippet.
{
  "mcpServers": {
    "sql_access": {
      "command": "uv",
      "args": [
        "--directory",
        "%USERPROFILE%/Documents/GitHub/mcp-sql",
        "run",
        "python",
        "main.py"
      ]
    }
  }
}

Additional notes

This server is configured as a local (stdio) MCP endpoint. It does not expose a remote URL in the basic setup. The command to run is provided as part of the MCP configuration, and the runtime is the uv runner executing the Python script located in the specified directory.

Configuration, security, and troubleshooting

- The server entry is named sql_access and uses a stdio connection type. It runs the Python-based main.py script through the uv runner. - No explicit environment variables are shown for this server in the configuration snippet.