Directory / plugin

Structure Viewer – AI Context Builder, Code Search & MCP Tools

v2.3.0 · by Blincks

Give AI the full picture of any plugin or theme: one-click AI context packs, code search, a built-in MCP server and secret redaction.

About this plugin

Structure Viewer is the AI toolkit for WordPress code. Turn any installed plugin or theme into a single AI-ready context pack, search inside every file, let AI agents like Claude, Cursor and VS Code Copilot explore your site through MCP, and browse every file with syntax highlighting — all from your WordPress admin, with secrets redacted before anything leaves the server.

No FTP, no SSH, no copy-pasting one file at a time. Works with ChatGPT, Claude, Gemini, Cursor, Copilot, Windsurf and any other AI tool.

—

✨ AI Context Pack (new in 2.3)

The fastest way to give an AI your code.

  • One click, one document — project facts, a compact file tree and the full source of the files that matter, in a single paste-ready pack
  • Smart pick — automatically skips vendor libraries, minified assets, lock files, translations and binaries so your AI gets signal, not noise
  • Token budget — live token estimate with presets for 32K, 128K, 200K, 400K and 1M context windows; files beyond the budget are skipped automatically
  • Task templates — “Security audit”, “Code review & bugs”, “Write documentation”, “Add a feature”, “Write tests”, “Compatibility upgrade” — or write your own instructions
  • Three formats — Markdown, XML (the <documents> layout recommended for long-context models) or plain text
  • Copy or download — paste straight into a chat or attach the file
  • Secrets always redacted for AI output (configurable)
  • Add individual files from the file viewer with the + Add to Context Pack button

🤖 Built-in MCP Server for AI Agents (new in 2.3)

Structure Viewer is an MCP server — no MCP Adapter or any other plugin required, on any WordPress version from 5.8. Connect Claude Code, Claude Desktop, Cursor, VS Code (Copilot), Windsurf or any other MCP client and it can explore your plugins and themes on its own:

  • sv_list_items — list plugins, themes and mu-plugins
  • sv_get_item_summary — metadata, file counts and token estimate
  • sv_get_file_tree — the complete file tree
  • sv_read_file — read any source file (or a line range), secrets redacted
  • sv_search_code — grep across one or all plugins/themes
  • sv_build_context_pack — a ready-made context pack sized to the agent’s budget
  • Pro: sv_get_hooks_map and sv_check_integrity
  • Plus ready-made prompts (security audit, code review, documentation…) for clients that support MCP prompts

Two-minute setup: open AI Agents, click Create token, pick your client and copy the generated config (Claude Code command, Claude Desktop, Cursor, VS Code, Windsurf or cURL). A self-test runs a real MCP handshake against your site. For local development there is also a stdio server: wp structure-viewer mcp --user=admin.

Standards-based: MCP Streamable HTTP transport (protocol 2024-11-05 2025-11-25), JSON-RPC 2.0, Origin validation, per-user revocable tokens (or WordPress Application Passwords). Every tool is read-only, requires an administrator and can be switched off in one click. On WordPress 6.9+ the same tools are also registered with the core Abilities API.

🔍 Code Search (new in 2.3)

  • Search inside every file of a plugin, a theme, the mu-plugins folder — or across all plugins at once
  • Match case, whole word and regular expressions, extension filters, optional vendor/minified files
  • Results grouped by file with line numbers and context; click any line to open the file at that exact line
  • One-click quick searches: hooks, AJAX handlers, REST routes, shortcodes, SQL queries, remote requests, risky functions (eval, base64_decode, shell_exec…) and TODO/FIXME
  • Copy results for AI as Markdown

🗂️ File Explorer & Viewer

  • Interactive tree for every plugin, theme and must-use plugin (new in 2.3)
  • Live tree search, file type filters, file sizes and dates, recently viewed
  • Built-in syntax highlighting with line numbers for PHP, JS, CSS, JSON, HTML/XML, SQL, Markdown and YAML (new in 2.3)
  • Copy for AI — copies the file with its path in a fenced code block (new in 2.3)
  • Fullscreen mode, one-click download, redaction badge
  • Item sidebar with statistics, file breakdown and an estimated AI token count, plus shortcuts to build a context pack, search code, map hooks or verify integrity

📤 Export

TXT, JSON, XML, PDF and clipboard exports of any file tree — clean ASCII trees that fit nicely in AI prompts, tickets and documentation.

🔒 Secret Redaction

Masks API keys, tokens, passwords, AWS / Stripe / GitHub / Google / Slack / OpenAI / Anthropic / SendGrid / Mailchimp keys, JWTs, PEM private keys, wp-config credentials, credential constants, .env-style assignments and passwords in connection strings. Always on for AI output by default; optional for the file viewer and downloads.

💻 WP-CLI

wp structure-viewer pack plugin woocommerce --ext=php --max-tokens=150000 --output=wc.md
wp structure-viewer search plugin all "base64_decode\s*\(" --regex
wp structure-viewer export plugin <folder-name> --format=json
wp structure-viewer list plugins
wp structure-viewer mcp --user=admin (local stdio MCP server)

Pro: wp structure-viewer hooks plugin <slug> and wp structure-viewer integrity

—

🚀 Structure Viewer Pro

🪝 Hooks Map (new) — static analysis of every PHP file (nothing is executed): actions and filters hooked (with callback and priority), every do_action / apply_filters fired, AJAX handlers, REST routes, shortcodes, post types, taxonomies, blocks, cron events, admin pages, settings, WP-CLI commands, enqueued assets, classes and functions — each linked to its file and line. Export as Markdown or JSON, add it to Context Packs, or let AI agents call it.

🛡️ Integrity Check (new) — verify WordPress core and every WordPress.org plugin against the official checksums. Find modified, missing and suspicious (unexpected executable) files, and see a line-by-line diff against the original release. Ideal after a hack, before a site handover, or when someone “just edited the plugin”.

💾 Context Pack presets & compression (new) — save file selections, task prompts and options as reusable presets, strip comments and blank lines to save 20–40% tokens, and include the Hooks Map in any pack.

🔀 Comparator — colour-coded line-by-line diff between two plugin/theme ZIPs, an installed item and a ZIP, or two files. Handles large and minified files.

📦 FlatPack — extract only the PHP, CSS, JS, images or custom extensions from any ZIP into one flat, collision-safe download.

Upgrade from Structure Viewer Pro Tools Upgrade to Pro.

—

🔒 Security & Privacy

  • Strictly read-only — Structure Viewer never modifies, deletes or uploads files on your site
  • manage_options capability (administrators) required for every screen, AJAX call and AI ability
  • Nonce verification on every request, path traversal prevention with realpath() checks
  • AI agent tools can be disabled with one toggle; secrets are redacted for AI by default
  • No external requests at runtime. The only outbound requests are the ones you start yourself in the Pro Integrity Check (to downloads.wordpress.org, plugins.svn.wordpress.org and api.wordpress.org for checksums and original files)

⚡ Performance

  • Assets load only on the Structure Viewer screen — zero frontend impact
  • Lazy tree loading, cached dashboard stats, cached Hooks Map and checksum results
  • Code search has result and time limits so it never ties up your server

Plugin tags