Skip to main content
Glama
sql-mcp
by edintwi

sql-mcp

Local MCP server exposed over HTTP that runs inside Docker and provides a single query tool against a PostgreSQL database supplied via DATABASE_URL.

Configure

cp .env.example .env
# edit .env and set DATABASE_URL

Related MCP server: Postgres MCP Server

Run with Docker

docker compose up --build

The MCP endpoint is then available at http://localhost:3000/mcp.

Run locally (without Docker)

npm install
npm run build
npm start
# or, for hot reload:
npm run dev

Register with an MCP client

Point your MCP-compatible client at the streamable HTTP endpoint:

http://localhost:3000/mcp

The transport is streamable-http. Initialize the session with a standard MCP initialize request; subsequent requests must include the mcp-session-id header returned by the server.

Tool

  • query({ sql: string, params?: unknown[] }) — runs a parameterized SQL statement and returns { command, rowCount, rows } as JSON. Use $1, $2, ... in sql and pass values in params.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables secure querying of PostgreSQL databases through MCP-compatible clients. Supports read-only SQL execution, table exploration, and connection management with built-in security validation.
      3
      45 npm
      9
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables querying and modifying PostgreSQL databases through MCP tools with read/write operations, schema inspection, and write-safety constraints that limit modifications to the mcp schema.
      1
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with PostgreSQL databases through MCP, supporting queries, DDL, DML, and schema inspection.
      70 PyPI
      6
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables querying PostgreSQL databases via MCP, with multi-database routing, credential isolation, and truncated results plus full CSV export.
      -