Repository navigation
feat(mcp): list a group's members in get_repository - #472
Conversation
check_availability has no verdict for a group ("ask one of its
members"), but no MCP tool said who the members are, so an assistant
working on a project configured with a group URL (the usual setup) could
not find the repository to ask. get_repository now adds members for a
group: name, format, repo_type and priority, in group order, without
the members the caller cannot read (an unreadable repository stays
invisible, as everywhere else in MCP). Other repository types have no
members field; a group with no readable member has an empty list.
The MCP group error of check_availability now says get_repository lists
the members; the REST error is unchanged. The drift table records
repositories/members as served by get_repository instead of excluded
as identity data: it lists repositories, not principals.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
M0Rf30
left a comment
There was a problem hiding this comment.
One change before merge: groupMembers lists members that serving never consults. serveFirstHit (internal/group/group.go:147) skips nested groups, members of another format and blocked members, but they are returned here, and the description says the first member in that order that has the version decides. An agent can then treat a blocked or nested member as deciding.
Apply the same filter in groupMembers (RepoType == repotype.Group || Format != grp.Format || Blocked → skip) and add a test case for a blocked member. That also matches what #471 will do server-side.
The drift-table move out of reasonIdentity is right: it lists repositories, not principals.
Like group.Handler.members, groupMembers now leaves out nested groups, members of another format and blocked members, so an agent never treats a member serving skips as the one that decides a version. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Applied the filter (nested groups, other formats and blocked members are left out, as in group.Handler.members) and added a test for a blocked, a nested and an other-format member. |
M0Rf30
left a comment
There was a problem hiding this comment.
The member filter now matches group.Handler.members, and the test covers blocked, nested and other-format members. Thanks.
check_availabilityrefuses a group ("a group repository has no availability of its own: ask one of its members"), but no MCP tool says who the members are. A project usually points its package manager at a group URL, so an assistant asked "can I install X?" can't find the repository to check. I found this while testing an agent against a Composer group (hosted plus a Packagist proxy). The REST answer exists (GET /repositories/{name}/members), but it's under/api/v1, so it needsmanage.Change
get_repositoryaddsmembersfor a group repository, in group order:members. A group with no readable member hasmembers: [], so "nothing visible" isn't mistaken for "not a group".merge_proxy_versionsis set, a name a hosted member holds is decided by the hosted members only.check_availability, and the tool's description, now point atget_repository. The REST error text is unchanged: there's a separate MCP message, andExplainAvailabilitystill returnsapi.ErrGroupAvailability.repositories/memberswas excluded asreasonIdentity("identity, credentials and access management"). It lists member repositories, not principals, so this PR records it as served byget_repository. If that exclusion was deliberate, I'm happy to revert this part and drop the field.mcp.md(tool table and thecheck_availabilitygroup note) and an Unreleased upgrade note.Tests
group_members_test.goruns through the full authenticated MCP stack, using a groupnpm-allwith the membersweb-npm(priority 0) andhidden(priority 1):web-npm;membersfield;[].The existing
check_availabilitygroup case now expects the MCP message.Checked against a real server
On a local server with a Composer group (
php-hosted,php-proxy), MCPget_repository phpreturned both members in order,get_repository php-proxyhad nomembersfield, andcheck_availabilityon the group returned the new message.Checks
golangci-lint run ./...passes.go test -shortpasses forinternal/mcpandcmd/server.make docs-checkandmake deadcodepass.-tags noai,nomcpbuild and vet pass.Related: #471 proposes a batch availability check that resolves groups server-side; this PR is the small piece that helps today's single-version
check_availability.🤖 Generated with Claude Code