SQL File ExplainerIt explains your SQL file. No live database, no API key required, no network by default. A Visual Studio Code extension that explains your SQL schema and migration files directly inside
the editor — as a chat participant, a right-click command, or a standalone MCP server for other AI
tools. It reads only the Table of Contents
AboutYou open a schema you didn't design, or a migration someone else wrote, and you need to know what
it does. Ask, and get an answer grounded in the actual No database connection. No credentials. Nothing invented — if it's not in your schema, the answer says so instead of guessing. Why This ExtensionMost "chat with your database" tools solve a different problem: connect to a live database and ask analytics questions about the data inside it. That space is already crowded — Microsoft ships schema-aware Copilot chat natively for SQL Server and PostgreSQL, and open-source engines like Vanna.ai already do live-database Q&A well. What none of them cover is the narrower, file-only case: understanding structure, not data, with no live connection at all.
Meet SchemerEvery answer inside VS Code comes from Schemer — the persona behind the
Say hello with FeaturesCore Engine (Local RAG Pipeline)
Chat, Commands & Settings
Beyond the MVP
Tested, Not Just Written
InstallationSQL File Explainer is not yet published to the VS Code Marketplace. Until then, install it from
source or from a packaged From a
|
| Command | What it does |
|---|---|
SQL File Explainer: Explain this SQL file |
Summarizes and explains the table(s) in the selected .sql file |
SQL File Explainer: Set Cloud API Key |
Stores a cloud provider API key securely in SecretStorage |
@schemer <question> |
Ask Schemer anything about your indexed tables, in Copilot Chat |
Settings
| Setting | Default | Description |
|---|---|---|
sqlFileExplainer.provider |
local |
local (Ollama) or cloud (bring-your-own-key) |
sqlFileExplainer.cloudProviderKind |
anthropic |
anthropic or openai, used when provider is cloud |
sqlFileExplainer.embeddingProvider |
hashing |
hashing (default, no extra install) or transformers-js (richer, requires npm install @xenova/transformers) |
sqlFileExplainer.schemaFolderPath |
schema |
Relative path to the folder containing SQL files |
sqlFileExplainer.cloudApiKey |
(empty) | Stored via SecretStorage. Do not edit this in settings.json |
How It Works
.sql files
│
├─▶ 1. WATCH detect create/change/delete under the schema folder
├─▶ 2. PARSE node-sql-parser → tables, columns, types, foreign keys
├─▶ 3. CHUNK one chunk per table, related tables attached as metadata
├─▶ 4. EMBED local embedding (hashing, or transformers.js if enabled)
├─▶ 5. INDEX local vector store, cached to disk, updated incrementally
├─▶ 6. RETRIEVE question → embedding → top-k matching chunks
├─▶ 7. GROUND chunks + question → a prompt Schemer can only answer from
└─▶ 8. ANSWER local Ollama or your own cloud key, streamed into chat
Nothing in steps 1–6 ever leaves your machine. Only step 8 can reach the network, and only if you have explicitly configured a cloud provider.
MCP Server
The same engine that powers the VS Code chat participant is also available as a standalone Model Context Protocol server, so any MCP-compatible client — Cursor, Windsurf, Claude Code — can ask it the same questions.
npm run mcp:start -- <path-to-schema-folder>
This exposes two tools:
| Tool | Arguments | Returns |
|---|---|---|
askQuestion |
question: string |
A grounded answer with source citations |
explainFile |
filePath: string |
An explanation of the table(s) in that file |
Build From Source
# 1. Clone
git clone https://github.com/aflinrinosha2004/sql-schema-copilot.git
cd sql-schema-copilot
# 2. Install dependencies
npm install
# 3. Build (esbuild, bundles the extension, the MCP server, and the tests)
npm run compile
# 4. Run the engine unit tests (no VS Code host required)
npm run test:unit
# 5. Run the full suite, including VS Code integration tests
npm test
# 6. Launch the Extension Development Host
# Press F5 in VS Code
| Script | Purpose |
|---|---|
npm run compile |
Production build via esbuild |
npm run watch |
Rebuild on save |
npm run test:unit |
Engine unit tests only, no VS Code host |
npm test |
Full suite, including VS Code integration tests |
npm run mcp:start -- <folder> |
Run the standalone MCP server against a schema folder |
Contributing
Contributions are welcome — especially additional SQL dialect support, new chat follow-ups, and more engine test coverage.
- Fork the repository and create a feature branch
- Keep the shared contract in mind: the parsing layer produces
ParsedSchema, the engine implementsSchemaEngine(explainFile,askQuestion) — changes to either shape affect both sides - Add or update tests under
src/test/suite/ - Run
npm run compile && npm run test:unitbefore opening a pull request
Roadmap
- [ ] Additional SQL dialect support (MySQL, SQLite, SQL Server syntax variants)
- [ ] Multi-file relationship graph rendered visually in a webview
- [ ] Chat commands for migration diff and type generation directly from
@schemer - [ ] VS Code Marketplace publish
Have a request? Open an issue.
License
This project is released under the MIT License. You are free to use, modify, and distribute it under the terms of this license. See the LICENSE file for the full text.
Acknowledgments
Built with these open-source projects:
- node-sql-parser — parses SQL DDL into a structured AST
- Model Context Protocol SDK — powers the standalone MCP server
- esbuild — bundles the extension, tests, and MCP server
- VS Code Extension API — the Chat Participant API that gives Schemer a home in Copilot Chat
Authors
SQL File Explainer is designed and built by two co-authors:
- Aflin Rinosha S (@aflinrinosha2004) - author
- Anand Sundaramoorthy SA - co-author
Contact Us
If you have any questions, feedback, or suggestions, feel free to reach out to the authors:
- Aflin Rinosha S: aflinrinosha2004@gmail.com
- Anand Sundaramoorthy SA: sanand03072005@gmail.com
Made by Aflin Rinosha S and Anand Sundaramoorthy SA · MIT License