You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: add lazy database connections
Add `lazy` option to source configuration that defers database connection
until the first query. This avoids unnecessary connection overhead for
remote databases when queries may not occur during a session.
- Add `lazy?: boolean` to SourceConfig type
- Implement lazy connection logic in ConnectorManager with race condition
protection via pending connection promises
- Update tool handlers to call ensureConnected() before getting connector
- Update dbhub.toml.example and documentation
Closes#234
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Update src/connectors/manager.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Defer database connection until the first query. When enabled, the connection is not established at server startup but instead when a tool first accesses this source.
187
+
188
+
This is useful for remote databases (e.g., RDS, Cloud SQL) where you want to avoid unnecessary connection overhead if the database may not be queried during a session.
lazy = true# Connection deferred until first query
195
+
```
196
+
197
+
**Startup behavior:**
198
+
- Without `lazy`: Connection established immediately, errors shown at startup
199
+
- With `lazy = true`: Source registered but not connected, connection errors appear on first query
200
+
201
+
<Note>
202
+
When a lazy source is accessed for the first time, there will be a brief delay as the connection is established. Connection errors will appear in tool responses rather than at startup.
203
+
</Note>
204
+
</ParamField>
205
+
183
206
### sslmode
184
207
185
208
<ParamFieldpath="sslmode"type="string">
@@ -473,6 +496,7 @@ Tools define MCP tools (like `execute_sql`) with specific execution settings. To
0 commit comments