Repository navigation
Commit f13bdd6
fix(publish): correct misleading org-namespace guidance in 403 and docs (#1483)
## The problem
When a publish is refused for an `io.github.*` namespace, the 403 tells
you to make your GitHub organization membership public:
> If you're trying to publish to a GitHub organization, you may need to
make your organization membership public in your GitHub settings:
https://docs.github.com/...
That advice has been wrong since #1383. It replaced the
public-membership lookup (`GET /users/{login}/orgs`) with a check on the
caller's organization **role** (`GET /user/memberships/orgs`). Public
membership no longer factors into the decision at all.
The cost is not theoretical. In #1468 the reporter *is* an Owner of the
org, *and* their membership *is* public — confirmed via `GET
/orgs/qatouch/public_members`. The message sent them, and a maintainer,
through a week of re-checking GitHub settings that were never the
problem.
The docs have the mirror-image defect: `authentication.mdx` walks the
reader through `mcp-publisher login github`, then explains that org
publishing requires Owner, and qualifies **only** the PAT cases — never
saying that the interactive flow cannot grant an org namespace at all.
## Root cause of the underlying limitation
`mcp-publisher login github` authenticates against a **GitHub App**
(`Iv23liUydBbI7Z2Q9bOZ` → `mcp-registry-login-prod`), not an OAuth App.
GitHub Apps ignore the OAuth `scope` parameter, so the `read:org
read:user` requested in `cmd/publisher/auth/github-at.go:144` has no
effect, and GitHub App user tokens cannot read organization memberships.
Critically, GitHub signals this with **`200 OK` and an empty array**,
not a 403 — so none of the safeguards #1383 added (rate-limit detection,
`X-GitHub-SSO`, the deliberate fail-closed path) ever execute. The
registry simply concludes "owns no organizations."
Verified against production, same account and same request within the
same hour:
| credential | `GET
/user/memberships/orgs?state=active&per_page=100&page=1` |
|---|---|
| OAuth App token with `read:org` | **16 orgs, 8 as Owner** |
| GitHub App user token from the prod device flow | **0 orgs** |
The resulting prod JWT carried exactly one permission:
`io.github.<user>/*`.
Consistent with that timeline: `io.github.qatouch/qatouch` published
successfully on 2026-07-03, and v1.8.0 (the first release containing
#1383) reached production 2026-07-13.
## What this PR changes
**Nothing about authorization.** Message and documentation text only.
- `publish.go` — the org hint now states the two real requirements
(Owner role, *and* a credential that can read that role) and names the
credentials that work: GitHub Actions OIDC, or `mcp-publisher login
github --token <classic PAT with read:org>`. The docs URL is extracted
to `orgNamespaceDocsURL` and points at
`modelcontextprotocol.io/registry/authentication` (verified 200).
- `authentication.mdx` — a `<Warning>` stating plainly that the device
flow cannot publish to an org namespace, why, that it affects everyone
regardless of role or membership visibility, and the two paths that do
work.
- `publish_internal_test.go` — new in-package tests (`_internal_test.go`
per the repo convention that satisfies `testpackage`).
## Tests
Written test-first; both behaviour tests were watched failing against
the old message before the fix:
```
--- FAIL: TestBuildPermissionErrorMessageDoesNotAdvisePublicisingOrgMembership
--- FAIL: TestBuildPermissionErrorMessageNamesWorkingOrgAuthPaths
```
Four tests now cover: the misleading advice is gone; the working auth
paths are named; the attempted-vs-granted namespaces are still reported
(the diagnostic core); and the GitHub guidance does not leak onto
DNS/HTTP-verified namespaces.
`go build ./...`, `go test ./internal/...` (with PostgreSQL up) and
`gofmt` are clean. `golangci-lint` reports no new findings — the only
hit in a touched file is the pre-existing `goconst` on `publish.go:35`,
which is also present on `main`.
## Deliberately out of scope
- **The actual fix for org publishing.** That needs the login client to
become a real OAuth App, which requires an Owner of the
`modelcontextprotocol` org to create it plus a `githubClientId` change
in the three Pulumi stacks. Still under discussion.
- **Observability.** `fetchOrgMembershipsPage` returns `nil, nil` on a
403 with no log line (`github_at.go:270`), which is why this was
undiagnosable server-side. Worth fixing under any outcome; kept out to
keep this reviewable, and I'll follow up with a separate PR.
Closes nothing on its own — #1468 stays open until org publishing
actually works.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <[email protected]>1 parent 82441f0 commit f13bdd6
3 files changed
Lines changed: 98 additions & 3 deletions
File tree
- docs/modelcontextprotocol-io
- internal/api/handlers/v0
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
57 | 68 | | |
58 | 69 | | |
59 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
| |||
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
94 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
95 | 103 | | |
96 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
97 | 109 | | |
98 | 110 | | |
99 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
0 commit comments