Skip to content

feat(mcp): list a group's members in get_repository - #472

Merged
M0Rf30 merged 2 commits into
openartifact:mainfrom
orcamedia:feat/mcp-group-members
Nov 12, 2026
Merged

M0Rf30 merged 2 commits into
openartifact:mainfrom
orcamedia:feat/mcp-group-members

Conversation

@orcamedia

Copy link
Copy Markdown
Contributor

check_availability refuses 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 needs manage.

Change

get_repository adds members for a group repository, in group order:

"members": [
  {"name": "php-hosted", "format": "composer", "repo_type": "hosted", "priority": 0},
  {"name": "php-proxy",  "format": "composer", "repo_type": "proxy",  "priority": 1}
]
  • Unreadable members are left out. This is the MCP rule that a repository you can't read behaves as if it doesn't exist. No count of hidden members is returned either.
  • Only groups get the field. Other repository types have no members. A group with no readable member has members: [], so "nothing visible" isn't mistaken for "not a group".
  • Group rules in the descriptions. The tool description states the rules from Availability: check a whole lockfile in one call, including through a group #471: the first member in group order that has a version decides it, also when that member holds it back (its 403 fails the install), and unless merge_proxy_versions is set, a name a hosted member holds is decided by the hosted members only.
  • Clearer group error. The MCP group error from check_availability, and the tool's description, now point at get_repository. The REST error text is unchanged: there's a separate MCP message, and ExplainAvailability still returns api.ErrGroupAvailability.
  • Drift table: repositories/members was excluded as reasonIdentity ("identity, credentials and access management"). It lists member repositories, not principals, so this PR records it as served by get_repository. If that exclusion was deliberate, I'm happy to revert this part and drop the field.
  • Docs: mcp.md (tool table and the check_availability group note) and an Unreleased upgrade note.

Tests

group_members_test.go runs through the full authenticated MCP stack, using a group npm-all with the members web-npm (priority 0) and hidden (priority 1):

  • an admin sees both members, in priority order;
  • the read-only token sees only web-npm;
  • a proxy has no members field;
  • a group whose only member is unreadable returns [].

The existing check_availability group case now expects the MCP message.

Checked against a real server

On a local server with a Composer group (php-hosted, php-proxy), MCP get_repository php returned both members in order, get_repository php-proxy had no members field, and check_availability on the group returned the new message.

Checks

  • golangci-lint run ./... passes.
  • go test -short passes for internal/mcp and cmd/server.
  • make docs-check and make deadcode pass.
  • The -tags noai,nomcp build 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

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 M0Rf30 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
@orcamedia

Copy link
Copy Markdown
Contributor Author

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 M0Rf30 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The member filter now matches group.Handler.members, and the test covers blocked, nested and other-format members. Thanks.

@M0Rf30
M0Rf30 merged commit 075e703 into openartifact:main Nov 12, 2026
23 checks passed
@orcamedia
orcamedia deleted the feat/mcp-group-members branch November 13, 2026 16:51
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.

2 participants