- Add documentation for MCP tool constants and tool registration
- Use configurable default values for pagination arguments in user organization queries
- Introduce registerTools helper to streamline MCP tool registration
- Refactor pagination argument parsing into a reusable getIntArg function
- Add descriptive logging for tool handler execution
- Improve code organization for defining and registering MCP tools
Signed-off-by: appleboy <appleboy.tw@gmail.com>
## **What:**
Adds full label management capabilities to the Gitea CLI for both repositories and issues. Users can now create, edit, delete, list, and assign labels without leaving the terminal.
## **Why:**
Labels are a core part of keeping repositories and issues organized. Previously, `gitea-mcp` lacked CLI support for label management, forcing users to rely on the web UI or custom scripts. This update closes that gap, enabling smoother automation and more efficient workflows.
## **How:**
Implemented new `label` subcommands:
* **Repository Labels:**
* `list_repo_labels` — Lists all labels for a repository.
* `get_repo_label` — Retrieves a label by ID.
* `create_repo_label` — Creates a new label.
* `edit_repo_label` — Updates an existing label.
* `delete_repo_label` — Removes a label.
* **Issue Labels:**
* `add_issue_labels` — Adds one or more labels to an issue.
* `replace_issue_labels` — Replaces all labels on an issue.
* `clear_issue_labels` — Removes all labels from an issue.
* `remove_issue_label` — Removes a single label from an issue.
## **Testing:**
User acceptance testing was performed across all new commands, confirming correct behavior for creating, editing, deleting, listing, and applying labels. Also looped through 20 issues in roo Orchestrator mode and assigned different labels to each without issue.
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/83
Reviewed-by: hiifong <i@hiif.ong>
Co-authored-by: meestark <meestark@meestark.net>
Co-committed-by: meestark <meestark@meestark.net>
### What
Ensure `create_release` accepts and forwards a `body` so release notes are created as provided.
### Why
Previously, the `body` parameter wasn’t threaded through, resulting in empty release notes even when a body was supplied.
### How
- Add `body` parameter to the function signature
- Thread `body` through handler/service to the API call
- Light refactor for clarity; no breaking changes
### Testing
- Manual: created a release with a non-empty body and confirmed it appears in the UI and in the releases API response
### Links
Fixesgitea/gitea-mcp#81
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/82
Reviewed-by: hiifong <i@hiif.ong>
Co-authored-by: meestark <meestark@meestark.net>
Co-committed-by: meestark <meestark@meestark.net>
Normally, each file should be end with a blank line, but git does not consider it as a new line, so we should not return it to llm, or it may generate wrong information when editing the existing file.
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/80
Reviewed-by: hiifong <i@hiif.ong>
Co-authored-by: yp05327 <576951401@qq.com>
Co-committed-by: yp05327 <576951401@qq.com>
- Import the time package to support time-based configuration
- Set the HTTP server's heartbeat interval to 30 seconds using a new option in its initialization
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Refactor server initialization calls in Run to use multiline construction style and explicitly pass options in HTTP mode
- Fix logic in Default to prevent redundant logger initialization
- Remove unused Logger function and introduce a Logger struct with Infof and Errorf methods for structured logging
- Add a New function for creating instances of the Logger struct
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/64
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
- Remove extra blank lines for cleaner code formatting
- Combine variable declaration of GetGiteaMCPServerVersionTool into a single line for clarity
Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Add .air.toml configuration file for Air live reloading with specific build and file watch settings
- Ignore the tmp directory in .gitignore
- Rename the gitea server configuration to gitea-mcp-stdio in the VSCode config and add separate configuration for gitea-mcp-http
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/57
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
### 🚀 What's Changed
This PR introduces a new MCP tool `get_dir_content` that allows users to retrieve a list of entries (files and subdirectories) from a specified directory in a Gitea repository.
### ✨ Features Added
- **New Tool**: `GetDirContent` tool for directory listing functionality
- **Tool Registration**: Properly registered as a read operation in the MCP server
- **Parameter Validation**: Comprehensive input validation for required parameters
- **Error Handling**: Robust error handling with descriptive error messages
### 🔧 Technical Details
- **Tool Name**: `get_dir_content`
- **Required Parameters**:
- `owner`: Repository owner
- `repo`: Repository name
- `ref`: Branch, tag, or commit reference
- `filePath`: Directory path to list
### 📁 Files Modified
- file.go: Added tool definition, registration, and handler function
### 🎯 Use Cases
This tool enables users to:
- Browse repository directory structures
- List files and folders in specific directories
- Navigate repository contents programmatically
- Support file management workflows in MCP clients
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/53
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: ZRE <chy853@gmail.com>
Co-committed-by: ZRE <chy853@gmail.com>
- Switch build base image to Alpine and set platform dynamically
- Use distroless nonroot image for final stage to enhance security
- Add build arguments for VERSION, TARGETOS, and TARGETARCH with defaults
- Cache Go module and build dependencies to improve build performance
- Remove manual installation of ca-certificates and user creation (handled by base image)
- Set nonroot user for running the application
- Add healthcheck for the built binary
- Add OCI-compliant author and version labels
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/50
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
- Refactor HTTP client initialization to always create a custom http.Client
- Move TLS config modification into the default HTTP client when insecure flag is set
- Ensure the HTTP client is always included in client options
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/47
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
- Update download instructions for clarity and consistency in all README files
- Add example configuration for HTTP mode to all README files
- Expand transport type support to include "http" in command-line flags and documentation
- Implement HTTP server mode in the application entrypoint
- Update log output behavior to include "http" mode alongside "sse" for stdout logging
- Refine Chinese README translations for greater accuracy and localization
Signed-off-by: appleboy <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/45
Co-authored-by: appleboy <appleboy.tw@gmail.com>
Co-committed-by: appleboy <appleboy.tw@gmail.com>
- Remove .vscode directory from .gitignore to allow versioning of VS Code settings
- Add a VS Code server configuration file with prompts for Gitea host, access token, and insecure connection option
- Configure a stdio-based server launch for gitea-mcp with relevant environment variables
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/43
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Update dependencies to newer versions in go.mod
- Refactor all request argument accesses to use req.GetArguments() instead of direct access to req.Params.Arguments
- Change variable declaration for ListRepoCommitsTool from a grouped var block to a single var statement for consistency
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/42
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>
- Rename job from `release` to `goreleaser` in `release-tag.yml`
- Change the tag pattern from `' * '` to `" * "` in `release-tag.yml`
- Update job steps to better describe their actions in `release-tag.yml`
- Replace build steps with GoReleaser action steps in `release-tag.yml`
- Add configuration file `.goreleaser.yaml` for GoReleaser
- Include hooks, builds, archives, changelog sorting, and release footer in `.goreleaser.yaml`
Signed-off-by: appleboy <appleboy.tw@gmail.com>
## Why
With the following configuration:
```bash
docker run -i --rm -e GITEA_HOST=<gitea_host> -e GITEA_ACCESS_TOKEN=<gitea_access_token_for_host> docker.gitea.com/gitea-mcp-server:latest
```
after mcp-client calling a tool, the gitea client will encounter the following fatal error:
```
FATAL gitea/gitea.go:47 create gitea client err: user does not exist [uid: 0, name: ]
gitea.com/gitea/gitea-mcp/pkg/gitea.Client.func1
/app/pkg/gitea/gitea.go:47
sync.(*Once).doSlow
/usr/local/go/src/sync/once.go:78
sync.(*Once).Do
/usr/local/go/src/sync/once.go:69
gitea.com/gitea/gitea-mcp/pkg/gitea.Client
/app/pkg/gitea/gitea.go:21
gitea.com/gitea/gitea-mcp/operation/search.SearchReposFn
/app/operation/search/search.go:161
github.com/mark3labs/mcp-go/server.(*MCPServer).handleToolCall
/go/pkg/mod/github.com/mark3labs/mcp-go@v0.18.0/server/server.go:717
github.com/mark3labs/mcp-go/server.(*MCPServer).HandleMessage
/go/pkg/mod/github.com/mark3labs/mcp-go@v0.18.0/server/request_handler.go:264
github.com/mark3labs/mcp-go/server.(*StdioServer).processMessage
/go/pkg/mod/github.com/mark3labs/mcp-go@v0.18.0/server/stdio.go:228
github.com/mark3labs/mcp-go/server.(*StdioServer).processInputStream
/go/pkg/mod/github.com/mark3labs/mcp-go@v0.18.0/server/stdio.go:143
github.com/mark3labs/mcp-go/server.(*StdioServer).Listen
/go/pkg/mod/github.com/mark3labs/mcp-go@v0.18.0/server/stdio.go:209
github.com/mark3labs/mcp-go/server.ServeStdio
/go/pkg/mod/github.com/mark3labs/mcp-go@v0.18.0/server/stdio.go:282
gitea.com/gitea/gitea-mcp/operation.Run
/app/operation/operation.go:48
gitea.com/gitea/gitea-mcp/cmd.Execute
/app/cmd/cmd.go:119
main.main
/app/main.go:12
runtime.main
/usr/local/go/src/runtime/proc.go:283
```
Turns out the root cause was because the `GITEA_HOST` environment variable wasn't overriding the default flag value, resulting in mismatch of host and access token.
The if statement won't be entered
7cfa1fa218/cmd/cmd.go (L74-L77)
Due to `host` could never be evaluated as an empty string from the default value `"http://gitea.com"`
7cfa1fa218/cmd/cmd.go (L35-L40)
Unless user specify `gitea-mcp ... --host <empty_string> ...` with environment `GITEA_HOST=<non_empty_string>` at the same time, which is very unlikely IMHO.
## How
- Set `host` flag default value from `GITEA_HOST` environment variable value
- Remove possible dead code if-statement
Co-authored-by: hiifong <i@hiif.ong>
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/23
Reviewed-by: hiifong <i@hiif.ong>
Co-authored-by: Flynn Hou <flynnhou7@gmail.com>
Co-committed-by: Flynn Hou <flynnhou7@gmail.com>
- Add `GITEA_INTERACTIVE` configuration example in README files
- Add `insecure` flag to ignore TLS certificate errors in `cmd.go`
- Set insecure mode based on `GITEA_INSECURE` environment variable in `cmd.go`
- Add `Insecure` boolean variable in `pkg/flag/flag.go`
- Import `crypto/tls` and `net/http` in `pkg/gitea/gitea.go`
- Modify Gitea client creation to support insecure HTTP client in `pkg/gitea/gitea.go`
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/20
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-committed-by: Bo-Yi Wu <appleboy.tw@gmail.com>