Skip to content

Add Connect admin page and bundle MCP Adapter via Jetpack Autoloader#3

Merged
louisreingold merged 3 commits into
masterfrom
feat/connect-page-bundled-adapter
May 31, 2026
Merged

Add Connect admin page and bundle MCP Adapter via Jetpack Autoloader#3
louisreingold merged 3 commits into
masterfrom
feat/connect-page-bundled-adapter

Conversation

@louisreingold
Copy link
Copy Markdown
Member

Summary

Makes Root for Agents work standalone and adds a one-click way to connect a coding agent to the site over MCP.

  • Bundles wordpress/mcp-adapter (+ wordpress/php-mcp-schema) through Composer, loaded with the Jetpack Autoloader (vendor/autoload_packages.php). When multiple plugins ship the adapter, the Jetpack Autoloader dedupes them to a single newest version instead of fatally redeclaring classes. The main plugin now boots McpAdapter::instance() itself, so the separate MCP Adapter plugin is no longer required.
  • The src/ PSR-4 fallback autoloader now registers only when vendor/ is absent (e.g. a source checkout before composer install), fixing a double-autoload "class already declared" fatal.
  • Adds a Root for Agents → Connect admin page. The Generate connection button:
    1. mints a fresh WordPress application password for the current user,
    2. computes this site's MCP endpoint URL, and
    3. renders three copy-paste artifacts — a natural-language agent prompt, a claude mcp add CLI command, and an mcpServers JSON block.
  • Auth is HTTP Basic using the application password (shown once). Reuses the adapter's default server at /wp-json/mcp/mcp-adapter-default-server; our abilities are surfaced there via execute-ability.
  • Updates README.md and readme.txt.

Testing

Verified inside the running WordPress install:

  • All WP\MCP\*, WP\McpSchema\*, and RootForAgents\* classes autoload; adapter v0.5.0 active; no fatals.
  • REST route /mcp/mcp-adapter-default-server registered.
  • End-to-end over HTTP with a generated application password (Basic auth):
    • initialize200 + Mcp-Session-Id
    • tools/list → returns the adapter tools
    • wrong password → 401
  • Connection artifacts (prompt / CLI / JSON) render with the correct URL and Authorization: Basic … header.

⚠️ vendor/ is committed (~2.7 MB) so release .zip builds need no composer install — consistent with the plugin's distribution model, now documented in the README.

🤖 Generated with Claude Code

louisreingold and others added 3 commits May 31, 2026 06:45
Make Root for Agents work standalone and give operators a one-click way to
connect a coding agent to the site over MCP.

- Bundle wordpress/mcp-adapter (+ wordpress/php-mcp-schema) through Composer,
  loaded with the Jetpack Autoloader (vendor/autoload_packages.php) so multiple
  plugins shipping the adapter dedupe to a single newest version instead of
  fatally redeclaring classes. The main plugin now boots McpAdapter::instance()
  itself, so the separate MCP Adapter plugin is no longer required.
- The src/ PSR-4 fallback autoloader now registers only when vendor/ is absent,
  avoiding a double-autoload "class already declared" fatal.
- Add a "Root for Agents > Connect" admin page. Its Generate button mints a
  fresh WordPress application password, computes the MCP endpoint URL, and
  renders three copy-paste artifacts: a natural-language agent prompt, a
  `claude mcp add` CLI command, and an mcpServers JSON block. Auth is HTTP
  Basic using the application password.
- Update README.md and readme.txt for the bundled adapter and Connect workflow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Switch the copy-paste connection instructions from a direct HTTP transport
(Authorization: Basic header) to Automattic's @automattic/mcp-wordpress-remote
stdio proxy, run locally via `npx`. All three artifacts (agent prompt, claude
mcp add CLI command, and mcpServers JSON) now pass WP_API_URL, WP_API_USERNAME,
and WP_API_PASSWORD (the application password) as environment variables, with
OAUTH_ENABLED=false so the proxy uses application-password auth. Update README
and readme.txt accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Committing ~314 Composer-managed vendor files bloated the repo. Instead:

- gitignore /vendor/ (and /dist/, *.zip) and remove the tracked vendor tree;
  composer.lock stays tracked for reproducible installs.
- Add .github/workflows/release.yml: on a v* tag (or manual dispatch) it runs
  `composer install --no-dev --optimize-autoloader`, stages the plugin with
  dev-only files excluded, bundles the freshly built vendor/, zips it, uploads
  the artifact, and attaches it to the GitHub release.
- Update README install notes: run `composer install` from a source checkout;
  packaged release zips already include vendor/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@louisreingold louisreingold merged commit f55eb5b into master May 31, 2026
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.

1 participant