feat: add bulk operations - 4 new MCP tools for repo/file management #1
Reference in New Issue
Block a user
Delete Branch "feat/bulk-operations"
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?
Summary
Adds 4 new MCP tools that dramatically reduce the number of calls needed for common workflows. Solves real pain points encountered when using Claude/AI agents with this MCP server.
Background — The Problem
The current MCP exposes only single-file operations:
get_file_contentsreturns one file at a time (base64-encoded — doubles the size)create_or_update_filecommits one file per commit (no atomicity)create_releasedoesn't upload assets — incomplete publishing workflowReal impact: When trying to fetch 3 small EspoCRM extensions (~250 files each) for code review, the MCP would have required 750+ sequential calls, with files >80KB getting truncated by tool result limits. In practice we had to skip the deep analysis and fetch only a handful of critical files.
The 4 New Tools
1.
download_repo_archive⭐ (the big one)Calls Gitea's
GET /repos/{owner}/{repo}/archive/{ref}.{format}endpoint, saves bytes to disk, returns sha256 for integrity.Impact: 250+ calls → 1 call. Context tokens: ~50K → ~100.
2.
get_files_batchFetch up to 20 files in parallel via goroutines. Built-in safety cap on total response size (default 500KB).
3.
commit_multiple_filesAtomic multi-file commit using Gitea SDK's
ChangeFilesAPI. Max 50 files per commit, supports create/update/delete.4.
upload_release_attachmentUpload a file as asset to existing release (multipart form POST). Completes the publish workflow.
Files added
No new dependencies — uses existing
gitea_sdk,pkg/gitea(DoBytes),pkg/flag,pkg/log,pkg/params,pkg/to,pkg/context, and stdlib.Security by Design
Every tool follows our Security by Design principles:
filepath.IsAbsrequired for write/read operationsurl.PathEscapeon owner/repo/release_idPerformance comparison
Testing
go build ./...)golangci-lint run)download_repo_archiveon a small repoget_files_batchwith 5 filescommit_multiple_filescreate+update+delete in one commitupload_release_attachmentwith a .zip(Unit tests will follow in a separate commit — wanted to get the API design reviewed first.)
Versioning
Suggest tagging this as v0.6.0 (minor — only additions, no breaking changes).
Reference
Design doc and patches are also tracked in the consumer project:
infrastructure/mcp-improvements/gitea-mcp-enhancements/(Marcus Law internal).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.