sqlglass MCP server
SQL Server / Azure SQL for agents: real schema, lint, read-only runs, plans, write previews.
0 stars13 downloads/wk
Reviews
Write oneNobody has reviewed sqlglass yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
sqlglass tools (29, 5 write)
write = sends, deletes, buys or postsRead from the package source without running it. The installed server may list more.
analyze_sqlWhat a query touches: tables/views, columns per table, CTEs, parameters and its output columns.
build_create_tablewrite actionGenerate a CREATE TABLE script (TEXT ONLY -- this server never runs DDL; the user reviews and runs it). Checked against the cached schema: the name must be free, foreign keys must point at a real primary/unique key with the same column types, FK columns get an index, constraints get conventional names, and the script is wrapped in IF OBJECT_ID(...) IS NULL so it can be re-run. Returns sql + undo_s
build_procedureGenerate a CREATE OR ALTER PROCEDURE script (TEXT ONLY -- never executed here) around a query. Give inline 'sql', or a library 'query' -- then its header params (name, type, default) become the procedure's parameters automatically. Every @variable in the body must be a typed parameter. params: [{"name": "@StartDate", "type": "date", "default": "'2026-01-01'", "description": "first order date"}] Re
build_selectGenerate a SELECT from the cached schema: names validated, joins inferred from foreign keys (bridge tables added automatically), aliases assigned, GROUP BY derived. Returns SQL text only; nothing is executed.
build_viewGenerate a CREATE OR ALTER VIEW script (TEXT ONLY -- never executed here) from a SELECT or a library query. Refuses what a view cannot contain: parameters, DECLARE, ORDER BY without TOP.
delete_querywrite actionRemove a query from the library. Its text is kept in a snapshot, so restore_snapshot brings it back.
describe_tableColumns (type, nullability, identity/computed), primary key, indexes, foreign keys in both directions and row count of one table or view. Always do this before writing SQL against a table.
explain_queryEstimated execution plan, summarised: the expensive operators, scans on big tables, key lookups, sorts, implicit conversions, optimizer warnings and missing-index suggestions. The query is compiled, NOT executed, so this is safe on heavy queries. (SQL Server login needs the SHOWPLAN permission.)
extract_parameterTurn a hard-coded value in a saved query into a parameter: every occurrence of the literal ('2026-01-01', 100) becomes @param, and a '-- param:' header line is added with the old value as its default.
find_join_pathHow two tables relate: the shortest chain of declared foreign keys between them, as ready-to-use JOIN lines.
find_usageImpact analysis: which saved queries read a given table/view (and optionally a given column of it). Ask this before a table or column is changed, renamed or retired.
format_sqlPretty-print T-SQL in one canonical style. Normalises cosmetics (adds AS to aliases, rewrites '[x] = expr' aliases to 'expr AS [x]'); meaning is unchanged. Comments inside expressions may move.
get_queryOne saved query: header fields, parameters, the SQL, what tables it touches, and lint findings.
lint_libraryLint every saved query (against each query's cached connection schema when available). Catches queries broken by a schema change: run it after refresh_schema.
lint_sqlCheck a query for correctness traps (NOT IN + NULLs, LEFT JOIN turned INNER by WHERE, join without ON, TOP without ORDER BY), performance problems (functions on filtered columns, SELECT *, NOLOCK, leading-wildcard LIKE) and style. With a connection whose schema is cached, also verifies every table and column exists.
list_connectionsList the configured database connections (from sqlglass.toml), which is the default, where the query library lives, and whether each connection has a cached schema.
list_queriesBrowse the saved-query library. 'search' matches id, name, description and the SQL text; 'tag' filters by tag.
list_snapshotsBefore-images taken automatically ahead of every library write, newest first.
list_tablesList tables and views with row counts and descriptions. Filter by schema name and/or a name pattern ('*invoice*'). For a big database prefer search_schema.
preview_writewrite actionDry-run a write WITHOUT writing: converts one UPDATE / DELETE / INSERT into the read-only SELECT that shows what it would do, plus a COUNT(*) of affected rows. The write statement itself is never sent to the database. UPDATE -> key columns + each SET column as '[col (current)]' / '[col (new)]' (changed_only=true hides no-op rows) DELETE -> the rows that would be removed (and which child tables ref
profile_tablePer-column row count, NULLs, distinct values, min and max, in one aggregate query. Use it to learn a column's grain and range before filtering or joining on it. Up to 15 columns per call.
refresh_schemaRe-read tables, views, columns, keys, indexes and foreign keys from the database into the local cache. Run this when a table or column seems to be missing, or after the database changed.
rename_in_libraryFollow a database rename through every saved query, token-aware (strings and comments untouched). kind='table': old='dbo.Vendor', new='dbo.Supplier' kind='column': table='dbo.Vendor', old='Name', new='VendorName' (alias-qualified references, and bare ones in single-table queries; ambiguous bare references are reported, not changed). dry_run defaults to TRUE: review the diff, then call again with d
restore_snapshotwrite actionPut the queries in a snapshot back to how they were before that write ('latest' = undo the last write). The restore is itself snapshotted, so it can be undone too.
run_querywrite actionRun a read-only query and return the first rows. Give either inline 'sql' or a library 'query' (id or name). params: {"@Start": "2026-01-01"}; library queries fall back to their header defaults. Anything but SELECT/WITH is refused before reaching the database. Rows are capped at the connection's max_rows (lower it with max_rows=); to look at big data, aggregate in SQL.
sample_tableA few rows of a table or view, to see what the values actually look like.
save_querySave a query to the library as <id>.sql (id may contain folders: 'purchasing/open-pos-by-vendor'). sql is the body only -- do not DECLARE the parameters in it; describe them in params: [{"name": "@Start", "type": "date", "default": "'2026-01-01'", "description": "first order date"}] Updating an existing query needs overwrite=true; header fields left empty keep their current value. kind='script' st
search_schemaFind tables and columns whose name contains the text (or matches a * ? wildcard pattern), plus tables whose description mentions it. The way to locate data in an unfamiliar database.
translate_sqlTranslate a query between dialects (tsql, postgres, mysql, sqlite, snowflake, bigquery, databricks, oracle, duckdb, redshift): TOP<->LIMIT, ISNULL/COALESCE, GETDATE, DATEADD, string functions, quoting.
Public scan report
scanner v0.1.10 · 2026-11-01 · same rubric, same numbers if you re-run it
- Code scan24 source files scanned25/25
- –Live reliabilityno gateway calls yet and no remote to proben/a
- –Tool poisoningtools not inspected (local package is not executed); not countedn/a
- Auth qualitylocal package, no credentials required12/15
- Maintenancerepository not readable: repo not found3/15
- Maintainer identityno repository or website to verify2/10
How sqlglass compares
Against every graded Databases MCP server, from our own scans and uptime checks. Updated after each scan run.
- Safety score
- 65/100
- higher than 15% of 802 Databases servers
- Tools
- 29
- the typical Databases server has 8
- Tools that change things
- 17%
- typical: 10%. Fewer write tools means less an agent can break
- Downloads a week
- 13
- more than 3% of 324 Databases servers with a package
What its tools let an agent do: 22 read · 1 create · 4 change · 1 delete · 1 run or deploy
Install sqlglass in Claude Code, Cursor or VS Code
claude mcp add sqlglass -- uvx sqlglass
What the publisher says
From the sqlglass repository's README, as published. We do not edit it. Read it on GitHub
sqlglass
<!-- mcp-name: io.github.S-CurveLabs/sqlglass -->
An MCP server that gives GitHub Copilot (VS Code agent mode) — or any MCP client — what it lacks when writing SQL for SQL Server / Azure SQL: the real schema, a safe way to try a query, the optimizer's opinion of it, and a managed library of the queries you keep.
Read-only, in layers
before a connection is opened. Because T-SQL needs no semicolons, any write/DDL/EXEC keyword anywhere outside a string, comment or [quoted name] rejects the batch — including SELECT … INTO, OPENROWSET, sp/xp, WAITFOR.
- Guard – the statement is tokenised; anything but SELECT / WITH … SELECT (plus DECLARE / SET @var) is refused
read-only with ApplicationIntent=ReadOnly.
- Transaction – every query runs with autocommit off and is always rolled back. The ODBC connection is opened
explainquery uses SET SHOWPLANXML ON: the server compiles the query and executes nothing.
- Limits – rows are capped (maxrows, default 200) and queries time out (timeoutseconds, default 30).
That is the layer the server itself enforces; use it for anything that matters.
- Yours to add – point the connection at a login that only has db_datareader (+ GRANT SHOWPLAN for plans).
Values go in as bound parameters (params={"@Start": "2026-01-01"}), not pasted into SQL text. Passwords are never stored: SQL-auth connections name an environment variable (password_env).
Writes and DDL: previewed and scripted, never executed
The server has no write mode. Instead:
previewwrite turns one write statement into read-only SQL (plus a COUNT() of affected rows) and can run it:
UPDATE h SET h.Status = 'CLOSED' FROM dbo.PoHeader h JOIN dbo.Vendor v ON ... WHERE v.Country = 'US'
-- becomes
SELECT [h].[PoId], [h].[Status] AS [Status (current)], 'CLOSED' AS [Status (new)]
FROM dbo.PoHeader AS h JOIN dbo.Vendor AS v ON ... WHERE v.Country = 'US'UPDATE → key columns + a current/new pair per SET column (changed_only=true hides no-op rows, NULL-safe via EXCEPT); DELETE → the rows that would go, plus which child tables reference them; INSERT → the rows that would be added under the target's column names, plus NOT NULL columns left unsupplied. MERGE is refused with advice to split it. The generated text must itself pass the read-only guard before it is returned. Triggers, cascades and constraint failures are not simulated.
buildcreatetable / buildprocedure / buildview return DDL text (sql, undosql, notes) for a person to review and run in SSMS. Checked against the cached schema: the name must be free, foreign keys must reference a real primary/unique key with matching types (and get an index), constraints get conventional names, CREATE TABLE is wrapped in IF OBJECTID(...) IS NULL. buildprocedure(query="open-po-value-by-vendor") wraps a library query and turns its header params into typed procedure parameters; every @variable must be declared. savequery(kind="script") keeps a script in the library — versioned with the queries, never linted as a query, never runnable through the server.
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
Grade history
- 2026-11-01downgradeA → Cscore 65
sqlglass: common questions
- Is sqlglass MCP server safe?
- With care: it is graded C, so read the findings first (65/100). Read the sqlglass safety report
- How do I install sqlglass?
- It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
- Does sqlglass need an API key?
- No secret keys are declared. It reads 1 setting from the environment.
- Is sqlglass maintained?
- The last commit was 41 days ago (2026-09-22). The latest release is v0.1.0.
- What can I use instead of sqlglass?
- Servers from other publishers that do the same job: LINQ to DB MCP server, QueryWeaver MCP server and Grain SQL MCP server.
- How does sqlglass compare with other Databases MCP servers?
- safety score 65/100 (higher than 15% of 802 Databases servers); tools 29 (the typical Databases server has 8); tools that change things 17% (typical: 10%. Fewer write tools means less an agent can break). Full comparison.
Alternatives to sqlglass
Same job from other publishers: the closest match first, then the best rated.
- LINQ to DBInspect database schemas and execute SQL queries across multiple database providers with LINQ to DB.not reviewedEstablishedA
- QueryWeaverAn MCP server for Text2SQL: transforms natural language into SQL using graph schema understanding.not reviewedGrowingA
Grain SQLRun SQL queries and inspect database schemas through safe, visible MCP tools.not reviewedGrowingB- IBM Db2 for iRead-only SQL queries and schema inspection for IBM Db2 for i over ODBC, JT400 or Mapepire (SSH).not reviewedGrowingA
NeoSQL MCPSchemas, SQL, ERDs, and codegen for PostgreSQL, MySQL, Oracle, SQLite, and more via NeoSQL Desktop.not reviewedGrowingA