Feature/sql query tool #9
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds a new
execute_sql_querytool that enables read-only SQL queries against the WordPress database through a configurable custom REST API endpoint.Key Features
🔐 Security-First Design
manage_optionscapability⚙️ Configurable Endpoint
WORDPRESS_SQL_ENDPOINTallows custom endpoint configuration/mcp/v1/query(vendor-neutral namespace)🛠️ Implementation
execute_sql_queryinsrc/tools/sql-query.tslogs/wordpress-api.log📚 Comprehensive Documentation
Use Cases
This tool enables:
Setup Required
Users must add a custom REST API endpoint to their WordPress site. The PR includes a complete PHP code example that can be added via a custom plugin or theme's
functions.php.Example Configuration
Example Query
CodeRabbit Review Improvements
Incorporated all actionable feedback from CodeRabbit's automated review:
Testing
Security Considerations
This tool implements defense-in-depth:
Files Changed
src/tools/sql-query.ts(new): SQL query tool implementationsrc/tools/index.ts: Added SQL query tool to exportsREADME.md: Setup instructions, security notes, and usage documentationCLAUDE.md: Updated tool listing and configuration.gitignore: Added .claude/ directoryBreaking Changes
None. This is a purely additive feature that requires explicit opt-in setup.