feat(mcp): configure stateful session idle timeout
This commit is contained in:
1 parent
576943c543
commit
e1f46cf9a8
7 files changed
+106
-16
No files matched your search
@@ -162,7 +162,7 @@ DBX MCP 当前提供以下工具(具体可用工具取决于构建功能及权
|
||||
- Session 变量和设置
|
||||
- 需要固定连接的显式事务或多步诊断
|
||||
|
||||
会话只支持 SQL 连接,并固定到一个连接和数据库。未知、已关闭或过期的 `sessionId` 会失败,不会静默退化为普通查询。完成后应调用 `dbx_close_session`;空闲 30 分钟的会话会被回收,同时最多允许 32 个并发会话。
|
||||
会话只支持 SQL 连接,并固定到一个连接和数据库。未知、已关闭或过期的 `sessionId` 会失败,不会静默退化为普通查询。完成后应调用 `dbx_close_session`;会话默认空闲 30 分钟后回收,同时最多允许 32 个并发会话。在 MCP 宿主进程设置 `DBX_SESSION_IDLE_TTL_SECS=43200` 可将空闲时间延长为 12 小时,事务专属连接也使用此配置。值必须为正整数秒;未设置、非法值、零、负数或无法表示的时长均保留默认 1800 秒。修改后需重启宿主。使用嵌入式 DBX Web MCP 时,在 Web 服务端设置;使用独立启动器时,在启动器环境中设置。
|
||||
|
||||
<Callout type="warn">有状态会话不会放宽 SQL 策略。`USE` 只有在会话中才有意义,但写入、DDL、生产保护、连接只读和数据库权限仍按每次请求重新检查。</Callout>
|
||||
|
||||
@@ -286,6 +286,7 @@ DBX 在 **设置 → MCP** 中保存一份权威策略,并在每次请求时
|
||||
| 变量 | 用途 |
|
||||
| --- | --- |
|
||||
| `DBX_DATA_DIR` | 覆盖本地 DBX 数据目录 |
|
||||
| `DBX_SESSION_IDLE_TTL_SECS` | 有状态会话空闲超时,单位为正整数秒,默认 `1800`。非法值、零、负数或无法表示的时长回退默认值;同样适用于事务专属连接。修改后需重启 MCP 宿主进程。 |
|
||||
| `DBX_WEB_URL` | 使用 DBX Web/Docker 后端 |
|
||||
| `DBX_WEB_PASSWORD` | 登录 DBX Web |
|
||||
| `HTTP_PROXY` / `HTTPS_PROXY` / `ALL_PROXY` | DBX Web 请求的标准系统代理变量;空值表示不走代理。认证格式 `http://user:pass@host:port` |
|
||||
|
||||
@@ -162,7 +162,7 @@ Regular `dbx_execute_query` calls are independent. When a workflow must preserve
|
||||
- Session variables and settings
|
||||
- Explicit transactions or multi-step diagnostics that require one connection
|
||||
|
||||
Sessions support SQL connections only and are bound to one connection and database. Unknown, closed, or expired IDs fail instead of silently falling back to an ordinary query. Call `dbx_close_session` when finished. Idle sessions are reclaimed after 30 minutes, and the server allows at most 32 concurrent sessions.
|
||||
Sessions support SQL connections only and are bound to one connection and database. Unknown, closed, or expired IDs fail instead of silently falling back to an ordinary query. Call `dbx_close_session` when finished. Idle sessions are reclaimed after 30 minutes by default, and the server allows at most 32 concurrent sessions. Set `DBX_SESSION_IDLE_TTL_SECS=43200` in the process hosting MCP to allow 12 hours of inactivity, including transaction-owned connections. The value must be positive whole seconds; unset, invalid, zero, negative or unrepresentable values keep the 1800-second default. Restart the host after changing it. For embedded DBX Web MCP, set it on the Web server; for the standalone launcher, set it in the launcher environment.
|
||||
|
||||
<Callout type="warn">A stateful session does not widen SQL policy. `USE` is meaningful only inside a session, while writes, DDL, production protection, connection read-only state, and database privileges are rechecked for every request.</Callout>
|
||||
|
||||
@@ -286,6 +286,7 @@ Updated servers do not let `DBX_MCP_ALLOW_WRITES` or `DBX_MCP_ALLOW_DANGEROUS_SQ
|
||||
| Variable | Purpose |
|
||||
| --- | --- |
|
||||
| `DBX_DATA_DIR` | Override the local DBX data directory |
|
||||
| `DBX_SESSION_IDLE_TTL_SECS` | Stateful session idle timeout in positive whole seconds (default: `1800`). Invalid, zero, negative or unrepresentable values use the default. Applies to transaction-owned connections too; restart the MCP host after changing it. |
|
||||
| `DBX_WEB_URL` | Use a DBX Web/Docker backend |
|
||||
| `DBX_WEB_PASSWORD` | Authenticate to DBX Web |
|
||||
| `HTTP_PROXY` / `HTTPS_PROXY` / `ALL_PROXY` | Standard system proxy variables for DBX Web requests; empty value means no proxy. Auth via `http://user:pass@host:port` |
|
||||
|
||||
Reference in new issue
Block a user