QENEX Law — Forgejo write-access enablement (ops handoff)#
Goal: let the qenex-mcp connector create the qenex-law repo and commit files, without handing cloud/scheduled Claude sessions broad admin. Prepared: 2026-08-09 · for whoever holds estate (admin/SSO) access.
The blocker (observed this session)#
- Forgejo writes require admin + SSO (
qenex_forgejo_pr_create); cloud/scheduled sessions run asmcp_user. qenex_http_callcan't reach Forgejo either: the HTTP allowlist is empty (/etc/qenex/http-connector.yaml, 0 hosts loaded), and POST/PUT need admin regardless.- No file-commit MCP tool exists between those two.
Option A — least-privilege dedicated write tool (RECOMMENDED)#
Add a purpose-built tool to the qenex-mcp server (e.g. qenex_forgejo_repo_create, qenex_forgejo_file_put) that:
- performs the write server-side with a scoped Forgejo service token (read from the secrets dir, never passed by the caller);
- is callable under the
mcp_userread role, but restricted to an allowlist of repo/paths (e.g. ownerqenex-admin, repoqenex-law, pathdocs/**); - logs every write to the audit stream.
This keeps sessions at mcp_user while enabling exactly the writes needed — same pattern the eventual QENEX Law build will want.
Service token (create under a dedicated bot account, e.g. qenex-law-bot):
write:repository— create repos, commit contentswrite:organization— only if repos are created under theqenex-adminorg- Store at
/etc/qenex/secrets/forgejo_law_token(mode0600, owned by the mcp service user)
Option B — allowlist + admin (faster, broader privilege)#
If you'd rather use the generic qenex_http_call:
- Add to
/etc/qenex/http-connector.yaml:
```yaml hosts: git.qenex.ai: methods: [GET, POST, PUT, PATCH] credential: forgejo_law_token reason: "QENEX Law repo/doc automation" owner: ceo@qenex.ai review_date: 2026-11-09 ```
- Place the token at
/etc/qenex/secrets/forgejo_law_token(connector addsAuthorization: Bearer <token>). - Grant the calling session the admin role —
http_callPOST/PUT/PATCH require it.
⚠ This gives that session broad write across all admin tools — less contained than Option A.
- Reload + verify:
qenex_http_allowlist(reload=true)(host loads, circuit breaker closed).
What I'd run once either is in place#
- Create repo
qenex-admin/qenex-law(auto-init). - Commit
docs/design-spec-v0.1.md(the v0.1 spec already drafted).
Forgejo API reference:
POST https://git.qenex.ai/api/v1/orgs/qenex-admin/repos
{"name":"qenex-law","private":true,"auto_init":true}
PUT https://git.qenex.ai/api/v1/repos/qenex-admin/qenex-law/contents/docs/design-spec-v0.1.md
{"message":"docs: QENEX Law v0.1 design spec","content":"<base64>","branch":"main"}
Recommendation#
Option A. Don't grant cloud/scheduled sessions blanket admin just to write docs — a scoped tool plus a limited bot token gives exactly the access required and nothing more, is auditable, and is reusable for the full QENEX Law build later.