Skip to content

feat(mcp): Settings page, per-connection access and activity log - #1141

Merged
ZhuchkaTriplesix merged 2 commits into
devfrom
issue/1136-mcp-settings
Oct 8, 2026
Merged

ZhuchkaTriplesix merged 2 commits into
devfrom
issue/1136-mcp-settings

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Third part of the MCP epic #1133: the user-facing side of the server from #1140.

Preferences → MCP Server (new category)

  • Enable MCP server switch (off by default) with live status: "Running on 127.0.0.1: · N clients connected" / stopped / start error.
  • Shared connections: every PostgreSQL / MySQL / SQLite connection with its own switch, off by default (McpAccessStore). Production connections carry a PROD badge and a warning line. Empty state when there are no SQL connections.
  • Connect a client: "Copy … config" for Claude Desktop, Cursor, VS Code and a generic stdio snippet. The command is the bundled querya-mcp next to the app binary; when it is not bundled (macOS, Flatpak, dev builds), the hint says to download it and the snippet has a placeholder. No token or secret in the snippets.
  • Regenerate token: restarts the server with a new token; clients reconnect on their next start.
  • Recent calls: last 50 calls (time, client, tool, connection, SQL, rows / duration or the error in the destructive color), refreshed after each call; Clear.

Built from UI kit pieces (PreferencesSwitchRow, QueryaActionButton, QueryaBadge, QueryaEmptyState, showAppToast).

Activity log storage

  • New mcp_activity table (LocalDb schema v11, created on fresh installs and on upgrade), capped at 200 rows, SQL cut at 2000 chars, connection name stored as a snapshot.
  • Only the app's McpServerController.instance persists calls; other instances (tests) do not touch LocalDb.

Deviation from the issue: calls are not written to mutation_audit with a new mcp source. That trail lists executed data / schema changes; MCP is read-only, so every entry would be noise. The activity log is the MCP audit.

Tests

  • preferences_mcp_section_test.dart: SQL-only list with shared state and toggling, PROD badge, enabling and status text, regenerate, clipboard content of the copy buttons (path, format, no token), recent calls incl. errors and Clear, empty state.
  • mcp_client_config_and_activity_test.dart: snippet formats, bundled shim lookup, mcp_activity round trip, newest-first order, cap, clear.

Written without running locally; CI is the first run.

Closes #1136

@github-actions github-actions Bot added settings Theme parser epic label: settings ui User interface components and widgets P2 Medium priority / Parity & Refactoring labels Oct 8, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 1034961 into dev Oct 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium priority / Parity & Refactoring settings Theme parser epic label: settings ui User interface components and widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant