sualeh/schemacrawler-ai-sqlserver-perf
If you are the rightful owner of schemacrawler-ai-sqlserver-perf and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
SchemaCrawler AI MCP Server for SQL Server Performance is a Python-based server utilizing Fast MCP to connect to databases, execute SQL queries, and return results in JSON format.
SchemaCrawler AI MCP Server for SQL Server Performance
This is a Python MCP Server using Fast MCP. Each MCP tool will make a connection to a database, execute SQL and return the results as JSON. The SQL is hardcoded but is a template - parts of the SQL including table names may be replaced based on tool parameters.
Available MCP Tools
Database Connection Tool
Tests database connectivity and returns SQL Server version information.
Top 10 Queries Tool
Retrieves the top 10 SQL queries by performance metrics from SQL Server Dynamic Management Views (DMVs). Accepts a metric parameter to choose the ordering criteria:
- cpu: Top 10 queries by average CPU time (worker time) per execution
- reads: Top 10 queries by average logical reads per execution
- time: Top 10 queries by average elapsed time per execution
Returns query text, execution count, and relevant performance metrics for performance analysis and optimization.
Column Statistics Tool
Analyzes table structure and provides column metadata including data types, nullability, precision, and table row counts. Accepts database name, schema name, and table name as parameters and returns results in INFORMATION_SCHEMA format for easy identification.
For detailed documentation on the Column Statistics Tool, see .
Development
-
Clone the repository:
git clone https://github.com/sualeh/schemacrawler-ai-sqlserver-perf.git cd schemacrawler-ai-sqlserver-perf
-
Install Poetry if not already installed:
curl -sSL https://install.python-poetry.org | python3 -
-
Install dependencies:
poetry install
-
Run tests:
# Run all tests with coverage poetry run pytest --cov=schemacrawler_ai_sqlserver_perf --cov-report=html
# Run specific test file poetry run pytest tests/test_version_tool.py -v
-
Run the server:
poetry run python -m schemacrawler_ai_sqlserver_perf.main
Using Docker
-
Build Docker image locally:
docker build -t schemacrawler/schemacrawler-ai-sqlserver-perf:latest .
-
Run Docker container:
docker run -d -p 8000:8000 schemacrawler/schemacrawler-ai-sqlserver-perf:latest