2
0

feat: Rebrand to GitCaddy and add AI learning tools docs
Some checks failed
Release / build (arm64, linux) (push) Has been cancelled
Release / release (push) Has been cancelled
Release / build (arm64, darwin) (push) Has been cancelled
Release / build (amd64, darwin) (push) Has been cancelled
Release / build (amd64, linux) (push) Has been cancelled
Release / build (amd64, windows) (push) Has been cancelled

This commit is contained in:
2026-01-14 17:56:12 +00:00
parent 970c02c877
commit 0e649775de
2 changed files with 347 additions and 286 deletions

103
README.md
View File

@@ -1,12 +1,13 @@
# Gitea MCP Server # GitCaddy MCP Server
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that enables AI assistants like Claude to interact directly with your Gitea instance. A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that enables AI assistants like Claude to interact directly with your GitCaddy instance.
## Features ## Features
- **Query Runners** - List runners, check status, view capabilities (OS, tools, disk space) - **Query Runners** - List runners, check status, view capabilities (OS, tools, disk space)
- **Monitor Workflows** - List runs, get job details, view logs - **Monitor Workflows** - List runs, get job details, view logs
- **Manage Releases** - List releases, get assets, check download counts - **Manage Releases** - List releases, get assets, check download counts
- **AI Learning** - Query error patterns, report solutions, help other AIs learn
- **AI-Friendly** - Structured JSON responses designed for AI consumption - **AI-Friendly** - Structured JSON responses designed for AI consumption
## Quick Start ## Quick Start
@@ -23,8 +24,8 @@ Add to your Claude Code settings:
```json ```json
{ {
"mcpServers": { "mcpServers": {
"gitea": { "gitcaddy": {
"command": "/path/to/gitea-mcp-server", "command": "/path/to/gitcaddy-mcp-server",
"args": ["--url", "https://git.marketally.com", "--token", "YOUR_API_TOKEN"] "args": ["--url", "https://git.marketally.com", "--token", "YOUR_API_TOKEN"]
} }
} }
@@ -35,11 +36,11 @@ Add to your Claude Code settings:
```json ```json
{ {
"mcpServers": { "mcpServers": {
"gitea": { "gitcaddy": {
"command": "/path/to/gitea-mcp-server", "command": "/path/to/gitcaddy-mcp-server",
"env": { "env": {
"GITEA_URL": "https://git.marketally.com", "GITCADDY_URL": "https://git.marketally.com",
"GITEA_TOKEN": "your-token-here" "GITCADDY_TOKEN": "your-token-here"
} }
} }
} }
@@ -53,9 +54,13 @@ Ask Claude things like:
- "Show me the latest workflow runs for gitcaddy/act_runner" - "Show me the latest workflow runs for gitcaddy/act_runner"
- "Why did run #77 fail?" - "Why did run #77 fail?"
- "What assets are in the v0.3.6 release?" - "What assets are in the v0.3.6 release?"
- "Are there any known solutions for NETSDK1147?"
- "Diagnose why job 456 failed"
## Available Tools ## Available Tools
### Runner & Workflow Tools
| Tool | Description | | Tool | Description |
|------|-------------| |------|-------------|
| `list_runners` | List all runners with status, capabilities, disk space | | `list_runners` | List all runners with status, capabilities, disk space |
@@ -66,61 +71,111 @@ Ask Claude things like:
| `list_releases` | List releases for a repository | | `list_releases` | List releases for a repository |
| `get_release` | Get release details with all assets | | `get_release` | Get release details with all assets |
### AI Learning Tools
| Tool | Description |
|------|-------------|
| `get_error_patterns` | Query known CI/CD error patterns with diagnoses and solutions |
| `report_error_solution` | Report a solution that fixed an error (helps other AIs learn) |
| `report_solution_success` | Mark a solution as successful (improves ranking) |
| `get_compatibility_matrix` | See what project types work on which runners |
| `diagnose_job_failure` | Auto-analyze failed job logs and suggest solutions |
## AI Learning System
GitCaddy includes a collaborative AI learning system. When you encounter and fix CI/CD errors, you can report your solutions to help other AI assistants:
```
AI encounters error -> get_error_patterns -> finds solution -> applies fix
|
v
report_solution_success
(improves ranking)
AI finds NEW solution -> report_error_solution -> stored in database
|
v
Other AIs can now find it
```
### Example: Diagnosing a Failed Build
```
User: "Why did job 789 fail?"
Claude uses: diagnose_job_failure(owner="myorg", repo="myapp", job_id=789)
Response:
{
"extracted_errors": ["NETSDK1147", "XA5300"],
"diagnoses": [
{
"pattern": "NETSDK1147",
"diagnosis": "The .NET MAUI Android workload is not installed",
"solution": "Install the workload: dotnet workload install maui-android",
"success_rate": 94.5
}
]
}
```
## Building from Source ## Building from Source
```bash ```bash
git clone https://git.marketally.com/gitcaddy/mcp-server.git git clone https://git.marketally.com/gitcaddy/mcp-server.git
cd mcp-server cd mcp-server
go build -o gitea-mcp-server . go build -o gitcaddy-mcp-server .
``` ```
### Cross-compile for all platforms ### Cross-compile for all platforms
```bash ```bash
# Linux # Linux
GOOS=linux GOARCH=amd64 go build -o gitea-mcp-server-linux-amd64 . GOOS=linux GOARCH=amd64 go build -o gitcaddy-mcp-server-linux-amd64 .
# macOS Intel # macOS Intel
GOOS=darwin GOARCH=amd64 go build -o gitea-mcp-server-darwin-amd64 . GOOS=darwin GOARCH=amd64 go build -o gitcaddy-mcp-server-darwin-amd64 .
# macOS Apple Silicon # macOS Apple Silicon
GOOS=darwin GOARCH=arm64 go build -o gitea-mcp-server-darwin-arm64 . GOOS=darwin GOARCH=arm64 go build -o gitcaddy-mcp-server-darwin-arm64 .
# Windows # Windows
GOOS=windows GOARCH=amd64 go build -o gitea-mcp-server-windows-amd64.exe . GOOS=windows GOARCH=amd64 go build -o gitcaddy-mcp-server-windows-amd64.exe .
``` ```
## Architecture ## Architecture
``` ```
┌─────────────┐ stdio ┌──────────────────┐ HTTP ┌─────────────┐ +-------------+ stdio +------------------+ HTTP +-------------+
Claude Code │ ◄────────────► │ gitea-mcp-server │ ◄───────────► │ Gitea | Claude Code | <------------> | gitcaddy-mcp | <-----------> | GitCaddy |
(AI Tool) JSON-RPC (This binary) /api/v2/mcp Server | (AI Tool) | JSON-RPC | (This binary) | /api/v2/mcp | Server |
└─────────────┘ └──────────────────┘ └─────────────┘ +-------------+ +------------------+ +-------------+
``` ```
The MCP server: The MCP server:
1. Receives JSON-RPC requests over stdio from Claude Code 1. Receives JSON-RPC requests over stdio from Claude Code
2. Forwards them to Gitea's `/api/v2/mcp` endpoint 2. Forwards them to GitCaddy's `/api/v2/mcp` endpoint
3. Returns responses back to Claude Code 3. Returns responses back to Claude Code
## Configuration Options ## Configuration Options
| Flag | Env Variable | Description | | Flag | Env Variable | Description |
|------|-------------|-------------| |------|-------------|-------------|
| `--url` | `GITEA_URL` | Gitea server URL (required) | | `--url` | `GITCADDY_URL` | GitCaddy server URL (required) |
| `--token` | `GITEA_TOKEN` | API token for authentication | | `--token` | `GITCADDY_TOKEN` | API token for authentication |
| `--debug` | - | Enable debug logging to stderr | | `--debug` | - | Enable debug logging to stderr |
**Note:** `GITEA_URL` and `GITEA_TOKEN` are also supported for backwards compatibility.
## Obtaining an API Token ## Obtaining an API Token
1. Go to your Gitea instance Settings Applications 1. Go to your GitCaddy instance -> Settings -> Applications
2. Generate a new token with appropriate scopes 2. Generate a new token with appropriate scopes
3. Copy the token and use it in your configuration 3. Copy the token and use it in your configuration
## Requirements ## Requirements
- Gitea 1.26+ with GitCaddy enhancements (includes `/api/v2/mcp` endpoint) - GitCaddy Server (Gitea 1.26+ with GitCaddy enhancements)
- Go 1.21+ (for building from source) - Go 1.21+ (for building from source)
## License ## License
@@ -129,5 +184,5 @@ MIT License - See [LICENSE](LICENSE) file.
## Related Projects ## Related Projects
- [GitCaddy Gitea](https://git.marketally.com/gitcaddy/gitea) - Enhanced Gitea fork with AI-friendly APIs - [GitCaddy Server](https://git.marketally.com/gitcaddy/gitea) - Enhanced Gitea fork with AI-friendly APIs
- [GitCaddy act_runner](https://git.marketally.com/gitcaddy/act_runner) - Enhanced runner with capabilities detection - [GitCaddy Runner](https://git.marketally.com/gitcaddy/act_runner) - Enhanced runner with capabilities detection

28
main.go
View File

@@ -1,21 +1,21 @@
// Copyright 2026 MarketAlly. All rights reserved. // Copyright 2026 MarketAlly. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Gitea MCP Server - Model Context Protocol server for Gitea Actions // GitCaddy MCP Server - Model Context Protocol server for GitCaddy/Gitea Actions
// //
// This standalone server implements the MCP protocol over stdio, // This standalone server implements the MCP protocol over stdio,
// proxying requests to a Gitea instance's /api/v2/mcp endpoint. // proxying requests to a GitCaddy instance's /api/v2/mcp endpoint.
// //
// Usage: // Usage:
// //
// gitea-mcp-server --url https://git.example.com --token YOUR_API_TOKEN // gitcaddy-mcp-server --url https://git.example.com --token YOUR_API_TOKEN
// //
// Configure in Claude Code's settings.json: // Configure in Claude Code's settings.json:
// //
// { // {
// "mcpServers": { // "mcpServers": {
// "gitea": { // "gitcaddy": {
// "command": "gitea-mcp-server", // "command": "gitcaddy-mcp-server",
// "args": ["--url", "https://git.example.com", "--token", "YOUR_TOKEN"] // "args": ["--url", "https://git.example.com", "--token", "YOUR_TOKEN"]
// } // }
// } // }
@@ -41,25 +41,31 @@ var (
) )
func main() { func main() {
flag.StringVar(&giteaURL, "url", "", "Gitea server URL (e.g., https://git.example.com)") flag.StringVar(&giteaURL, "url", "", "GitCaddy server URL (e.g., https://git.example.com)")
flag.StringVar(&giteaToken, "token", "", "Gitea API token") flag.StringVar(&giteaToken, "token", "", "GitCaddy API token")
flag.BoolVar(&debug, "debug", false, "Enable debug logging to stderr") flag.BoolVar(&debug, "debug", false, "Enable debug logging to stderr")
flag.Parse() flag.Parse()
// Also check environment variables // Check environment variables (GITCADDY_* preferred, GITEA_* for backwards compat)
if giteaURL == "" {
giteaURL = os.Getenv("GITCADDY_URL")
}
if giteaURL == "" { if giteaURL == "" {
giteaURL = os.Getenv("GITEA_URL") giteaURL = os.Getenv("GITEA_URL")
} }
if giteaToken == "" {
giteaToken = os.Getenv("GITCADDY_TOKEN")
}
if giteaToken == "" { if giteaToken == "" {
giteaToken = os.Getenv("GITEA_TOKEN") giteaToken = os.Getenv("GITEA_TOKEN")
} }
if giteaURL == "" { if giteaURL == "" {
fmt.Fprintln(os.Stderr, "Error: --url or GITEA_URL is required") fmt.Fprintln(os.Stderr, "Error: --url or GITCADDY_URL is required")
os.Exit(1) os.Exit(1)
} }
debugLog("Gitea MCP Server starting") debugLog("GitCaddy MCP Server starting")
debugLog("Connecting to: %s", giteaURL) debugLog("Connecting to: %s", giteaURL)
// Read JSON-RPC messages from stdin, forward to Gitea, write responses to stdout // Read JSON-RPC messages from stdin, forward to Gitea, write responses to stdout