forked from github/github-mcp-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
221 lines (176 loc) · 7.28 KB
/
Makefile
File metadata and controls
221 lines (176 loc) · 7.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# Makefile for GitHub MCP Server with LMM Oracle and MPC
.PHONY: build build-all clean test test-coverage lint fmt vet deps docker-build docker-run help
# Build variables
BINARY_NAME=github-mcp-server
LMM_BINARY_NAME=lmm-server
VERSION?=dev
COMMIT?=$(shell git rev-parse --short HEAD)
DATE?=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS=-ldflags "-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}"
# Go variables
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
GOFMT=gofmt
GOVET=$(GOCMD) vet
# Directories
BUILD_DIR=build
CMD_DIR=cmd
PKG_DIR=pkg
help: ## Display this help message
@echo "GitHub MCP Server with LMM Oracle and MPC"
@echo "========================================="
@echo ""
@echo "Available targets:"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
build: ## Build the main GitHub MCP server
@echo "Building GitHub MCP Server..."
@mkdir -p $(BUILD_DIR)
$(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) ./$(CMD_DIR)/github-mcp-server
build-lmm: ## Build the LMM Oracle and MPC server
@echo "Building LMM Oracle and MPC Server..."
@mkdir -p $(BUILD_DIR)
$(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/$(LMM_BINARY_NAME) ./$(CMD_DIR)/lmm-server
build-mcpcurl: ## Build the mcpcurl tool
@echo "Building mcpcurl..."
@mkdir -p $(BUILD_DIR)
$(GOBUILD) -o $(BUILD_DIR)/mcpcurl ./$(CMD_DIR)/mcpcurl
build-all: build build-lmm build-mcpcurl ## Build all binaries
@echo "All binaries built successfully!"
@ls -la $(BUILD_DIR)/
clean: ## Clean build artifacts
@echo "Cleaning build artifacts..."
$(GOCLEAN)
rm -rf $(BUILD_DIR)
test: ## Run tests
@echo "Running tests..."
$(GOTEST) -v ./...
test-coverage: ## Run tests with coverage
@echo "Running tests with coverage..."
$(GOTEST) -v -coverprofile=coverage.out ./...
$(GOCMD) tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
test-lmm: ## Run LMM-specific tests
@echo "Running LMM tests..."
$(GOTEST) -v ./$(PKG_DIR)/lmm/...
lint: ## Run linter
@echo "Running linter..."
@which golangci-lint > /dev/null || (echo "Installing golangci-lint..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
golangci-lint run
fmt: ## Format Go code
@echo "Formatting Go code..."
$(GOFMT) -s -w .
vet: ## Run go vet
@echo "Running go vet..."
$(GOVET) ./...
deps: ## Download dependencies
@echo "Downloading dependencies..."
$(GOMOD) download
$(GOMOD) tidy
deps-update: ## Update dependencies
@echo "Updating dependencies..."
$(GOMOD) get -u ./...
$(GOMOD) tidy
# Docker targets
docker-build: ## Build Docker image
@echo "Building Docker image..."
docker build -t github-mcp-server:$(VERSION) .
docker-build-lmm: ## Build LMM Docker image
@echo "Building LMM Docker image..."
docker build -f Dockerfile.lmm -t lmm-server:$(VERSION) .
docker-run: ## Run Docker container
@echo "Running Docker container..."
docker run -it --rm \
-e GITHUB_PERSONAL_ACCESS_TOKEN=${GITHUB_PERSONAL_ACCESS_TOKEN} \
github-mcp-server:$(VERSION)
docker-run-lmm: ## Run LMM Docker container
@echo "Running LMM Docker container..."
docker run -it --rm lmm-server:$(VERSION) stdio
# Development targets
dev-setup: deps ## Setup development environment
@echo "Setting up development environment..."
@which golangci-lint > /dev/null || go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@echo "Development environment ready!"
run-github: build ## Run GitHub MCP server locally
@echo "Running GitHub MCP server..."
./$(BUILD_DIR)/$(BINARY_NAME) stdio
run-lmm: build-lmm ## Run LMM server locally
@echo "Running LMM server..."
./$(BUILD_DIR)/$(LMM_BINARY_NAME) stdio
run-example: build-lmm ## Run LMM usage example
@echo "Running LMM usage example..."
$(GOCMD) run ./examples/lmm_usage.go
# Testing with mcpcurl
test-mcpcurl: build build-mcpcurl ## Test with mcpcurl
@echo "Testing GitHub MCP server with mcpcurl..."
@echo "Make sure to set GITHUB_PERSONAL_ACCESS_TOKEN environment variable"
./$(BUILD_DIR)/mcpcurl --stdio-server-cmd="./$(BUILD_DIR)/$(BINARY_NAME) stdio" tools --help
test-lmm-mcpcurl: build-lmm build-mcpcurl ## Test LMM server with mcpcurl
@echo "Testing LMM server with mcpcurl..."
./$(BUILD_DIR)/mcpcurl --stdio-server-cmd="./$(BUILD_DIR)/$(LMM_BINARY_NAME) stdio" tools --help
# Release targets
release-build: ## Build release binaries for multiple platforms
@echo "Building release binaries..."
@mkdir -p $(BUILD_DIR)/release
# Linux AMD64
GOOS=linux GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/release/$(BINARY_NAME)-linux-amd64 ./$(CMD_DIR)/github-mcp-server
GOOS=linux GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/release/$(LMM_BINARY_NAME)-linux-amd64 ./$(CMD_DIR)/lmm-server
# macOS AMD64
GOOS=darwin GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/release/$(BINARY_NAME)-darwin-amd64 ./$(CMD_DIR)/github-mcp-server
GOOS=darwin GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/release/$(LMM_BINARY_NAME)-darwin-amd64 ./$(CMD_DIR)/lmm-server
# macOS ARM64
GOOS=darwin GOARCH=arm64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/release/$(BINARY_NAME)-darwin-arm64 ./$(CMD_DIR)/github-mcp-server
GOOS=darwin GOARCH=arm64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/release/$(LMM_BINARY_NAME)-darwin-arm64 ./$(CMD_DIR)/lmm-server
# Windows AMD64
GOOS=windows GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/release/$(BINARY_NAME)-windows-amd64.exe ./$(CMD_DIR)/github-mcp-server
GOOS=windows GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BUILD_DIR)/release/$(LMM_BINARY_NAME)-windows-amd64.exe ./$(CMD_DIR)/lmm-server
@echo "Release binaries built:"
@ls -la $(BUILD_DIR)/release/
# Quality assurance
qa: fmt vet lint test ## Run all quality assurance checks
@echo "All QA checks passed!"
# CI/CD targets
ci: deps qa test-coverage ## Run CI pipeline
@echo "CI pipeline completed successfully!"
# Documentation
docs: ## Generate documentation
@echo "Generating documentation..."
$(GOCMD) doc -all ./$(PKG_DIR)/lmm > docs/lmm-api.md
@echo "Documentation generated in docs/"
# Benchmarks
bench: ## Run benchmarks
@echo "Running benchmarks..."
$(GOTEST) -bench=. -benchmem ./...
bench-lmm: ## Run LMM benchmarks
@echo "Running LMM benchmarks..."
$(GOTEST) -bench=. -benchmem ./$(PKG_DIR)/lmm/...
# Security
security-scan: ## Run security scan
@echo "Running security scan..."
@which gosec > /dev/null || go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest
gosec ./...
# Performance profiling
profile-cpu: build-lmm ## Profile CPU usage
@echo "Profiling CPU usage..."
$(GOCMD) test -cpuprofile=cpu.prof -bench=. ./$(PKG_DIR)/lmm/...
$(GOCMD) tool pprof cpu.prof
profile-mem: build-lmm ## Profile memory usage
@echo "Profiling memory usage..."
$(GOCMD) test -memprofile=mem.prof -bench=. ./$(PKG_DIR)/lmm/...
$(GOCMD) tool pprof mem.prof
# Installation
install: build build-lmm ## Install binaries to GOPATH/bin
@echo "Installing binaries..."
cp $(BUILD_DIR)/$(BINARY_NAME) $(GOPATH)/bin/
cp $(BUILD_DIR)/$(LMM_BINARY_NAME) $(GOPATH)/bin/
@echo "Binaries installed to $(GOPATH)/bin/"
uninstall: ## Uninstall binaries from GOPATH/bin
@echo "Uninstalling binaries..."
rm -f $(GOPATH)/bin/$(BINARY_NAME)
rm -f $(GOPATH)/bin/$(LMM_BINARY_NAME)
@echo "Binaries uninstalled"
# Default target
all: build-all test ## Build all and run tests