MCP: user lookup + add/list collaborators so Claude Tag can share docs it creates
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #145 by @maxsam4 — closed without merging
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
Research direction
Start with the REST collaborator and user-lookup routes, then read apps/api/src/routes/events.ts for the g.mayWrite check. Extract the permission, validation and notification logic from REST into one shared function that both REST and the new MCP tools call, and read apps/api/src/mcp/tools.test.ts for the existing tool test pattern. Done when primer_lookup_user, primer_add_collaborator and primer_list_collaborators pass the listed guardrail tests, and REST behaviour is unchanged. Closed, unmerged PR #145 is linked, so check why it was closed before starting.
Written by the indexing model from the issue text.
Description
Problem
A Claude Tag session (Claude in Slack) can create a Primer document over MCP, but no one else can work on it afterwards.
primer_create_documentmakes the caller the document's owner. Claude Tag's MCP connection authenticates as the seeded service userservice-claude, soservice-claudeowns every document Claude Tag creates.- Writing events (
POST /api/documents/:id/events,apps/api/src/routes/events.ts) requires the owner or a collaborator (g.mayWrite). This is also how PADD review packets record a human's Send/verdict. - So when a human pressed Send on a Claude Tag-published PADD, Primer returned
403 {"error":"forbidden"}. That person was not a collaborator, and Claude Tag had no way to make them one.
The REST API already supports all of this:
GET /api/users/lookup?email=GETandPOST /api/documents/:docId/collaborators
But the MCP server exposes none of it. Claude Tag's sandbox can only reach Primer through MCP, because the Agent Proxy injects the bearer credential for /mcp only.
Local Claude Code sessions don't hit this. They create documents as the human, using the human's own token.
Use case
A Claude Tag session publishes a document (a PADD review packet, for example) on behalf of the person who asked for it. It then gives that person, and any other named reviewers, the access they need to read, comment, and send events. All of this happens over MCP, with no REST access and no human doing manual sharing in the UI.
Proposed MCP tools
All three tools must enforce the same permission checks, validation, and side effects as the REST routes they mirror. They are a second door onto existing behaviour, not new behaviour.
| Tool | Mirrors | Input | Returns |
|---|---|---|---|
primer_lookup_user |
GET /api/users/lookup?email= |
email |
{ id, email, displayName }, or a clear not-found result |
primer_add_collaborator |
POST /api/documents/:docId/collaborators |
documentId (or a Primer URL, resolved like the other tools), email or userId, role (editor | commenter) |
the collaborator row |
primer_list_collaborators |
GET /api/documents/:docId/collaborators |
documentId (or a Primer URL) |
the collaborator list |
Guardrails (acceptance criteria)
- Owner only.
primer_add_collaboratorandprimer_list_collaboratorsrequirecanManage, the same check as REST. For Claude Tag this means only documents the service account created. It can never grant access to someone else's document. - Add only. No MCP tool to change a role, remove a collaborator, change visibility, or transfer ownership. Re-adding an existing collaborator matches REST behaviour (conflict or no-op, whichever REST does today).
- Rule parity. Visibility rules match REST: an org-visible document rejects
commenterwithinvalid_role_for_visibility. - Not the service account. Adding
service-claude(the caller itself) is rejected. - Unknown emails fail clearly. An email with no Primer user returns a clear not-found error. The tool does not create users.
- Notification parity. The collaborator-added notification (
notifier.notifyCollaboratorAdded) fires exactly as it does from REST, so the added person learns about the document. - One implementation. REST and MCP share the logic, extracted into one function. There is no second copy of the permission or validation code that could drift.
- Tests. Tool tests in
apps/api/src/mcp/tools.test.tscover:- success
- non-owner → forbidden
- org document + commenter → rejected
- unknown email
- adding the service account
- adding a duplicate
- notification sent
- Docs. Tool descriptions say these are for sharing a document the caller created with the person who asked for it.
Out of scope / known limitations
- Shared service account. Every Claude Tag user acts as the same
service-claudeprincipal. Any Tag user could ask Claude to share any Tag-created document. Owner-only checks narrow this but don't remove it. Per-requester identity (see #45, and Claude Tag personal connectors) is the real fix. - Submit-only role. Org documents force reviewers to be
editor, which also lets them publish new versions. Whether PADD reviewers need a role that can send events without publishing versions is a separate design decision. - Image size limit. Inline images in PADDs hit the 256KB limit; tracked in #87.
- No ownership transfer. Ownership transfer is not needed for this use case.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 1
- Avg merge
- 13h 38m
- Merged PRs (30d)
- 24
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from 0xPolygon/primer
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Feature: @-mention people and agents in documents and comments; a mention notifies and subscribesOpen
Difficulty 5/5 Over a week Newbie friendliness 18/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 Half a day Newbie friendliness 45/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
0xPolygon/primer#185 · 1 comment ·
Maintainers usually reply within 1 day
All issues in 0xPolygon/primer
Similar issues
-
P3
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug L3 level 1 needs-review wocs
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
SatyamPandey-07/WorkSphere#10739 · 1 comment ·
Maintainers usually reply within 1 day
-
maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
assistant-ui/assistant-ui#10946 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:auth-provider issue-rating: 🦞 diamond lobster no-stale P2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openclaw/openclaw#206303 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day