Forgejo MCP (forgejo-mcp)
Use the forgejo-mcp MCP tools (and forgejo:// resources when supported) as the primary interface for Forgejo operations.
Core Workflows & Tool Selection
forgejo://resources vs. tools: Prefer aforgejo://resource when you already have a specific SHA, issue/PR index, or ID; preferlist_*/search_*tools when listing or searching. Resources cap embedded lists at30items and include a sentinel naming thelist_*tool when truncated.- Files & multi-file commits: Use
list_repo_contents(path=""for root) orget_repo_tree(recursive=truefor full tree), andget_file_content(supports 1-indexedstart_line/end_line, ignored ifwith_metadata=true). Usechange_filesto atomically create, update, and delete multiple files in one commit;create_file/update_filerequire exactly one ofcontentorcontent_base64(strict standard Base64). - Pull requests & diffs: Call
list_pull_request_filesfirst, then pass individual filenames asfile_pathtoget_pull_request_diffto avoid loading huge multi-file diffs. Usecreate_pull_review+submit_pull_reviewandmerge_pull_request. - Issues, labels & dependencies:
create_issueapplieslabels(comma-separated names/IDs),assignees, andmilestone(numeric ID) in one call. Cross-repo dependencies are supported viaadd_issue_dependency/remove_issue_dependency(depends_on_owner/depends_on_repo). - Forgejo Actions (v16+ for run/job/artifact details): List runs with
list_workflow_runs, inspect jobs withlist_action_run_jobs, and read tail-first logs withget_action_job_logs(offset/max_bytes). Trigger workflows withdispatch_workflow. - Releases, packages & attachments:
download_*_attachmentreturns inline content if< 1 MiBand metadata + URL otherwise.create_*_attachmentaccepts base64contentor hostfile_path(disabled by default).
Read references/tools-and-resources.md for the complete tool catalog and forgejo:// URI templates.
Gotchas
- Actions
run_id!= web URLrun_number: Run-scoped tools (list_action_run_jobs,cancel_workflow_run,delete_workflow_run,list_action_run_artifacts) require the databaserun_idreturned bylist_workflow_runs, not the per-reporun_numberfrom.../actions/runs/<N>. Filterlist_workflow_runswith"run_number": Nto resolve the databaserun_id. - Wiki pages are flat: Slash-separated titles like
Guides/Setupdo not create hierarchy or aGuidesparent.create_wiki_pageoverwrites existing titles and returns a normalizedpage_name—always use thatpage_namein subsequent calls, and%2F-encode/inforgejo://.../wiki/{pageName}URIs without double-encoding. update_issuemutual exclusions & replacements:due_date(RFC3339) andclear_due_date=truecannot both be set.set_labelsreplaces the entire label set (""clears all).- Label guards & exclusive labels:
create_repo_label/create_org_labelwithexclusive=truerequires a scoped name (scope/value,/not at either end).delete_*_labelrefuses in-use labels unlessdelete_mode=force. - High-impact / irreversible tools:
delete_orgpermanently deletes all repos/teams;reset_issue_timewipes all tracked time on an issue/PR;delete_packagedeletes one version with no preflight;test_repo_hooktriggers a live HTTP webhook delivery;delete_workflow_runfails on live runs and removes logs/artifacts. - No
file_pathuploads by default:create_*_attachmentwithfile_pathfails unless the server enablesFORGEJO_MCP_ALLOW_FILE_PATH_UPLOAD=1(ideally confined viaFORGEJO_MCP_UPLOAD_ROOT).
Server Setup & Troubleshooting
If forgejo-mcp is not connected or needs transport/network/auth setup (http/sse per-request Authorization vs --allow-operator-token-fallback, --allowed-hosts requirement on non-loopback --host, --cli mode, or OAuth --auth-mode resource-server), read references/setup-and-config.md.


