sql-preview 0.5.11 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +289 -0
- package/README.md +222 -71
- package/dist/mcp-app.html +99028 -0
- package/media/icon.png +0 -0
- package/out/server/standalone.js +66398 -24988
- package/package.json +53 -357
- package/server.json +58 -0
- package/out/common/errors.js +0 -31
- package/out/common/errors.js.map +0 -1
- package/out/common/types.js +0 -11
- package/out/common/types.js.map +0 -1
- package/out/server/ConsoleLogger.js +0 -46
- package/out/server/ConsoleLogger.js.map +0 -1
- package/out/server/Daemon.js +0 -537
- package/out/server/Daemon.js.map +0 -7
- package/out/server/DaemonMcpServer.js +0 -63
- package/out/server/DaemonMcpServer.js.map +0 -1
- package/out/server/DaemonMcpToolManager.js +0 -433
- package/out/server/DaemonMcpToolManager.js.map +0 -1
- package/out/server/DaemonQueryExecutor.js +0 -96
- package/out/server/DaemonQueryExecutor.js.map +0 -1
- package/out/server/FileConnectionManager.js +0 -108
- package/out/server/FileConnectionManager.js.map +0 -1
- package/out/server/SessionManager.js +0 -103
- package/out/server/SessionManager.js.map +0 -1
- package/out/server/SocketTransport.js +0 -77
- package/out/server/SocketTransport.js.map +0 -1
package/Changelog.md
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.6.1] - 2026-05-29
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Moved the welcome guide into the SQL Preview panel instead of opening a separate editor tab.
|
|
10
|
+
- Routed connection management actions to Settings > Connections instead of opening the raw daemon localhost URL.
|
|
11
|
+
- Fixed welcome guide connection summary state so existing active profiles are detected.
|
|
12
|
+
- Replaced raw "Session not found" query failures with clear rerun guidance when the daemon restarts during an in-flight query.
|
|
13
|
+
- Fixed settings refresh so a missing telemetry preference keeps the 0.6.1 default enabled state instead of clearing the checkbox.
|
|
14
|
+
- Removed the inactive "Start using SQL Preview" welcome action.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Reworked the welcome guide into a reusable guide hub with multi-database, VS Code/Cursor, MCP, first-query, and latest-highlight sections.
|
|
19
|
+
- Added a Settings > About action to reopen the welcome guide at any time.
|
|
20
|
+
- Added Markdown export for the welcome guide and exposed the same guide as an MCP Markdown resource for agents.
|
|
21
|
+
- Switched SQL Preview product telemetry to enabled by default when VS Code telemetry is enabled, with opt-out available in Settings.
|
|
22
|
+
|
|
23
|
+
## [0.6.0] - 2026-05-28
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- Added RFC-017 daemon configuration loading with strict JSON defaults, file/env/CLI precedence, validation, source reporting, and a read-only `/config` endpoint.
|
|
28
|
+
- Added documentation and RFC agent guidance for docs stewardship, in-progress RFC tracking, and RFC-to-code commit traceability.
|
|
29
|
+
- Added explicit VS Code active connection selection so users can choose which saved profile runs `.sql` queries.
|
|
30
|
+
- Added PostHog-backed product telemetry plumbing with VS Code telemetry gating, schema validation, safe query buckets, and transparency metadata.
|
|
31
|
+
- Added a General settings telemetry control so users can enable or opt out from the SQL Preview panel.
|
|
32
|
+
- Added RFC-048 query operation contracts with structured MCP results for query execution and tab page retrieval.
|
|
33
|
+
- Added multi-surface tab projection so daemon result tabs can be rendered across VS Code and the browser without session/tab ID collisions.
|
|
34
|
+
- Added RFC-047 daemon surface composition docs and `/status` surface diagnostics for HTTP, MCP HTTP, WebSocket, IPC socket, and stdio readiness.
|
|
35
|
+
- Added package-owned connector descriptors for built-in connector metadata, lazy factories, and dynamic connection form schemas.
|
|
36
|
+
- Added RFC-052 welcome UX and connector migration planning, plus RFC-053 agent skills integration planning.
|
|
37
|
+
- Added the RFC-052 welcome guide with legacy settings migration, migrated-profile connection testing, and explicit telemetry opt-in.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- Made daemon PID-file cleanup verify an existing process via `/status` before terminating it, avoiding unsafe PID reuse kills.
|
|
42
|
+
- Applied the same safe PID verification to the extension daemon client before it terminates stale daemon PIDs.
|
|
43
|
+
- Hardened daemon subprocess connector cleanup with early close/error listeners, bounded stderr capture, abort escalation, and child cleanup for connection tests.
|
|
44
|
+
- Closed stale daemon HTTP MCP sessions instead of only dropping map entries, and included them in resource-change broadcasts.
|
|
45
|
+
- Aborted direct daemon HTTP query execution when clients disconnect before a response is sent.
|
|
46
|
+
- Redacted sensitive MCP request headers in daemon logs while preserving non-secret diagnostics.
|
|
47
|
+
- Added WebSocket MCP message-size enforcement and BigInt-safe serialization to match daemon socket transport behavior.
|
|
48
|
+
- Enforced daemon per-session tab limits during query execution to prevent unbounded result tab growth.
|
|
49
|
+
- Hardened daemon tab/query lifecycle cleanup so closed or reused tabs abort stale queries and cannot lose newer abort controllers.
|
|
50
|
+
- Enforced daemon query timeouts so long-running connector calls receive an abort signal and report a clear timeout error.
|
|
51
|
+
- Bundled the WebSocket runtime into daemon builds so packaged VS Code installs can start `out/server/standalone.js` without relying on an excluded `node_modules/ws` dependency.
|
|
52
|
+
- Fixed Trino connection tests from the Connections panel so they use the same saved credentials and Basic Auth path as normal query execution.
|
|
53
|
+
- Improved Connections panel test-result visibility by wrapping full error details instead of truncating them inline.
|
|
54
|
+
- Fixed ambiguous multi-profile query routing by honoring `sqlPreview.activeConnectionId` before falling back to connector type or list order.
|
|
55
|
+
- Fixed connection password commands so they target the active/selected connection instead of silently updating the first saved profile.
|
|
56
|
+
- Fixed unsaved Trino connection tests so form-entered passwords produce the required Basic Auth header.
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- Updated the RFC process to include an `inprogress` lifecycle folder and implementation tracking expectations.
|
|
61
|
+
- Routed MCP, VS Code, and browser query execution through a shared daemon query operation lifecycle.
|
|
62
|
+
- Refactored daemon HTTP, MCP Streamable HTTP, WebSocket MCP, IPC socket MCP, and stdio MCP wiring into explicit `src/server/surfaces/` modules.
|
|
63
|
+
- The Connections panel now shows per-connection password status and native Set/Clear actions without exposing stored secrets to the webview.
|
|
64
|
+
- Reorganized the MCP Server settings tool list into clearer grouped sections with short descriptions.
|
|
65
|
+
- The browser session sidebar now filters the shared results layout and routes tab close, cancel, select, and rerun actions through session-aware daemon APIs.
|
|
66
|
+
|
|
67
|
+
## [0.5.12] - 2026-02-19
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
|
|
71
|
+
- **Modular Connection Profiles**: Implemented a robust connection management system supporting multiple profile stores (File, Environment Variables) and secure credential handling.
|
|
72
|
+
- **Environment Configuration**: Added support for configuring connections via `SQL_PREVIEW_CONNECTIONS` environment variable.
|
|
73
|
+
- **Profile Management**: Updated Daemon to serve as the single source of truth for connection profiles.
|
|
74
|
+
|
|
75
|
+
### Fixed
|
|
76
|
+
|
|
77
|
+
- **Connection Listing**: Fixed `list_connections` tool to correctly return full profile details (excluding passwords) ensuring the extension can execute queries reliably.
|
|
78
|
+
|
|
79
|
+
## [0.5.11] - 2026-02-16
|
|
80
|
+
|
|
81
|
+
### Fixed
|
|
82
|
+
|
|
83
|
+
- **MCP Connection**: Resolved issues with MCP server startup and connection handling.
|
|
84
|
+
- **Testing**: Fixed failing unit and integration tests.
|
|
85
|
+
|
|
86
|
+
## [0.5.1] - 2026-02-04
|
|
87
|
+
|
|
88
|
+
### Added
|
|
89
|
+
|
|
90
|
+
- **Version Checking**: Added automated version checking for extension updates.
|
|
91
|
+
- **Testing**: Added comprehensive unit tests for `ResultsViewProvider`'s version check and webview message handling.
|
|
92
|
+
|
|
93
|
+
## [0.5.0] - 2026-01-30
|
|
94
|
+
|
|
95
|
+
### Architecture
|
|
96
|
+
|
|
97
|
+
- **Daemon Process**: Introduced a standalone `Daemon` service to decouple query execution and state management from the VS Code extension host. This improves stability and enables persistent sessions.
|
|
98
|
+
- **MCP Server Refactor**: Completely rewrote the MCP Server (`DaemonMcpServer`) to run within the Daemon, providing robust tool management and better integration with LLM agents.
|
|
99
|
+
|
|
100
|
+
### Added
|
|
101
|
+
|
|
102
|
+
- **RFC Documentation**: Added RFCs 000-005 covering Roadmap, Agentic Testing, Single Server Architecture, MCP UI, and Session Security.
|
|
103
|
+
- **Comprehensive Testing**: Added extensive unit and integration tests (~9.5k lines changed) covering Daemon, MCP, ConnectionManager, and Query execution.
|
|
104
|
+
- **Session Management**: Implemented `SessionManager` and `DaemonClient` for robust state handling across extension reloads.
|
|
105
|
+
|
|
106
|
+
### Changed
|
|
107
|
+
|
|
108
|
+
- **Query Execution**: Refactored `QueryExecutor` to support distinct execution modes and better error handling.
|
|
109
|
+
- **Repository**: Renamed repository to `sql-preview` and updated all internal references.
|
|
110
|
+
|
|
111
|
+
## [0.4.2] - 2026-01-27
|
|
112
|
+
|
|
113
|
+
### Added
|
|
114
|
+
|
|
115
|
+
- **Filter Improvements**: Added a "Select All" checkbox to the column set filter, enabling easier bulk selection and deselection of visible items.
|
|
116
|
+
|
|
117
|
+
### Fixed
|
|
118
|
+
|
|
119
|
+
- **Data Parsing Integrity**: Fixed a critical issue where high-precision decimal numbers (e.g. `1932.53...`) were incorrectly parsed as "Invalid Number" or strings. The parser now intelligently handles BigInts while preserving standard floating point numbers for correct display and sorting.
|
|
120
|
+
|
|
121
|
+
## [0.3.9] - Unreleased
|
|
122
|
+
|
|
123
|
+
### Added
|
|
124
|
+
|
|
125
|
+
- **Open Source Preparation**:
|
|
126
|
+
- Added MIT License and updated copyright year to 2026.
|
|
127
|
+
- Added Security Policy (`SECURITY.md`) and Code of Conduct (`CODE_OF_CONDUCT.md`).
|
|
128
|
+
- Created Contribution Guidelines (`CONTRIBUTING.md`) and Developer Guide (`ARCHITECTURE.md`).
|
|
129
|
+
- Added GitHub Issue and Pull Request templates.
|
|
130
|
+
- configured GitHub Actions for CI/CD (lint, test, build).
|
|
131
|
+
- Added Dependabot configuration.
|
|
132
|
+
- **Testing & Quality**:
|
|
133
|
+
- Added `test:coverage` script for test coverage reporting.
|
|
134
|
+
- Improved unit test reliability (password management tests).
|
|
135
|
+
- Adopted strict linting and formatting standards.
|
|
136
|
+
- **Codebase**:
|
|
137
|
+
- Replaced console logs with structured `Logger` in MCP Server.
|
|
138
|
+
- Cleaned up unused dependencies (`body-parser`, `glob`, etc.).
|
|
139
|
+
|
|
140
|
+
## [0.3.8] - 2026-01-20
|
|
141
|
+
|
|
142
|
+
### Added
|
|
143
|
+
|
|
144
|
+
- **UI UX Polish**:
|
|
145
|
+
- Implemented "native-like" grid selection feel by removing browser text overlay.
|
|
146
|
+
- Enhanced copy/paste functionality to reliably copy rows as TSV with headers.
|
|
147
|
+
- Added persistence for "Row Height" preference (Normal, Compact, Comfortable).
|
|
148
|
+
- Unified gutter selection styling for a consistent visual experience.
|
|
149
|
+
|
|
150
|
+
### Changed
|
|
151
|
+
|
|
152
|
+
- **Architecture**: Decoupled MCP Server from `ResultsViewProvider` for better modularity and stability.
|
|
153
|
+
- **MCP Server**: Improved robustness of server startup/shutdown to prevent `EADDRINUSE` and `ERR_SERVER_NOT_RUNNING` errors.
|
|
154
|
+
|
|
155
|
+
### Fixed
|
|
156
|
+
|
|
157
|
+
- **Runtime Stability**: Resolved race conditions in MCP server lifecycle.
|
|
158
|
+
- **Styling**: Fixed AG Grid focus ring issues and selection color inconsistencies.
|
|
159
|
+
|
|
160
|
+
## [0.2.4] - 2026-01-12
|
|
161
|
+
|
|
162
|
+
### Fixed
|
|
163
|
+
|
|
164
|
+
- **State Persistence**: Resolved persistent test failures and ensured `workspaceState` is correctly managed.
|
|
165
|
+
- **Results Provider**: Fixed memory leaks by cleaning up event listeners on disposal.
|
|
166
|
+
- **Linting**: Addressed numerous code style and type safety issues (removed console logs, fixed strict types).
|
|
167
|
+
|
|
168
|
+
## [0.2.2] - 2025-12-08
|
|
169
|
+
|
|
170
|
+
### Added
|
|
171
|
+
|
|
172
|
+
- **Tab Naming Configuration**: Added `sqlPreview.tabNaming` setting to switch between `file-sequential` (Result 1, Result 2) and `query-snippet` naming.
|
|
173
|
+
- **Settings Organization**: Organized settings into transparent groups: Connection, Display, and Advanced (Beta).
|
|
174
|
+
|
|
175
|
+
### Fixed
|
|
176
|
+
|
|
177
|
+
- **Tab Naming**: Fixed issue where tabs would revert to query snippet naming during loading.
|
|
178
|
+
- **Loading UX**: Improved loading experience by hiding the empty grid and random headers while the query executes.
|
|
179
|
+
|
|
180
|
+
## [0.2.1] - 2025-12-01
|
|
181
|
+
|
|
182
|
+
### Added
|
|
183
|
+
|
|
184
|
+
- **MCP Server**: Added Model Context Protocol (MCP) server feature for enhanced context awareness.
|
|
185
|
+
|
|
186
|
+
### Fixed
|
|
187
|
+
|
|
188
|
+
- **Persistence**: Fixed issues with state persistence.
|
|
189
|
+
- **Tab Management**: Fixed tab focus issues and added comprehensive tests for tab management.
|
|
190
|
+
- **Sync**: Fixed MCP synchronization issues.
|
|
191
|
+
|
|
192
|
+
## [0.2.0] - 2025-11-30
|
|
193
|
+
|
|
194
|
+
### Added
|
|
195
|
+
|
|
196
|
+
- **AG Grid Improvements**:
|
|
197
|
+
- Added copy functionality for rows, columns, and cells.
|
|
198
|
+
- Added query tooltips.
|
|
199
|
+
- Added column datatypes display in headers.
|
|
200
|
+
- **Run in New Tab**: Added capability to execute queries in a new tab.
|
|
201
|
+
- **JSON Viewer**: Added a JSON viewer for better data inspection.
|
|
202
|
+
|
|
203
|
+
### Changed
|
|
204
|
+
|
|
205
|
+
- **AG Grid Standardization**:
|
|
206
|
+
- Restored standard column menu.
|
|
207
|
+
- Enhanced context menu.
|
|
208
|
+
- Updated scrollbar styling.
|
|
209
|
+
- **Refactor**: Moved column type display to tooltips and fixed selection behavior.
|
|
210
|
+
|
|
211
|
+
### Fixed
|
|
212
|
+
|
|
213
|
+
- **Windows Compatibility**: Addressed further Windows-specific bugs.
|
|
214
|
+
- **Network**: Fixed HTTPS request handling.
|
|
215
|
+
|
|
216
|
+
## [0.1.6] - 2025-11-07
|
|
217
|
+
|
|
218
|
+
### Fixed
|
|
219
|
+
|
|
220
|
+
- Work around Porta returning "Empty query not supported" for valid SQL when using the Trino client. The extension now executes the first page via direct HTTPS POST to `/v1/statement` with Trino and Presto headers, then follows `nextUri` using HTTP GET. This mirrors clients like DataGrip and restores compatibility.
|
|
221
|
+
- Pagination: continue even when `columns` are not present in the first response (some clusters send columns on later pages).
|
|
222
|
+
- Export flow aligned to the same direct POST + pagination path for consistency.
|
|
223
|
+
|
|
224
|
+
### Added
|
|
225
|
+
|
|
226
|
+
- Probes to diagnose connectivity quickly:
|
|
227
|
+
- `npm run probe` (multiple HTTP variants)
|
|
228
|
+
- `npm run probe:extension` (matches extension path end-to-end)
|
|
229
|
+
- `.env.local` workflow (git-ignored) and `env.example` for credentials during local probes.
|
|
230
|
+
|
|
231
|
+
### Added
|
|
232
|
+
|
|
233
|
+
- Initial VS Code extension setup for Presto/Trino database connections
|
|
234
|
+
- **Secure password storage** using VS Code's SecretStorage API
|
|
235
|
+
- Password management commands for secure credential handling
|
|
236
|
+
- **Settings UI integration** for password management with "Set Password" button
|
|
237
|
+
- Command palette integration with `Presto: Run Query` command
|
|
238
|
+
- Code lens provider for executing SQL queries directly from editor
|
|
239
|
+
- Results view panel with Tabulator integration for data visualization
|
|
240
|
+
- Configuration setting for maximum rows to display (`presto.maxRowsToDisplay`)
|
|
241
|
+
- Pagination support for fetching large result sets
|
|
242
|
+
- Visual styling improvements for the results grid:
|
|
243
|
+
- Integration with VS Code theme
|
|
244
|
+
- Row number column
|
|
245
|
+
- Improved formatting and density
|
|
246
|
+
- Header styling enhancements
|
|
247
|
+
- Connection handling with authentication support
|
|
248
|
+
- Error handling and display in the results view
|
|
249
|
+
- Query execution status indicators
|
|
250
|
+
- Dynamic theme color integration with VS Code:
|
|
251
|
+
- Table adapts to user's selected theme
|
|
252
|
+
- Row backgrounds, text colors, and borders match theme
|
|
253
|
+
- Support for light, dark, and high-contrast themes
|
|
254
|
+
- Live theme updates when user changes VS Code theme
|
|
255
|
+
|
|
256
|
+
### Changed
|
|
257
|
+
|
|
258
|
+
- **SECURITY**: Removed plaintext password storage from settings - now uses secure VS Code SecretStorage
|
|
259
|
+
- Replaced Tabulator with AG Grid for the results view, providing enhanced features and a more modern grid experience.
|
|
260
|
+
- Enabled floating filters by default in the AG Grid results view for easier column-specific filtering.
|
|
261
|
+
- Updated results display to use Tabulator for better data visualization
|
|
262
|
+
- Improved results panel styling to better match VS Code themes
|
|
263
|
+
- Enhanced query result handling with pagination support
|
|
264
|
+
- Switched from `client.execute()` to `client.query()` for compatibility
|
|
265
|
+
- Refactored CSS to use theme variables for consistent styling
|
|
266
|
+
|
|
267
|
+
### Fixed
|
|
268
|
+
|
|
269
|
+
- **Windows Compatibility**: Fixed "path must not be empty" error during extension activation on Windows systems
|
|
270
|
+
- Added comprehensive path validation and normalization for cross-platform compatibility
|
|
271
|
+
- Enhanced webview resource path handling with graceful fallback mechanisms
|
|
272
|
+
- Implemented proper error handling and logging for path-related issues
|
|
273
|
+
- Added validation for extension URI and resource roots to prevent empty path errors
|
|
274
|
+
- Improved extension activation robustness with detailed error reporting
|
|
275
|
+
- Properly mocked filesystem dependencies in tests instead of bypassing validation
|
|
276
|
+
- Resolved pagination issues when fetching large result sets
|
|
277
|
+
- Fixed layout and styling issues in the results view
|
|
278
|
+
- Corrected variable declarations (let vs const) based on usage patterns
|
|
279
|
+
- Addressed linter errors and warnings
|
|
280
|
+
- Fixed module resolution for the Results View Provider
|
|
281
|
+
- Resolved connection and authentication issues with Trino client
|
|
282
|
+
|
|
283
|
+
### Developer Improvements
|
|
284
|
+
|
|
285
|
+
- Added ESLint configuration
|
|
286
|
+
- Configured TypeScript compilation settings
|
|
287
|
+
- Added proper module structure and organization
|
|
288
|
+
- Implemented better error handling and logging
|
|
289
|
+
- Created theme-aware UI components for improved user experience
|
package/README.md
CHANGED
|
@@ -1,106 +1,257 @@
|
|
|
1
|
-
# SQL Preview
|
|
1
|
+
# SQL Preview
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
**A fast SQL workspace for VS Code and MCP-enabled AI agents.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Run SQL in VS Code, manage database profiles securely, inspect results in a
|
|
6
|
+
high-performance grid, and expose governed database tools to Claude, Cursor,
|
|
7
|
+
Copilot, and other Model Context Protocol clients.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
- **Secure Password Storage**: Passwords are encrypted using the OS keyring via VS Code's SecretStorage API.
|
|
12
|
-
- **MCP Integration (Beta)**: Exposes database tools to AI agents via the Model Context Protocol.
|
|
9
|
+
[](https://marketplace.visualstudio.com/items?itemName=mehul.sql-preview)
|
|
10
|
+
[](https://marketplace.visualstudio.com/items?itemName=mehul.sql-preview)
|
|
11
|
+
[](https://open-vsx.org/extension/mehul/sql-preview)
|
|
12
|
+
[](LICENSE)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
---
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
## Why SQL Preview?
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
3. **Command Palette**: Open the palette (`Cmd+Shift+P`) and run `SQL Preview: Run Query`.
|
|
21
|
-
4. **Shortcut**: Press `Cmd+Enter` (Mac) or `Ctrl+Enter` (Windows/Linux) to run the query.
|
|
18
|
+
SQL Preview is built for the workflow where humans and agents both need real
|
|
19
|
+
database context:
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
- **Query from the editor**: open a `.sql` file, press `Cmd+Enter` or
|
|
22
|
+
`Ctrl+Enter`, and inspect results without leaving VS Code.
|
|
23
|
+
- **Manage real connection profiles**: create, test, select, and migrate
|
|
24
|
+
database connections from the SQL Preview panel.
|
|
25
|
+
- **Give agents governed access**: expose read-only MCP tools for running
|
|
26
|
+
queries, listing schemas and tables, describing columns, and inspecting shared
|
|
27
|
+
result tabs.
|
|
28
|
+
- **Stay local-first**: there is no hosted SQL Preview service and no bundled
|
|
29
|
+
AI model. Credentials stay in your VS Code Secret Storage or your local
|
|
30
|
+
daemon profile configuration.
|
|
24
31
|
|
|
25
|
-
|
|
32
|
+
---
|
|
26
33
|
|
|
27
|
-
|
|
28
|
-
- **Filter**: Use the text boxes below headers.
|
|
29
|
-
- **Export**: Right-click to copy cells.
|
|
34
|
+
## Highlights
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
- **Connection manager** with dynamic connector forms, active profile selection,
|
|
37
|
+
legacy settings migration, and per-connection password actions.
|
|
38
|
+
- **Tabbed result grid** powered by AG Grid with sorting, filtering, column type
|
|
39
|
+
display, adjustable density, TSV copy, and full CSV export.
|
|
40
|
+
- **Daemon-backed execution** so heavy queries do not block the editor and
|
|
41
|
+
results can be shared across VS Code, browser, and MCP surfaces.
|
|
42
|
+
- **MCP server** for Claude Desktop, Cursor, Copilot, and other MCP clients,
|
|
43
|
+
with safe mode enabled by default for read-only operation.
|
|
44
|
+
- **Multi-surface sessions** so agent-triggered and editor-triggered work can be
|
|
45
|
+
inspected through the same local daemon without tab ID collisions.
|
|
46
|
+
- **Transparent telemetry** that is off by default, opt-in only, and never sends
|
|
47
|
+
SQL text, results, credentials, hostnames, database names, schema/table/column
|
|
48
|
+
names, file paths, usernames, or raw errors.
|
|
32
49
|
|
|
33
|
-
|
|
50
|
+
---
|
|
34
51
|
|
|
35
|
-
|
|
36
|
-
2. **Daemon (Server)**: A separate Node.js process that manages database connections and executes queries.
|
|
37
|
-
3. **Communication**: The Client and Daemon communicate via the **Model Context Protocol (MCP)** over local sockets.
|
|
52
|
+
## Supported Databases
|
|
38
53
|
|
|
39
|
-
|
|
54
|
+
SQL Preview ships connector metadata and setup forms for:
|
|
40
55
|
|
|
41
|
-
|
|
56
|
+
| Database | Connector |
|
|
57
|
+
| -------------- | ----------- |
|
|
58
|
+
| PostgreSQL | `postgres` |
|
|
59
|
+
| MySQL | `mysql` |
|
|
60
|
+
| SQLite | `sqlite` |
|
|
61
|
+
| DuckDB | `duckdb` |
|
|
62
|
+
| Trino / Presto | `trino` |
|
|
63
|
+
| Snowflake | `snowflake` |
|
|
64
|
+
| BigQuery | `bigquery` |
|
|
65
|
+
| SQL Server | `mssql` |
|
|
66
|
+
|
|
67
|
+
Trino/Presto and PostgreSQL are bundled into the extension build. Native and
|
|
68
|
+
cloud-provider connectors are lazy-loaded and may require their driver runtime in
|
|
69
|
+
the active environment; SQL Preview reports guided missing-driver errors instead
|
|
70
|
+
of failing silently.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Quick Start: VS Code
|
|
75
|
+
|
|
76
|
+
1. Install SQL Preview from the
|
|
77
|
+
[VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=mehul.sql-preview)
|
|
78
|
+
or [OpenVSX](https://open-vsx.org/extension/mehul/sql-preview).
|
|
79
|
+
2. Run **SQL Preview: Manage Connections** from the Command Palette.
|
|
80
|
+
3. Add a connection profile, set its password, test it, and make it active.
|
|
81
|
+
4. Open a `.sql` file and press **`Cmd+Enter`** on macOS or **`Ctrl+Enter`** on
|
|
82
|
+
Windows/Linux.
|
|
83
|
+
|
|
84
|
+
Results open in the **SQL Preview** panel at the bottom of the editor. To force a
|
|
85
|
+
new tab, run **SQL Preview: Run Query (+ Tab)**.
|
|
86
|
+
|
|
87
|
+
### Migrating from Legacy Settings
|
|
88
|
+
|
|
89
|
+
If you previously configured `sqlPreview.host`, `sqlPreview.port`,
|
|
90
|
+
`sqlPreview.user`, `sqlPreview.catalog`, `sqlPreview.schema`, or
|
|
91
|
+
`sqlPreview.databasePath`, open **SQL Preview: Show Welcome Guide** or
|
|
92
|
+
**SQL Preview: Manage Connections**. SQL Preview can import those settings into a
|
|
93
|
+
named connection profile and keep passwords in VS Code Secret Storage.
|
|
94
|
+
|
|
95
|
+
---
|
|
42
96
|
|
|
43
|
-
|
|
97
|
+
## Quick Start: MCP Agents
|
|
98
|
+
|
|
99
|
+
### From VS Code
|
|
100
|
+
|
|
101
|
+
1. Run **SQL Preview: Manage Connections** and confirm your active connection.
|
|
102
|
+
2. Open the SQL Preview settings panel and enable the MCP server.
|
|
103
|
+
3. Keep safe mode enabled unless you explicitly want agents to run mutating SQL.
|
|
104
|
+
4. Configure HTTP-capable MCP clients with the local endpoint shown in the panel,
|
|
105
|
+
typically:
|
|
44
106
|
|
|
45
107
|
```json
|
|
46
108
|
{
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"sqlPreview.schema": "default",
|
|
53
|
-
"sqlPreview.ssl": true,
|
|
54
|
-
"sqlPreview.sslVerify": true,
|
|
55
|
-
"sqlPreview.maxRowsToDisplay": 1000,
|
|
56
|
-
"sqlPreview.logLevel": "INFO" // Options: DEBUG, INFO, WARN, ERROR
|
|
109
|
+
"mcpServers": {
|
|
110
|
+
"sql-preview": {
|
|
111
|
+
"url": "http://localhost:8414/mcp"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
57
114
|
}
|
|
58
115
|
```
|
|
59
116
|
|
|
60
|
-
|
|
117
|
+
You can also open the Extensions view, search `@mcp SQL Preview`, and install
|
|
118
|
+
the server into your user profile or current workspace from the MCP gallery.
|
|
119
|
+
|
|
120
|
+
### Standalone Server
|
|
61
121
|
|
|
62
|
-
For
|
|
122
|
+
For Claude Desktop, Cursor, CI jobs, or any headless MCP client, use the
|
|
123
|
+
standalone server:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"mcpServers": {
|
|
128
|
+
"sql-preview": {
|
|
129
|
+
"command": "npx",
|
|
130
|
+
"args": ["-y", "sql-preview", "--stdio"],
|
|
131
|
+
"env": {
|
|
132
|
+
"SQL_PREVIEW_CONNECTIONS": "[{\"id\":\"analytics\",\"name\":\"Analytics\",\"type\":\"postgres\",\"host\":\"localhost\",\"port\":5432,\"user\":\"analyst\",\"database\":\"warehouse\",\"password\":\"YOUR_PASSWORD\"}]"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
63
138
|
|
|
64
|
-
|
|
65
|
-
2. **Clear Password**: Run `SQL Preview: Clear Stored Password`.
|
|
139
|
+
The MCP server exposes tools for:
|
|
66
140
|
|
|
67
|
-
|
|
141
|
+
| Tool | What it does |
|
|
142
|
+
| ------------------ | --------------------------------------------------- |
|
|
143
|
+
| `run_query` | Execute SQL and return typed JSON rows |
|
|
144
|
+
| `list_connectors` | Return supported connector types and setup schemas |
|
|
145
|
+
| `list_connections` | List configured connection profiles without secrets |
|
|
146
|
+
| `save_connection` | Add or update a connection profile |
|
|
147
|
+
| `test_connection` | Validate saved or unsaved connection settings |
|
|
148
|
+
| `list_schemas` | List schemas for a connection |
|
|
149
|
+
| `list_tables` | List tables within a schema |
|
|
150
|
+
| `describe_table` | Return column names and types |
|
|
151
|
+
| `get_tab_info` | Inspect daemon result tab state |
|
|
152
|
+
| `cancel_query` | Cancel a running query |
|
|
153
|
+
| `close_tab` | Close a daemon result tab |
|
|
68
154
|
|
|
69
|
-
|
|
155
|
+
Safe mode is on by default and restricts agents to read-only statements such as
|
|
156
|
+
`SELECT`, `SHOW`, `DESCRIBE`, `EXPLAIN`, `WITH`, and connector-specific metadata
|
|
157
|
+
queries.
|
|
70
158
|
|
|
71
|
-
|
|
159
|
+
See the full [Claude Desktop setup guide](docs/engineering/guides/claude-desktop-setup.md)
|
|
160
|
+
and [daemon URL reference](docs/engineering/guides/daemon-url-reference.md) for
|
|
161
|
+
advanced configuration.
|
|
72
162
|
|
|
73
|
-
|
|
74
|
-
2. Set `sqlPreview.mcpEnabled` to `true`.
|
|
75
|
-
3. (Optional) Set `sqlPreview.mcpSafeMode` to `true` (default) to restrict AI to read-only queries.
|
|
76
|
-
4. Restart the extension or run `SQL Preview: Restart Background Server`.
|
|
163
|
+
---
|
|
77
164
|
|
|
78
|
-
|
|
165
|
+
## Configuration
|
|
79
166
|
|
|
80
|
-
|
|
167
|
+
Most users should use **SQL Preview: Manage Connections** instead of editing
|
|
168
|
+
settings JSON by hand.
|
|
81
169
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
170
|
+
| Setting | Default | Description |
|
|
171
|
+
| ------------------------------- | -------------------------- | ---------------------------------------------------------- |
|
|
172
|
+
| `sqlPreview.activeConnectionId` | empty | Connection profile used for VS Code query execution |
|
|
173
|
+
| `sqlPreview.maxRowsToDisplay` | `500` | Max rows shown in the grid; full export is still available |
|
|
174
|
+
| `sqlPreview.fontSize` | `0` | Results grid font size in px; `0` inherits from the editor |
|
|
175
|
+
| `sqlPreview.rowHeight` | `normal` | Grid density: `compact`, `normal`, or `comfortable` |
|
|
176
|
+
| `sqlPreview.tabNaming` | `file-sequential` | Result tab naming strategy |
|
|
177
|
+
| `sqlPreview.alwaysRunInNewTab` | `false` | Always open query results in a new tab |
|
|
178
|
+
| `sqlPreview.mcpEnabled` | `false` | Enable the local MCP server for agent access |
|
|
179
|
+
| `sqlPreview.mcpSafeMode` | `true` | Restrict MCP query execution to read-only statements |
|
|
180
|
+
| `sqlPreview.telemetry.enabled` | `false` | Opt in to anonymous product telemetry |
|
|
181
|
+
| `sqlPreview.telemetryHost` | `https://us.i.posthog.com` | Advanced PostHog-compatible telemetry endpoint |
|
|
86
182
|
|
|
87
|
-
|
|
183
|
+
Legacy connection settings such as `sqlPreview.host`, `sqlPreview.port`,
|
|
184
|
+
`sqlPreview.user`, `sqlPreview.catalog`, `sqlPreview.schema`, and
|
|
185
|
+
`sqlPreview.databasePath` remain available for migration and backward
|
|
186
|
+
compatibility.
|
|
88
187
|
|
|
188
|
+
### Passwords and Secrets
|
|
189
|
+
|
|
190
|
+
Passwords entered through the VS Code connection manager are stored per
|
|
191
|
+
connection in VS Code Secret Storage, backed by the operating system keychain.
|
|
192
|
+
They are not written to `settings.json` or sent to the webview.
|
|
193
|
+
|
|
194
|
+
Use these commands when needed:
|
|
195
|
+
|
|
196
|
+
- **SQL Preview: Set Connection Password**
|
|
197
|
+
- **SQL Preview: Clear Connection Password**
|
|
198
|
+
- **SQL Preview: Manage Connections**
|
|
199
|
+
|
|
200
|
+
### Telemetry
|
|
201
|
+
|
|
202
|
+
SQL Preview telemetry is off by default. If enabled, events are anonymous,
|
|
203
|
+
allowlisted, and used to improve setup, connector reliability, query workflows,
|
|
204
|
+
MCP adoption, and product quality. SQL Preview never sends SQL text, query
|
|
205
|
+
results, credentials, hostnames, database/schema/table/column names, file paths,
|
|
206
|
+
workspace names, usernames, environment variables, process arguments, raw error
|
|
207
|
+
messages, or stack traces.
|
|
208
|
+
|
|
209
|
+
Use **SQL Preview: Show Telemetry Status** to inspect the effective telemetry
|
|
210
|
+
state.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Architecture
|
|
215
|
+
|
|
216
|
+
SQL Preview uses a local daemon model:
|
|
217
|
+
|
|
218
|
+
```text
|
|
219
|
+
VS Code extension / MCP client / browser surface
|
|
220
|
+
|
|
|
221
|
+
v
|
|
222
|
+
SQL Preview daemon on localhost
|
|
223
|
+
|
|
|
224
|
+
v
|
|
225
|
+
Database connector
|
|
226
|
+
|
|
|
227
|
+
v
|
|
228
|
+
Your database
|
|
89
229
|
```
|
|
90
|
-
sql-preview/
|
|
91
|
-
├── src/
|
|
92
|
-
│ ├── extension.ts # Main extension entry point (Client)
|
|
93
|
-
│ ├── server/ # Daemon process (Server)
|
|
94
|
-
│ │ ├── Daemon.ts # Server entry point
|
|
95
|
-
│ │ └── DaemonMcpServer.ts # MCP implementation
|
|
96
|
-
│ ├── connectors/ # Database connectors (Trino)
|
|
97
|
-
│ └── ui/ # Webview logic
|
|
98
|
-
└── webviews/ # Frontend assets (React/HTML/CSS)
|
|
99
|
-
```
|
|
100
230
|
|
|
101
|
-
|
|
231
|
+
The daemon owns connection profiles, query execution, result tabs, MCP
|
|
232
|
+
transports, and browser/VS Code projections. That lets editor sessions and agent
|
|
233
|
+
sessions share the same local state while keeping credentials and execution on
|
|
234
|
+
your machine.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Release Notes
|
|
239
|
+
|
|
240
|
+
See [Changelog.md](Changelog.md) for the full release history.
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Contributing
|
|
245
|
+
|
|
246
|
+
Contributions are welcome, especially new connector support, reliability
|
|
247
|
+
improvements, and documentation fixes. See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
248
|
+
for setup instructions and development workflow.
|
|
249
|
+
|
|
250
|
+
Found a bug? Open an issue on
|
|
251
|
+
[GitHub](https://github.com/fadnavismehul/sql-preview/issues).
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## License
|
|
102
256
|
|
|
103
|
-
|
|
104
|
-
2. **Install**: `npm install`
|
|
105
|
-
3. **Build**: `npm run build`
|
|
106
|
-
4. **Debug**: Press `F5` to start the Extension Host.
|
|
257
|
+
MIT (c) 2026 [Mehul Fadnavis](https://github.com/fadnavismehul)
|