An automatic TOP 1000 on queries is the difference between a model exploring a production table and a model pulling several million rows into a context window. Combined with `search_tables` and `get_table_info` returning samples, the exploration loop works without anyone knowing the schema first. Install the ODBC driver before anything else — most of the reported failures start there.
A Python server for Microsoft SQL Server that goes beyond running queries: it inspects schema, reports table size and performance metrics, returns execution plans, searches for tables and columns by name, and can back a table up or insert into one. Queries get an automatic row limit so an unqualified SELECT does not return the whole table.
- `execute_query` runs SQL with an automatic limit — TOP 1000 by default
- `get_schema` inspects the database structure; `get_table_info` returns detail for one table with sample rows
- `search_tables` finds tables and columns by name, for when you know the concept but not the object
- `explain_query` returns the execution plan
- `get_table_stats` reports size and performance metrics
- `backup_table` creates a table backup; `insert_data` writes rows with conflict handling
- `check_connection` reports connectivity, with connection pooling and health checks underneath
SQL Server credentials in five environment variables: `SQL_SERVER_HOST`, `SQL_SERVER_DATABASE`, `SQL_SERVER_USERNAME`, `SQL_SERVER_PASSWORD` and `SQL_SERVER_PORT`. Microsoft ODBC Driver 17 for SQL Server must be installed, which is the usual first stumble. Create a virtualenv, `pip install -r requirements.txt`, then run `python -m sql_server_mcp.server`. Project `sql-server-mcp`, version 1.0.0. Two of the tools write — `backup_table` and `insert_data` — so the database user's permissions decide what is actually reachable.
Build from source — clone the repository and build it, then point your client at the binary
