{"id":50699645,"url":"https://github.com/ralscha/mssql-mcp","last_synced_at":"2026-06-09T08:32:52.587Z","repository":{"id":362919147,"uuid":"1261235948","full_name":"ralscha/mssql-mcp","owner":"ralscha","description":"MS SQL Server MCP server","archived":false,"fork":false,"pushed_at":"2026-06-06T14:15:22.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-06T15:23:16.439Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ralscha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-06T12:21:11.000Z","updated_at":"2026-06-06T14:15:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ralscha/mssql-mcp","commit_stats":null,"previous_names":["ralscha/mssql-mcp"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ralscha/mssql-mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Fmssql-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Fmssql-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Fmssql-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Fmssql-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ralscha","download_url":"https://codeload.github.com/ralscha/mssql-mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Fmssql-mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34098932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-09T08:32:50.915Z","updated_at":"2026-06-09T08:32:52.575Z","avatar_url":"https://github.com/ralscha.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mssql-mcp\n\nAn [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server that gives AI assistants structured, read-optimized access to Microsoft SQL Server databases. It exposes schema exploration, data profiling, relationship analysis, query explanation, and safe read/write operations through a standardized MCP interface.\n\n## Features\n\n- **23 MCP tools** covering schema search, table description, data profiling, relationship/dependency inspection, object listing, DDL inspection, query explanation, connection testing, and tiered write access\n- **Tiered access model** via `MSSQL_ACCESS_LEVEL`: `READONLY` (default), `DML-RW` (adds insert/update/delete), `DDL-RW` (adds create/drop table/index)\n- **SQL-safe design** with identifier quoting, multipart name validation, and read-only query enforcement\n- **Read-only query guard** that rejects mutating statements (`INSERT`, `UPDATE`, `DELETE`, `MERGE`, `CREATE`, `ALTER`, `DROP`, `TRUNCATE`, `EXEC`, etc.) on the `read_data` tool\n- **Mutation confirmation** with preview mode that shows affected rows before executing writes when `MSSQL_REQUIRE_CONFIRMATION` is enabled\n- **Explain plan** via `SHOWPLAN_XML` for understanding query performance\n- **Connection testing** that validates connectivity and reports latency\n- **Environment listing** showing current server, database, and access-level configuration\n\n## Installation\n\nDownload the latest release for your platform from the [Releases](https://github.com/ralscha/mssql-mcp/releases) page. \n\n## Usage\n\n### Environment Variables\n\n| Variable | Required | Default | Description |\n|----------|----------|---------|-------------|\n| `MSSQL_SERVER` | Yes | - | SQL Server hostname or IP |\n| `MSSQL_DATABASE` | Yes | - | Database name |\n| `MSSQL_USERNAME` | Yes | - | Login username |\n| `MSSQL_PASSWORD` | Yes | - | Login password |\n| `MSSQL_PORT` | No | `1433` | SQL Server port |\n| `MSSQL_ACCESS_LEVEL` | No | `READONLY` | `READONLY`, `DML-RW`, or `DDL-RW` |\n| `MSSQL_TRUST_SERVER_CERTIFICATE` | No | `false` | Trust self-signed certificates |\n| `MSSQL_CONNECTION_TIMEOUT` | No | `30` | Connection timeout in seconds |\n| `MSSQL_QUERY_TIMEOUT` | No | `120` | Query timeout in seconds |\n| `MSSQL_MAX_ROWS_DEFAULT` | No | `1000` | Default row limit for queries |\n| `MSSQL_REQUIRE_CONFIRMATION` | No | `true` | Require confirm flag for writes |\n| `MSSQL_TRANSPORT` | No | `stdio` | MCP transport: `stdio` or `sse` |\n| `MSSQL_HTTP_ADDR` | No | `:8080` | HTTP listen address when `MSSQL_TRANSPORT=sse` |\n| `MSSQL_SSE_PATH` | No | `/sse` | SSE endpoint path when `MSSQL_TRANSPORT=sse` |\n\n### Running as an MCP Server\n\nBy default, the server communicates over stdio. Configure your MCP client to launch it:\n\n```json\n{\n  \"mcpServers\": {\n    \"mssql\": {\n      \"command\": \"/path/to/bin/mssql-mcp\",\n      \"env\": {\n        \"MSSQL_SERVER\": \"localhost\",\n        \"MSSQL_DATABASE\": \"YourDatabase\",\n        \"MSSQL_USERNAME\": \"sa\",\n        \"MSSQL_PASSWORD\": \"YourPassword\",\n        \"MSSQL_TRUST_SERVER_CERTIFICATE\": \"true\",\n        \"MSSQL_ACCESS_LEVEL\": \"READONLY\"\n      }\n    }\n  }\n}\n```\n\nTo serve MCP over SSE instead, set `MSSQL_TRANSPORT=sse` and run the server as an HTTP process:\n\n```bash\nMSSQL_TRANSPORT=sse \\\nMSSQL_HTTP_ADDR=:8080 \\\nMSSQL_SSE_PATH=/sse \\\n/path/to/bin/mssql-mcp\n```\n\nThen configure an SSE-capable MCP client to connect to:\n\n```text\nhttp://localhost:8080/sse\n```\n\n### Access Levels\n\n- **`READONLY`** (default) - Schema exploration, object listing, data reading, profiling, relationship inspection, DDL inspection, query explanation, connection testing. 17 tools.\n- **`DML-RW`** - All read-only tools plus `insert_data`, `update_data`, `delete_data`. 20 tools.\n- **`DDL-RW`** - All DML tools plus `create_table`, `create_index`, `drop_table`. 23 tools.\n\nMutations (`update_data`, `delete_data`, `drop_table`) require a `\"confirm\": true` flag when `MSSQL_REQUIRE_CONFIRMATION` is enabled (the default). Without confirmation, the server returns a preview of the affected rows instead.\n\n## MCP Tools\n\n### Read-Only (READONLY)\n\n| Tool | Description |\n|------|-------------|\n| `search_schema` | Search tables and columns by name pattern with pagination |\n| `describe_table` | Get columns, primary keys, foreign keys, and indexes for a table |\n| `list_table` | List tables, optionally filtered by schema and name |\n| `list_databases` | List all databases on the server |\n| `list_environments` | Show current connection and access-level configuration |\n| `profile_table` | Row count, null counts, distinct counts, min/max per column, with optional data samples |\n| `inspect_relationships` | List foreign keys going out of and into a table |\n| `inspect_dependencies` | Find objects (views, procedures, functions) that depend on a table |\n| `explain_query` | Get the XML execution plan for a read-only query |\n| `read_data` | Execute a read-only SELECT query with row limits |\n| `test_connection` | Ping the server and return latency and server version info |\n| `validate_environment_config` | Validate that all environment variables are correctly configured |\n| `list_schemas` | List database schemas and owners |\n| `list_views` | List views and their definitions |\n| `list_triggers` | List table triggers, events, timing, and definitions |\n| `show_create_table` | Generate a CREATE TABLE statement for an existing table |\n| `table_size` | Report estimated row counts and table/index size in KB |\n\n### DML (DML-RW)\n\n| Tool | Description |\n|------|-------------|\n| `insert_data` | Insert one or more rows into a table |\n| `update_data` | Update rows matching a WHERE clause (with optional preview) |\n| `delete_data` | Delete rows matching a WHERE clause (with optional preview) |\n\n### DDL (DDL-RW)\n\n| Tool | Description |\n|------|-------------|\n| `create_table` | Create a table with column definitions, primary keys, and identity columns |\n| `create_index` | Create a standard or unique index on specified columns |\n| `drop_table` | Drop a table (with optional preview/confirmation) |\n\n## License\n\nMIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fralscha%2Fmssql-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fralscha%2Fmssql-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fralscha%2Fmssql-mcp/lists"}