Skip to content

app/: the rest of the public MCP server (sc-8900) - #91

Merged
ndbroadbent merged 6 commits into
mainfrom
laravel-org-tools
Dec 2, 2026
Merged

ndbroadbent merged 6 commits into
mainfrom
laravel-org-tools

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

The rest of the public MCP server on the Laravel Rust app (sc-8900), ported from server/src/mcp.rs with today's descriptions, schemas and answers (tests/golden/mcp).

Done

  • whoami, for a person or a project token:

    • today's answer (setup checklist via auth::setup::state, blocked notice, waiting builds, open comment threads, the demo pointer from domain::demo);
    • plus a new via field: {source, token_name} for a token, {source, client_name} for an MCP client, with source in the words reviews record (personal_token, project_token, oauth, web).
  • list_organizations, get_organization:

    • members come from auth::invitations::members_json, pending invitations for admins from pending, and usage from domain::credits::usage;
    • a project token sees only its own project, no members and no usage history.
  • create_project, get_project, update_project:

    • project settings are now in domain::projects (Settings, SettingsChange, change_settings, create, valid_slug, repository_seen_in_ci), so subdomains' web UI can call the same functions;
    • turning the gallery off calls gallery::purge_project first;
    • update_project needs an admin, and a project token never acts as one.
  • create_organization, invite_member, create_project_token, delete_project_token, on app/: creating an organization (sc-8900) #70's functions (auth::orgs::create_org, invitations::invite_to, tokens::make_project_token, tokens::remove_project_token):

    • today's role checks: create_organization needs a personal token; the other three need an admin, and a project token never acts as one;
    • their refusals (422, 409, 429) become tool errors with their messages; a taken slug keeps today's "the slug … is taken".
  • download_build, on domain::downloads.

  • comment_when_unchanged (c2da705, No pull request comment when nothing changed (comment_when_unchanged, off by default) #90): a migration adding projects.comment_when_unchanged (default false), the model field, Settings and SettingsChange with today's doc comments, carried by get_project and update_project. Its test comments_when_nothing_changed_are_off_until_turned_on is ported. For subdomains: the pull-request comment worker that reads it (server/src/workers/pr_comment.rs in c2da705: no comment when every suite's newest build is unchanged, unless it's on) is forge code, not ported here.

  • list_builds returns one short line per build (sc-8891, part 1). Each line has:

    • number, name (unless default), branch, the whole commit (agents compare it with their HEAD), pr_number, mode (unless ci);
    • state, conclusion, review_state, waiting_for_review;
    • changes in words ("2 changed, 1 added"; "unchanged" for a completed build with no changes; "not compared" for one still receiving or failed), and stats as numbers (changed, added, removed, unchanged, failed);
    • blocked (null unless it's out of credits), url and created_at.

    environment_info, reviews, groups, ci_mode, passed and warnings are left to get_build, and the description says so.

Left (for subdomains)

  • Repository linking (repository_url, forge_token, move_link in update_project) is refused until subdomains ports forge::link::link_repository. It refuses with today's messages: " isn't set up on this server" for a GitHub or GitLab URL, and "isn't a repository URL VisualCI knows…" for any other (the example.com golden). The spot is marked TODO(subdomains).

Golden files changed on purpose

  • whoami.json in a_personal_token_manages_organizations_projects_and_tokens, agents_comment_on_snapshots_and_resolve_threads, and whoami.json and whoami-2.json in a_free_organization_over_its_allowance_gets_a_failed_build_that_says_why: the new via field.
  • tools-list-user-token.json and tools-list-project-token.json (lists_the_tools_each_kind_of_token_can_use): download_build is new here (the goldens were recorded before it), and the whoami and list_builds descriptions changed.
  • New test directories. Today's server has no golden for these, so they're new files, not changes:
    • list_builds_answers_one_short_line_per_build/ (the compact list_builds);
    • comments_when_nothing_changed_are_off_until_turned_on/;
    • invite_member_checks_who_may_invite_and_its_limits/ (a project token and a member refused; the per-recipient daily limit);
    • download_build_builds_an_archive_and_says_its_state/;
    • list_organizations_lists_a_persons_organizations/;
    • create_organization_refuses_a_taken_slug/.
  • comment_when_unchanged added to project settings (today's goldens predate c2da705; nothing else in these files changed):
    • update_project.json, -2 and -3 in a_builds_visualci_yml_overrides_the_project_settings;
    • update_project.json in a_project_can_keep_approving_with_people;
    • get_project-2.json and update_project.json in projects_can_be_renamed;
    • update_project's schema in both tools lists.
    • create_project.json, get_project.json, update_project.json, update_project-4.json and update_project-8.json (the argument help) in a_personal_token_manages_organizations_projects_and_tokens.

Every other golden file is unchanged. tests/golden/mod.rs gains VISUALCI_GOLDEN_UPDATE=1, which writes the normalized answer instead of comparing, for deliberate changes reviewed in the diff.

Port bugs found and fixed (not by changing goldens)

  • The comment anchor's doc comment (domain/comments.rs) had lost two sentences in app/: the public MCP server's build, review and comment tools (sc-8900) #75, so post_comment's schema text differed from today's. No test compared the tools list until this PR.
  • get_organization's usage history gave created_at as Postgres text (+00), not RFC 3339 (+00:00) as today.
  • The MCP test fixture's emails used undashed UUIDs, which the golden normalizer doesn't replace; today's were dashed.

Test infrastructure

  • Laravel reuses numbered test databases (<name>_1 … _N) and rolls rows back, but Postgres sequences don't roll back. Any id in an answer drifts between runs: a token id came out 7 where today's is 1. The MCP fixture restarts the token sequences (and steps past 2, as today's fixture had a second project's token). Other tests with numeric ids in their answers need the same.
  • Worktrees with different migrations sharing one VISUALCI_APP_TEST_DATABASE_URL make the template rebuild, and with 8 test threads Postgres ran "out of shared memory" dropping tables. Use a database name per worktree, and fewer threads for the first run after a migration change.

Tests: the full app suite passes with --locked on docspring-dev; clippy and fmt are clean.

@ndbroadbent
ndbroadbent marked this pull request as ready for review December 2, 2026 22:27
ndbroadbent added a commit that referenced this pull request Dec 2, 2026
…ric stats and blocked on each line; whoami's via.source in the words reviews record (personal_token, project_token, oauth, web); new MCP tests for invite_member (who may invite, the daily limit), download_build, list_organizations and create_organization's taken slug
…ngsChange, change_settings (a gallery turned off is purged first), create, valid_slug and repository_seen_in_ci, for the MCP tools and subdomains' web UI alike
… list_organizations, get_organization, create_project, get_project, update_project and download_build; list_builds as one short line per build (sc-8891, part 1); create_project_token, delete_project_token, invite_member and create_organization registered, waiting for #70; the comment anchor's schema text as today's; golden files can be rewritten on purpose (VISUALCI_GOLDEN_UPDATE)
…igration, the model, domain::projects' Settings and SettingsChange, get_project and update_project; its test and golden
…lete_project_token on #70's functions (create_org, invite_to, make_project_token, remove_project_token), with today's role checks and messages; the personal-token test's settings goldens gain comment_when_unchanged
…ric stats and blocked on each line; whoami's via.source in the words reviews record (personal_token, project_token, oauth, web); new MCP tests for invite_member (who may invite, the daily limit), download_build, list_organizations and create_organization's taken slug
@ndbroadbent
ndbroadbent merged commit a9cedbc into main Dec 2, 2026
11 checks passed
@ndbroadbent
ndbroadbent deleted the laravel-org-tools branch December 2, 2026 23:06
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