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.2.tar.gz (3.7 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.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcp_server_sql_inspector-0.1.2.tar.gz
  • Upload date:
  • Size: 3.7 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.2.tar.gz
Algorithm Hash digest
SHA256 1487fb97f2bc2f25ab5d922e1b9e240a9493cf7a1ba6dde5fb3549bb43f79f13
MD5 0fe2770492aa286624c17f747c0ed3ce
BLAKE2b-256 be07b12467ba7a27bd0c682db96af2face31456561315397184e5bf05eb880ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcp_server_sql_inspector-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3e7cedafe71050a65e817014762a61d7389e31d65f60d537eaa7df2b19457b93
MD5 b20fa590c5d12dda0275dc3b9672d29c
BLAKE2b-256 245b8e3b4ccb35223757a39ad2235fe4c0f760015589cba9ff36cb3b93a5531d

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