fix: use ServerVersion for connection check instead of GetMyUserInfo #112
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/OpenSpec
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
RFC - Request For Comments
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
hermes-attempted
hermes-needs-clarification
hermes-ready
hermes-review
hermes-wip
human-required
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
agentic-forges/forgejo-mcp!112
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/112/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
VerifyConnection()andHealthCheck()both callGetMyUserInfo()as a connectivity probe. This requires theread:userscope.Forgejo enforces that tokens scoped to specific repositories can only use
read:issue,write:issue,read:repository, andwrite:repository—read:useris explicitly disallowed. This causes the server to crash at startup with:This affects any user following least-privilege token practices by scoping their token to specific repositories.
Fix
Replace
GetMyUserInfo()withClient().ServerVersion(), which hits/api/v1/version. That endpoint requires no authentication at all, making it a strictly better connectivity probe: it confirms the server is reachable and the URL is correct without imposing any scope requirements on the token.The log output is adjusted accordingly —
server_versionis logged instead ofauthenticated_user.Testing
Tested against Codeberg with a repository-scoped token (issue + repository scopes only). Server starts cleanly, registers all tools, and responds to MCP handshake.