mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2025-08-23 22:33:05 +00:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
001383142f | ||
|
b35919989f | ||
|
d0225c4c24 | ||
|
6993bb2b5d | ||
|
f1b4a208a7 | ||
|
d76f02a234 | ||
|
b2bde61882 | ||
|
7cfa1fa218 | ||
|
1fecc1df30 |
@@ -1,19 +1,18 @@
|
||||
{
|
||||
"name": "Gitea MCP DevContainer",
|
||||
"image": "mcr.microsoft.com/devcontainers/go:1.24-bookworm",
|
||||
"features": {
|
||||
},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {},
|
||||
"extensions": [
|
||||
"editorconfig.editorconfig",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"golang.go",
|
||||
"stylelint.vscode-stylelint",
|
||||
"DavidAnson.vscode-markdownlint",
|
||||
"github.copilot"
|
||||
]
|
||||
}
|
||||
"name": "Gitea MCP DevContainer",
|
||||
"image": "mcr.microsoft.com/devcontainers/go:1.24-bookworm",
|
||||
"features": {},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {},
|
||||
"extensions": [
|
||||
"editorconfig.editorconfig",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"golang.go",
|
||||
"stylelint.vscode-stylelint",
|
||||
"DavidAnson.vscode-markdownlint",
|
||||
"github.copilot"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
61
.dockerignore
Normal file
61
.dockerignore
Normal file
@@ -0,0 +1,61 @@
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
.github/
|
||||
.gitea/
|
||||
|
||||
# Docker
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
|
||||
# Build artifacts
|
||||
bin/
|
||||
dist/
|
||||
build/
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Go specific
|
||||
vendor/
|
||||
go.work
|
||||
|
||||
# Testing
|
||||
*_test.go
|
||||
**/test/
|
||||
**/tests/
|
||||
coverage.out
|
||||
coverage.html
|
||||
|
||||
# IDE and editor files
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS specific
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Temporary files
|
||||
tmp/
|
||||
temp/
|
||||
*.tmp
|
||||
*.log
|
||||
|
||||
# Documentation
|
||||
docs/
|
||||
*.md
|
||||
LICENSE
|
||||
|
||||
# Development tools
|
||||
.air.toml
|
||||
.golangci.yml
|
||||
.goreleaser.yml
|
||||
|
||||
# Debug files
|
||||
debug
|
||||
__debug_bin
|
@@ -1,41 +1,33 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
goreleaser:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: setup go
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
- name: release-build
|
||||
run: go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-linux-amd64
|
||||
- name: release-build-windows
|
||||
run: GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-windows-amd64.exe
|
||||
- name: release-build-darwin
|
||||
run: GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-darwin-amd64
|
||||
- name: release-build-arm64
|
||||
run: GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-linux-arm64
|
||||
- name: release-build-windows-arm64
|
||||
run: GOOS=windows GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-windows-arm64.exe
|
||||
- name: release-build-darwin-arm64
|
||||
run: GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X 'main.Version=${{ gitea.ref_name }}'" -o bin/mcp-gitea-${{ gitea.ref_name }}-darwin-arm64
|
||||
|
||||
- name: Use Go Action
|
||||
id: use-go-action
|
||||
uses: https://gitea.com/actions/gitea-release-action@main
|
||||
go-version: stable
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
files: |-
|
||||
bin/**
|
||||
token: '${{secrets.RELEASE_TOKEN}}'
|
||||
distribution: goreleaser
|
||||
# 'latest', 'nightly', or a semver
|
||||
version: "~> v2"
|
||||
args: release --clean
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GORELEASER_FORCE_TOKEN: "gitea"
|
||||
|
||||
release-image:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
|
76
.goreleaser.yaml
Normal file
76
.goreleaser.yaml
Normal file
@@ -0,0 +1,76 @@
|
||||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||
|
||||
version: 2
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
main: .
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
flags:
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -s -w
|
||||
- -X main.Version={{.Version}}
|
||||
|
||||
archives:
|
||||
- formats: tar.gz
|
||||
# this name template makes the OS and Arch compatible with the results of `uname`.
|
||||
name_template: >-
|
||||
{{ .ProjectName }}_
|
||||
{{- title .Os }}_
|
||||
{{- if eq .Arch "amd64" }}x86_64
|
||||
{{- else if eq .Arch "386" }}i386
|
||||
{{- else }}{{ .Arch }}{{ end }}
|
||||
{{- if .Arm }}v{{ .Arm }}{{ end }}
|
||||
# use zip for windows archives
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
formats: zip
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
groups:
|
||||
- title: Features
|
||||
regexp: "^.*feat[(\\w)]*:+.*$"
|
||||
order: 0
|
||||
- title: "Bug fixes"
|
||||
regexp: "^.*fix[(\\w)]*:+.*$"
|
||||
order: 1
|
||||
- title: "Enhancements"
|
||||
regexp: "^.*chore[(\\w)]*:+.*$"
|
||||
order: 2
|
||||
- title: "Refactor"
|
||||
regexp: "^.*refactor[(\\w)]*:+.*$"
|
||||
order: 3
|
||||
- title: "Build process updates"
|
||||
regexp: ^.*?(build|ci)(\(.+\))??!?:.+$
|
||||
order: 4
|
||||
- title: "Documentation updates"
|
||||
regexp: ^.*?docs?(\(.+\))??!?:.+$
|
||||
order: 4
|
||||
- title: Others
|
||||
order: 999
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs:"
|
||||
- "^test:"
|
||||
|
||||
release:
|
||||
footer: >-
|
||||
|
||||
---
|
||||
|
||||
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
|
||||
|
||||
gitea_urls:
|
||||
api: https://gitea.com/api/v1
|
||||
download: https://gitea.com
|
||||
force_token: gitea
|
20
Makefile
20
Makefile
@@ -11,6 +11,26 @@ help: ## Print this help message.
|
||||
@echo ""
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
.PHONY: install
|
||||
install: build ## Install the application.
|
||||
@echo "Installing $(EXECUTABLE)..."
|
||||
@mkdir -p $(GOPATH)/bin
|
||||
@cp $(EXECUTABLE) $(GOPATH)/bin/$(EXECUTABLE)
|
||||
@echo "Installed $(EXECUTABLE) to $(GOPATH)/bin/$(EXECUTABLE)"
|
||||
@echo "Please add $(GOPATH)/bin to your PATH if it is not already there."
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall: ## Uninstall the application.
|
||||
@echo "Uninstalling $(EXECUTABLE)..."
|
||||
@rm -f $(GOPATH)/bin/$(EXECUTABLE)
|
||||
@echo "Uninstalled $(EXECUTABLE) from $(GOPATH)/bin/$(EXECUTABLE)"
|
||||
|
||||
.PHONY: clean
|
||||
clean: ## Clean the build artifacts.
|
||||
@echo "Cleaning up build artifacts..."
|
||||
@rm -f $(EXECUTABLE)
|
||||
@echo "Cleaned up $(EXECUTABLE)"
|
||||
|
||||
.PHONY: build
|
||||
build: ## Build the application.
|
||||
$(GO) build -v -ldflags '-s -w $(LDFLAGS)' -o $(EXECUTABLE)
|
||||
|
@@ -77,12 +77,12 @@ Before building, make sure you have the following installed:
|
||||
Then run:
|
||||
|
||||
```bash
|
||||
make build
|
||||
make install
|
||||
```
|
||||
|
||||
### 📁 Add to PATH
|
||||
|
||||
After building, copy the binary gitea-mcp to a directory included in your system's PATH. For example:
|
||||
After installing, copy the binary gitea-mcp to a directory included in your system's PATH. For example:
|
||||
|
||||
```bash
|
||||
cp gitea-mcp /usr/local/bin/
|
||||
@@ -109,7 +109,7 @@ To configure the MCP server for Gitea, add the following to your MCP configurati
|
||||
],
|
||||
"env": {
|
||||
// "GITEA_HOST": "https://gitea.com",
|
||||
// "GITEA_INTERACTIVE": "true",
|
||||
// "GITEA_INSECURE": "true",
|
||||
"GITEA_ACCESS_TOKEN": "<your personal access token>"
|
||||
}
|
||||
}
|
||||
|
@@ -77,7 +77,7 @@ git clone https://gitea.com/gitea/gitea-mcp.git
|
||||
然后运行:
|
||||
|
||||
```bash
|
||||
make build
|
||||
make install
|
||||
```
|
||||
|
||||
### 📁 添加到 PATH
|
||||
@@ -109,7 +109,7 @@ cp gitea-mcp /usr/local/bin/
|
||||
],
|
||||
"env": {
|
||||
// "GITEA_HOST": "https://gitea.com",
|
||||
// "GITEA_INTERACTIVE": "true",
|
||||
// "GITEA_INSECURE": "true",
|
||||
"GITEA_ACCESS_TOKEN": "<your personal access token>"
|
||||
}
|
||||
}
|
||||
|
@@ -77,12 +77,12 @@ git clone https://gitea.com/gitea/gitea-mcp.git
|
||||
然後運行:
|
||||
|
||||
```bash
|
||||
make build
|
||||
make install
|
||||
```
|
||||
|
||||
### 📁 添加到 PATH
|
||||
|
||||
構建後,將二進制文件 gitea-mcp 複製到系統 PATH 中包含的目錄。例如:
|
||||
安裝後,將二進制文件 gitea-mcp 複製到系統 PATH 中包含的目錄。例如:
|
||||
|
||||
```bash
|
||||
cp gitea-mcp /usr/local/bin/
|
||||
@@ -109,7 +109,7 @@ cp gitea-mcp /usr/local/bin/
|
||||
],
|
||||
"env": {
|
||||
// "GITEA_HOST": "https://gitea.com",
|
||||
// "GITEA_INTERACTIVE": "true",
|
||||
// "GITEA_INSECURE": "true",
|
||||
"GITEA_ACCESS_TOKEN": "<your personal access token>"
|
||||
}
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ func init() {
|
||||
flag.StringVar(
|
||||
&host,
|
||||
"host",
|
||||
"https://gitea.com",
|
||||
os.Getenv("GITEA_HOST"),
|
||||
"Gitea host",
|
||||
)
|
||||
flag.IntVar(
|
||||
@@ -72,9 +72,6 @@ func init() {
|
||||
flag.Parse()
|
||||
|
||||
flagPkg.Host = host
|
||||
if flagPkg.Host == "" {
|
||||
flagPkg.Host = os.Getenv("GITEA_HOST")
|
||||
}
|
||||
if flagPkg.Host == "" {
|
||||
flagPkg.Host = "https://gitea.com"
|
||||
}
|
||||
|
Reference in New Issue
Block a user