Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_server_sql_inspector-0.1.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_server_sql_inspector-0.1.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server_sql_inspector-0.1.3.tar.gz.

File metadata

  • Download URL: mcp_server_sql_inspector-0.1.3.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.5 Darwin/25.1.0

File hashes

Hashes for mcp_server_sql_inspector-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f5d7eb818c64e28d1b36f1350f8273d7e2d1b3afdc4a5637b5e371d8ea8b8fdf
MD5 aaf3ba6f44624113644def3ad4ade298
BLAKE2b-256 002da48122c7fd1bfec882a111c5c28d495f82d92f0c6d629a7cfc85635f090e

See more details on using hashes here.

File details

Details for the file mcp_server_sql_inspector-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_sql_inspector-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5b83bcfb7b83dfb8f3f9374f187bfb52e4d2df957174a9ada7442438dd5c1290
MD5 7965c938efd44616f42e7be37d482bfc
BLAKE2b-256 e1cbdd3afdccbae128a7b2f741dbd3bcde3b0bceddd84f30849bf28dc1ac8179

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page