Skip to content

MCP: anonymous-access tools (allow_public get/set) + read exposure - #125

Open
kennethphough wants to merge 2 commits into
masterfrom
feature/mcp-anonymous-access-tools
Open

MCP: anonymous-access tools (allow_public get/set) + read exposure#125
kennethphough wants to merge 2 commits into
masterfrom
feature/mcp-anonymous-access-tools

Conversation

@kennethphough

Copy link
Copy Markdown
Member

What

Adds MCP control over an app's anonymous (unauthenticated) access — the Application.allow_public gate that public-signup / membership apps depend on.

  • read_application (and get_app_info via appToArray) now return allow_public and auth_mode, so the MCP client can see an app's access config instead of guessing.
  • New set_app_anonymous_access(application_id, level) (provision scope): sets allow_public to 0 none / 1 read-only (GET) / 2 controller-governed (anonymous writes where a controller sets requireAuth=false). Level 2 is what public signup requires. Validates the level and re-scopes application_id to the token's account.

Why

QA surfaced it: a membership app can't do public signup without anonymous write access, but MCP had no way to read or set allow_public — the model (Claude) was blind to the very setting blocking it and had to punt to "the anonymous-access Shipyard setting." These two additions close that gap.

Notes

  • Auth error strings (Unauthorized API request.) intentionally left unchanged — making them specific would help attackers fingerprint access holes.
  • Semantics match the Application struct's own allow_public tri-state comment exactly.
  • Tools are auto-discovered (attribute scan on Tools/); no registry change.
  • Guides that teach the signup+login recipe are a separate, deferred piece of work.

Tests

tests/McpAppToolsTest.php (registered in phpunit.xml.dist): default level, set/read round-trips for 0/1/2, invalid-level rejection, foreign-app rejection, and read-exposure of allow_public/auth_mode. Lints clean under PHP 8.2.

🤖 Generated with Claude Code

kennethphough and others added 2 commits August 6, 2026 03:56
- read_application/appToArray now expose auth_mode and allow_public
  (anonymous-access level) so the MCP client can see an app's access config.
- New set_app_anonymous_access tool (provision scope): sets allow_public
  0/1/2 (none / read-only / controller-governed). Level 2 is what public
  signup needs. Validates the level and re-scopes application_id to the
  token's account (a token cannot open another account's app).
- Tests: McpAppToolsTest (default level, set levels, invalid-level +
  foreign-app rejection, read exposure); registered in phpunit.xml.dist.

Motivated by QA: membership apps need anonymous public signup, but MCP had
no way to read or set allow_public — the AI was blind and punted to Shipyard.
Auth error strings intentionally left unchanged (fingerprinting concern).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ignup

- set_app_auth_mode(app, hmac|jwt): sets Application.auth_mode AND regenerates
  the injected `k` bootstrap (kyte_connect) to match — JWT nulls the HMAC keys
  and passes {authMode:'jwt'}. Grounded in kyte-api-js: the anonymous/public
  path + bearer sessions exist ONLY in JWT mode, so flipping just the field
  would leave published pages booting the old mode. Republish caveat surfaced.
- get_auth_guide: consolidated end-to-end membership recipe (auth_mode=jwt +
  allow_public=2 + password-flagged column + configure_app_login + a
  requireAuth=false signup controller + client signup/login/logout). Cross-linked
  from get_kytejs_guide, get_controller_guide, configure_app_login, and
  set_app_anonymous_access so the AI is pointed to it from wherever it lands.
- get_kytejs_guide: add signup (anonymous k.post, JWT-only) + checkSession.
- Refactor kyte_connect building into buildKyteConnect (hmac/jwt).
- Tests: set_app_auth_mode (jwt regen + back-to-hmac + invalid + foreign-app).

Co-Authored-By: Claude Opus 4.8 <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.

1 participant