Skip to main content

MCP Server SQL Inspector

PyPI version

A Model Context Protocol (MCP) server that enables AI to inspect SQL databases and analyze query performance.

Tools

  • list_tables: List tables in the database.
  • get_schema: Get schema definition for one or more tables.
    • table_names (list): List of table names to inspect.
  • get_table_stats: Get estimated row count for a table.
  • run_explain: Analyze a query execution plan.
    • query: The SQL query to analyze (SELECT only).
    • just_explain_plan (optional): If true, gets the plan without running the query (default: False).

Installation

Using uv (Recommended)

When using uv no installation is necessary. You can run the server directly:

uvx mcp-server-sql-inspector

Configuration with Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "sql-inspector": {
      "command": "uvx",
      "args": ["mcp-server-sql-inspector"],
      "env": {
        "DATABASE_URL": "postgresql://user:password@localhost:5432/dbname"
      }
    }
  }
}

Local Development Configuration

If you are developing the server locally and want to test changes in Claude Desktop:

{
  "mcpServers": {
    "sql-inspector": {
      "command": "/absolute/path/to/mcp-server-sql-inspector/.venv/bin/mcp-server-sql-inspector",
      "args": [],
      "env": {
        "DATABASE_URL": "sqlite:///demo.db"
      }
    }
  }
}

From Source

git clone <repository-url>
cd mcp-server-sql-inspector
poetry install --extras all

Docker

Build the image:

docker build -t mcp-server-sql-inspector .

Run the container:

docker run -i --rm -e DATABASE_URL="postgresql://user:password@host:port/dbname" mcp-server-sql-inspector

Docker Configuration for Claude Desktop

{
  "mcpServers": {
    "sql-inspector": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e", "DATABASE_URL=postgresql://user:password@host:port/dbname",
        "mcp-server-sql-inspector"
      ]
    }
  }
}

Configuration

The server requires a DATABASE_URL environment variable to connect to your database.

Supported database protocols (requires appropriate drivers):

  • PostgreSQL: postgresql://...
  • MySQL: mysql://...
  • MSSQL: mssql+pyodbc://...
  • SQLite: sqlite:///...

Development

  1. Install dependencies:

    poetry install --extras all
    
  2. Run the server:

    export DATABASE_URL="sqlite:///test.db"
    poetry run mcp-server-sql-inspector
    

License

MIT

Metadata

Release files for mcp-server-sql-inspector 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-server-sql-inspector 0.1.3
File Size Uploaded Provenance
mcp_server_sql_inspector-0.1.3.tar.gz 3.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-server-sql-inspector 0.1.3
File Interpreter ABI Platform
mcp_server_sql_inspector-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 8.7 kB

Release files / mcp_server_sql_inspector-0.1.3.tar.gz

Download URL mcp_server_sql_inspector-0.1.3.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f5d7eb818c64e28d1b36f1350f8273d7e2d1b3afdc4a5637b5e371d8ea8b8fdf
BLAKE2b-256 checksum
How to use checksums
002da48122c7fd1bfec882a111c5c28d495f82d92f0c6d629a7cfc85635f090e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.5 Darwin/25.1.0

Release files / mcp_server_sql_inspector-0.1.3-py3-none-any.whl

Download URL mcp_server_sql_inspector-0.1.3-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b83bcfb7b83dfb8f3f9374f187bfb52e4d2df957174a9ada7442438dd5c1290
BLAKE2b-256 checksum
How to use checksums
e1cbdd3afdccbae128a7b2f741dbd3bcde3b0bceddd84f30849bf28dc1ac8179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.5 Darwin/25.1.0

Security for mcp-server-sql-inspector 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page