MSSQL Tiny MCP Server connects Codex and other MCP-aware agents to SQL Server or Azure SQL with local setup, read-only query guardrails, and schema discovery.
MSSQL Tiny MCP Server is a small, local-first development utility, not a packaged database product. The tool helps developers use Codex and other MCP-aware agents (i.e. Claude) connect to Microsoft SQL Server and Azure SQL with a practical setup and read-only guardrails.
This tool uses Microsoft’s official mssql-python driver, loads a repo-local .env, and keeps the surface area small. It offers health checks, connection warmup, schema and table inspection, and guarded read-only query execution.
This project is intentionally narrow. It is for local development, private internal tooling, database analysis and planning, and safe data inspection workflows. It is not an admin console, migration runner, or write-capable SQL automation layer.
* Local-first MCP server over **stdio**
* Microsoft SQL Server and Azure SQL connectivity via **mssql-python**
* Authentication handled through a standard **SQL connection string** in repo-local `.env`
* Safe, **read-only SQL execution** with read-only prefix checks, blocked keywords, and multi-statement rejection
* Database, schema, table, view, key, identity, computed-column, default, and foreign-key discovery helpers
* Sensitive column name hints for names like `password`, `token`, `secret`, `key`, `salt`, and `hash`
* Configurable query timeout and row caps
* `healthcheck()` and `warmup()` helpers for startup diagnostics
* Lightweight smoke test and unit tests
* Safer than generic SQL MCP servers
* Easy analysis and inspection of SQL databases
* Matches execution-focused database and DevOps workflows
* Can be extended later with export helpers and workflow-specific Codex skills
* Not a full SQL Server admin tool
* Not a replacement for database permissions
* Does not run writes, DDL, or stored procedures
* Does not manage login provisioning or Azure setup
View project and clone from Github here –
https://github.com/compkick/mcp-sql-tiny
* **Python 3.10+**
* Windows, macOS, or Linux
* Access to Microsoft SQL Server, Azure SQL Database, or Azure SQL Managed Instance
* Codex or another MCP-aware coding agent
For quickstart, setup, usage and testing, check the Readme.md in project files
Add this to your Codex config file:
“`toml
[mcp_servers.mssql_tiny]
command = ‘PROJECT_DIR\mcp-sql-tiny\.venv\Scripts\python.exe’
args = [‘PROJECT_DIR\mcp-sql-tiny\mssql_mcp_server.py’]
“`
Replace `PROJECT_DIR` with the full path to the parent folder where you cloned the repo.
The database connection values stay in this repo’s local `.env`, not in Codex `config.toml`.
This project uses semantic versioning. `0.1.1` is the current project version.
### 0.1.1
Verification and release-readiness cleanup.
Included in this release:
* General `tools\verify_venv.py` helper for Python virtual-environment sanity checks across projects
* `.env` verification through `python-dotenv`, including import, load, and key-count checks
* Added `list_databases()` for server-level database discovery
* Added `list_views()` and expanded `list_schemas()` / `list_tables()` with optional database targeting
* Expanded `describe_table()` to support `database.schema.table` names plus keys, identity columns, computed columns, defaults, foreign keys, row estimates, and sensitive-name hints
* Added configurable query timeout support through `MSSQL_QUERY_TIMEOUT_SECONDS`
* Added sensitive-column risk hints to query and metadata results
* README release-readiness status and updated live-test instructions
### 0.1.0
First project release of the MSSQL Tiny MCP Server.
Included in this release:
* Core MCP tools for `ping`, `healthcheck`, `verify_environment`, `discover_context`, `list_databases`, `list_schemas`, `list_tables`, `list_views`, `describe_table`, `run_query_preview`, and `run_query_readonly`
* Read-only SQL enforcement with query timeout, row caps, and multi-statement rejection
* Rich `describe_table()` metadata for keys, identity columns, computed columns, defaults, foreign keys, row estimates, and sensitive-name hints
* Opt-in live integration tests through the `RUN_LIVE_TESTS` switch and `live` pytest marker
* `warmup()` and `healthcheck()` helpers for startup diagnostics and connection testing
* Local `.env` loading via `python-dotenv` and a matching `.env.example`
* Smoke test script via `python test_server.py`
* Pytest coverage for local safety and query-construction logic
* MIT licensing and versioned dependency ranges in `requirements.txt`
* README setup guidance for local SQL Server and Azure SQL connection-string-based authentication
This project is licensed under the MIT License. You are free to use, modify, and distribute the software under the terms of the included license.
The software is provided “as is”, without warranty of any kind, and the authors are not liable for any claims, damages, or other liability arising from its use.
* `export_query_jsonl(sql, path)`
* `export_query_parquet(sql, path)`
* Stored procedure introspection helpers that remain read-only
* Deeper view definition and dependency introspection
* Python package artifacts (`pyproject.toml`, wheel, source distribution)
* Structured logging
* Containerization (Docker)
* Optional connection profiles for local SQL Server, Azure SQL Database, and managed identity scenarios
* Codex skills for common MSSQL workflows such as schema exploration, query shaping, performance triage, and safe troubleshooting playbooks
See project documentation in the repo README.md, which covers installation, setup and usage.
For implementation questions, issue reporting, or enhancement requests, use the GitHub issue tracker:
https://github.com/compkick/mcp-sql-tiny
For other questions, use our contact form to get in touch.