Metadata-Version: 2.3
Name: mcp-server-sql-inspector
Version: 0.1.0
Summary: A Model Context Protocol server that enables AI to inspect SQL databases and analyze query performance.
Author: Tam Dao
Author-email: daotam4536@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Provides-Extra: all
Provides-Extra: mssql
Provides-Extra: mysql
Provides-Extra: postgres
Requires-Dist: mcp[cli] (>=1.26.0)
Requires-Dist: mysql-connector-python ; extra == "mysql" or extra == "all"
Requires-Dist: psycopg2-binary ; extra == "postgres" or extra == "all"
Requires-Dist: pyodbc ; extra == "mssql" or extra == "all"
Requires-Dist: sqlalchemy (>=2.0.46)
Description-Content-Type: text/markdown

# MCP Server SQL Inspector

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

## Features

- **List Tables**: See all available tables in your database.
- **Get Schema**: detailed schema information including columns, types, primary keys, foreign keys, and indexes.
- **Table Statistics**: specific row counts to understand table size.
- **Explain Analyze**: Run `EXPLAIN ANALYZE` (or equivalent) on queries to get performance insights and execution plans.

## Installation

### Using `uv` (Recommended)

```bash
uvx mcp-server-sql-inspector
```

### From Source

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

### Docker

```bash
docker run -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:
   ```bash
   poetry install --extras all
   ```

2. Run the server:
   ```bash
   export DATABASE_URL="sqlite:///test.db"
   poetry run mcp-server-sql-inspector
   ```

## License

[MIT](LICENSE)

