Skip to content

Allow read-only SQL statements beyond SELECT in read_query and export_query#29

Open
noxymon-mekari wants to merge 1 commit intoexecuteautomation:mainfrom
noxymon-mekari:main
Open

Allow read-only SQL statements beyond SELECT in read_query and export_query#29
noxymon-mekari wants to merge 1 commit intoexecuteautomation:mainfrom
noxymon-mekari:main

Conversation

@noxymon-mekari
Copy link
Copy Markdown

@noxymon-mekari noxymon-mekari commented Mar 16, 2026

Summary

Motivation

Running EXPLAIN SELECT ... via read_query fails because the validation only checks for a select prefix. These are all read-only operations that the database adapters already support internally (e.g., SQLite adapter uses PRAGMA, MySQL adapter
uses DESCRIBE), but no MCP tool allowed users to execute them.

Changes

Statement SQLite SQL Server PostgreSQL MySQL
EXPLAIN yes yes yes yes
WITH (CTEs) yes yes yes yes
PRAGMA yes - - -
SHOW - - yes yes
DESCRIBE/DESC - - - yes

…_query

EXPLAIN, WITH (CTEs), PRAGMA, SHOW, and DESCRIBE/DESC queries were rejected
by read_query with "Only SELECT queries are allowed" even though they are
read-only operations supported by the database adapters. This adds a shared
allowed-prefix list and updates both read_query and export_query validation,
along with their MCP tool descriptions.

Also adds CLAUDE.md for Claude Code onboarding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CTE disallowed as read_query limited to statements starting with SELECT

2 participants