# Go MCP Servers Makefile .PHONY: all build test clean install uninstall fmt vet lint e2e help # Variables GOCMD = go GOBUILD = $(GOCMD) build GOTEST = $(GOCMD) test GOFMT = $(GOCMD) fmt GOVET = $(GOCMD) vet BINDIR = bin INSTALLDIR = /usr/local/bin # Server binaries SERVERS = git filesystem fetch memory sequential-thinking time maildir signal gitlab imap bash speech BINARIES = $(addprefix $(BINDIR)/mcp-,$(SERVERS)) # Build flags LDFLAGS = -ldflags="-s -w" BUILD_FLAGS = $(LDFLAGS) -trimpath all: build ## Build all servers build: $(BINARIES) ## Build all MCP servers $(BINDIR)/mcp-%: cmd/%/main.go @mkdir -p $(BINDIR) @if [ "$*" = "signal" ]; then \ CGO_ENABLED=1 $(GOBUILD) $(BUILD_FLAGS) -o $@ ./cmd/$*; \ else \ $(GOBUILD) $(BUILD_FLAGS) -o $@ ./cmd/$*; \ fi test: ## Run all tests $(GOTEST) -v ./... test-smoke: clean build @echo "Running smoke tests for all MCP servers..." @for server in $(SERVERS); do \ echo "Testing mcp-$$server..."; \ echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}' | ./bin/mcp-$$server . | jq '.'; \ echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}' | ./bin/mcp-$$server . | jq '.'; \ echo '{"jsonrpc": "2.0", "id": 1, "method": "resources/list", "params": {}}' | ./bin/mcp-$$server . | jq '.'; \ echo '{"jsonrpc": "2.0", "id": 1, "method": "prompts/list", "params": {}}' | ./bin/mcp-$$server . | jq '.'; \ echo '{"jsonrpc": "2.0", "id": 1, "method": "roots/list", "params": {}}' | ./bin/mcp-$$server . | jq '.'; \ done test-coverage: ## Run tests with coverage $(GOTEST) -cover ./... e2e: clean build ## Run end-to-end integration tests @echo "Running e2e integration tests..." cd test/integration && $(GOTEST) -v -timeout=30s ./... clean: ## Clean build artifacts rm -rf $(BINDIR) install: build ## Install binaries to system (requires sudo) @echo "Installing MCP servers to $(INSTALLDIR)..." @for binary in $(BINARIES); do \ echo "Installing $$binary to $(INSTALLDIR)"; \ install -m 755 $$binary $(INSTALLDIR)/; \ done @echo "Installation complete!" uninstall: ## Remove installed binaries @echo "Removing MCP servers from $(INSTALLDIR)..." @for server in $(SERVERS); do \ rm -f $(INSTALLDIR)/mcp-$$server; \ done @echo "Uninstall complete!" fmt: ## Format Go source code $(GOFMT) ./... vet: ## Run go vet $(GOVET) ./... lint: fmt vet ## Run formatting and vetting dev-setup: ## Set up development environment @echo "Setting up development environment..." @go mod download @go mod tidy @echo "Development environment ready!" release: clean test build ## Build release version @echo "Building release binaries..." @for server in $(SERVERS); do \ echo "Building mcp-$$server..."; \ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) $(BUILD_FLAGS) -o $(BINDIR)/linux-amd64/mcp-$$server ./cmd/$$server; \ CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GOBUILD) $(BUILD_FLAGS) -o $(BINDIR)/darwin-amd64/mcp-$$server ./cmd/$$server; \ CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 $(GOBUILD) $(BUILD_FLAGS) -o $(BINDIR)/darwin-arm64/mcp-$$server ./cmd/$$server; \ CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) $(BUILD_FLAGS) -o $(BINDIR)/windows-amd64/mcp-$$server.exe ./cmd/$$server; \ done @echo "Release build complete!" benchmark: ## Run benchmarks $(GOTEST) -bench=. -benchmem ./... deps: ## Download dependencies $(GOCMD) mod download $(GOCMD) mod tidy verify: test lint ## Verify code quality docker-build: ## Build Docker image docker build -t mcp-servers . docker-run: docker-build ## Run servers in Docker docker run -it mcp-servers # Individual server targets git: $(BINDIR)/mcp-git ## Build git server only filesystem: $(BINDIR)/mcp-filesystem ## Build filesystem server only fetch: $(BINDIR)/mcp-fetch ## Build fetch server only memory: $(BINDIR)/mcp-memory ## Build memory server only sequential-thinking: $(BINDIR)/mcp-sequential-thinking ## Build sequential-thinking server only time: $(BINDIR)/mcp-time ## Build time server only maildir: $(BINDIR)/mcp-maildir ## Build maildir server only signal: $(BINDIR)/mcp-signal ## Build signal server only gitlab: $(BINDIR)/mcp-gitlab ## Build gitlab server only imap: $(BINDIR)/mcp-imap ## Build imap server only bash: $(BINDIR)/mcp-bash ## Build bash server only speech: $(BINDIR)/mcp-speech ## Build speech server only help: ## Show this help message @echo "Go MCP Servers - Available targets:" @echo "" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' @echo "" @echo "Individual servers:" @echo " git, filesystem, fetch, memory, sequential-thinking, time, maildir, signal, gitlab, imap, bash, speech"