Generalizes the issue surfaced in #124 (unbounded tool outputs blowing up context windows) into an architectural invariant: every MCP tool whose output size depends on data must expose a caller-controlled bound and a way to fetch the remainder. Three sub-rules: no silent truncation, bound by domain shape (line/per-file/page), always resumable. - Add docs/design/output-bounding.md with rule, sub-rules, parameter vocabulary table, documentation contract, and a checklist for new tools. - Update AGENTS.md "Adding a New Tool" to require the checklist for any tool whose output is data-proportional. Tracked as forgejo-mcp-e0j. Complementary to the OpenSpec change add-bounded-text-responses, which delivers the rule for the specific tools called out in #124 (get_pull_request_diff, get_file_content).
4.8 KiB
AGENTS.md
This file provides guidance to AI coding assistants (Claude Code, Cursor, etc.) when working with this repository.
For detailed developer documentation, see DEVELOPER.md.
Quick Reference
make build # Build the binary (outputs ./forgejo-mcp)
make vendor # Tidy and verify Go module dependencies
Architecture Summary
main.go → cmd/cmd.go (CLI parsing) → operation/operation.go (tool registration) → operation/{domain}/*.go (tool handlers)
Key directories:
operation/- MCP tool definitions and handlers by domainpkg/forgejo/- Singleton Forgejo SDK client wrapperpkg/to/- Response formatting helperspkg/params/- Shared parameter descriptions
Adding a New Tool
- Create or modify a file in
operation/{domain}/ - Define tool with
mcp.NewTool()and implement handler function - Register in the domain's
RegisterTool(s *server.MCPServer)function - If new domain, import and call in
operation/operation.go - Bound the output. If response size depends on data (not tool semantics), the tool MUST satisfy docs/design/output-bounding.md: client-controlled bound + resumability + documented parameters. Use the checklist there in the PR description.
See DEVELOPER.md for complete code examples and patterns.
Blocked Features
Some features are blocked on upstream API/SDK support. See docs/plans/ for:
wiki-support.md- Wiki API (blocked on forgejo-sdk)projects-support.md- Projects/Kanban API (blocked on Gitea 1.26.0)
Repository Labels
Labels for goern/forgejo-mcp on Codeberg:
| ID | Name | Color | Description |
|---|---|---|---|
| 335058 | Kind/Feature | 0288d1 | New functionality |
| 335061 | Kind/Enhancement | 84b6eb | Improve existing functionality |
| 335091 | Status/Blocked | 880e4f | Something is blocking this issue or pull request |
| 335103 | Priority/Medium | e64a19 | The priority is medium |
Usage with Codeberg MCP
When adding labels via the mcp__codeberg__add_issue_labels tool, use the numeric ID:
mcp__codeberg__add_issue_labels(
owner: "goern",
repo: "forgejo-mcp",
index: <issue_number>,
labels: "<label_id>" # e.g., "335091" for Status/Blocked
)
Landing the Plane (Session Completion)
When ending a work session, you MUST complete ALL steps below. Work is NOT complete until git push succeeds.
MANDATORY WORKFLOW:
- File issues for remaining work - Create issues for anything that needs follow-up
- Run quality gates (if code changed) - Tests, linters, builds
- Update issue status - Close finished work, update in-progress items
- PUSH TO REMOTE - This is MANDATORY:
git pull --rebase bd sync git push git status # MUST show "up to date with origin" - Clean up - Clear stashes, prune remote branches
- Verify - All changes committed AND pushed
- Hand off - Provide context for next session
CRITICAL RULES:
- Work is NOT complete until
git pushsucceeds - NEVER stop before pushing - that leaves work stranded locally
- NEVER say "ready to push when you are" - YOU must push
- If push fails, resolve and retry until it succeeds
Beads Issue Tracker
This project uses bd (beads) for issue tracking. Run bd prime to see full workflow context and commands.
Quick Reference
bd ready # Find available work
bd show <id> # View issue details
bd update <id> --claim # Claim work
bd close <id> # Complete work
Rules
- Use
bdfor ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists - Run
bd primefor detailed command reference and session close protocol - Use
bd rememberfor persistent knowledge — do NOT use MEMORY.md files
Session Completion
When ending a work session, you MUST complete ALL steps below. Work is NOT complete until git push succeeds.
MANDATORY WORKFLOW:
- File issues for remaining work - Create issues for anything that needs follow-up
- Run quality gates (if code changed) - Tests, linters, builds
- Update issue status - Close finished work, update in-progress items
- PUSH TO REMOTE - This is MANDATORY:
git pull --rebase bd dolt push git push git status # MUST show "up to date with origin" - Clean up - Clear stashes, prune remote branches
- Verify - All changes committed AND pushed
- Hand off - Provide context for next session
CRITICAL RULES:
- Work is NOT complete until
git pushsucceeds - NEVER stop before pushing - that leaves work stranded locally
- NEVER say "ready to push when you are" - YOU must push
- If push fails, resolve and retry until it succeeds