Skip to content

fix(mcp): MCP queries run on the user's read-only session; give MCP a session of its own #1217

Description

@ZhuchkaTriplesix

Part of #1212.

Problem

The MCP server runs its queries on the user's own read-only session.

MCP is not the root cause of the connection errors (they also happen with MCP off), but it adds an unattended client to the user's session and makes them more frequent and harder to explain.

Scope

  • A session mode of its own for MCP per driver (PgSessionMode.mcp, MysqlSessionMode.mcp, SqliteSessionMode.mcp): read-only, own pool key, idle dispose like other slots.
  • Server-side statement timeout on that session (SET statement_timeout / max_execution_time), so a runaway MCP query is stopped by the server and nothing is force-closed.
  • Optional: cache the catalog per connection for a short time (or until the tree refreshes) so catalog tools do not rerun it on every call.
  • The MCP log in Settings shows which session a call ran on (for support).

Acceptance

  • Unit test: MCP delegates never acquire the pool key the UI uses (readOnly) for the same connection and database.
  • Unit test (fake connections): an MCP query that times out leaves the UI's read-only session connected.
  • Unit test: two MCP catalog calls within the cache window run the catalog once (if the cache is in scope).

Activity

  1. added
    stabilityTheme parser epic label: stability
    connectionsDatabase connections, URI parsing, pools
    backendBackend database driver execution and queries
    P2Medium priority / Parity & Refactoring
    on Oct 9, 2026
  2. ZhuchkaTriplesix commented on Oct 9, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Closed by #1223.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priority / Parity & RefactoringbackendBackend database driver execution and queriesconnectionsDatabase connections, URI parsing, poolsstabilityTheme parser epic label: stability

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions