Skip to content

feat(mcp): MCP queries run on their own read-only session with a server-side timeout (#1217) - #1223

Merged
ZhuchkaTriplesix merged 2 commits into
devfrom
feat/1217-mcp-own-session
Oct 9, 2026
Merged

ZhuchkaTriplesix merged 2 commits into
devfrom
feat/1217-mcp-own-session

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Refs #1217

What was wrong

MCP ran its queries on the user's read-only session. Catalog calls and queries queued behind the tree and the table tabs, and an MCP timeout closed the session under the user (see #1216).

Changes

  • A new session mode mcp in the PostgreSQL, MySQL and SQLite pools: a separate pool slot, read-only, and on PostgreSQL and MySQL a server-side statement limit of 15 s (statement_timeout / max_execution_time).
  • Pools and service factories set a slot up through configureSession, so the limit applies on connect and on reconnect.
  • The MCP delegates use the mcp mode; the SQL editor and table views are unchanged.
  • Tests: mcp is read-only with the 15 s limit only on MCP; an MCP lease never shares the read-only slot's connection (PostgreSQL and MySQL).

Not in this PR

  • The catalog cache for MCP's catalog tools (optional in the issue) is not done: each catalog call still reads the catalog.
  • No test covers createReadOnlyMcpDelegate itself: it needs a database.
  • The server-side limit is not applied to SQLite: it has no server.

Not verified locally

Tests were not run locally, per the project rule.

…er-side timeout (#1217)

MCP shared the user's read-only session, so an agent's queries waited behind the
tree and the table tabs, and an MCP timeout closed the session under the user.
MCP now has its own session mode in the PostgreSQL, MySQL and SQLite pools: a
separate pool slot, read-only, and a 15 s statement limit set by the server
(statement_timeout / max_execution_time). The delegates the MCP server creates
use that mode. Pools and service factories set up slots through configureSession
so the limit is applied on connect and on reconnect.
@github-actions github-actions Bot added stability Theme parser epic label: stability connections Database connections, URI parsing, pools backend Backend database driver execution and queries P2 Medium priority / Parity & Refactoring labels Oct 9, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 78ea701 into dev Oct 9, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend database driver execution and queries connections Database connections, URI parsing, pools P2 Medium priority / Parity & Refactoring stability Theme parser epic label: stability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant