ramparts 0.4.0

A CLI tool for scanning Model Context Protocol (MCP) servers
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
# MCP Scanner Multi-Architecture Build Makefile
# Supports cross-compilation for multiple platforms and architectures

# ============================================================================
# CONFIGURATION
# ============================================================================

# Project information
PROJECT_NAME := mcp-scanner
VERSION := $(shell grep '^version = ' Cargo.toml | cut -d'"' -f2)
AUTHOR := $(shell grep '^authors = ' Cargo.toml | cut -d'"' -f2 | cut -d'<' -f1 | xargs)

# Build directories
BUILD_DIR := target
RELEASE_DIR := $(BUILD_DIR)/release
DIST_DIR := dist
BIN_DIR := $(DIST_DIR)/bin

# Rust toolchain
RUST_VERSION := $(shell rustc --version | cut -d' ' -f2)
CARGO := cargo
RUSTUP := rustup

# ============================================================================
# ARCHITECTURE DETECTION
# ============================================================================

# Detect current architecture and OS
HOST_ARCH := $(shell uname -m)
HOST_OS := $(shell uname -s)

# Map host architecture to Rust target
ifeq ($(HOST_OS),Darwin)
    ifeq ($(HOST_ARCH),x86_64)
        CURRENT_TARGET := x86_64-apple-darwin
    else ifeq ($(HOST_ARCH),arm64)
        CURRENT_TARGET := aarch64-apple-darwin
    else
        CURRENT_TARGET := x86_64-apple-darwin
    endif
else ifeq ($(HOST_OS),Linux)
    ifeq ($(HOST_ARCH),x86_64)
        CURRENT_TARGET := x86_64-unknown-linux-gnu
    else ifeq ($(HOST_ARCH),aarch64)
        CURRENT_TARGET := aarch64-unknown-linux-gnu
    else
        CURRENT_TARGET := x86_64-unknown-linux-gnu
    endif
else ifeq ($(HOST_OS),MINGW32_NT-10.0)
    CURRENT_TARGET := x86_64-pc-windows-gnu
else ifeq ($(HOST_OS),MINGW64_NT-10.0)
    CURRENT_TARGET := x86_64-pc-windows-gnu
else
    CURRENT_TARGET := x86_64-unknown-linux-gnu
endif

# ============================================================================
# TARGET ARCHITECTURES
# ============================================================================

# Linux targets
LINUX_TARGETS := x86_64-unknown-linux-gnu \
                 aarch64-unknown-linux-gnu \
                 x86_64-unknown-linux-musl \
                 aarch64-unknown-linux-musl

# macOS targets
MACOS_TARGETS := x86_64-apple-darwin \
                 aarch64-apple-darwin

# Windows targets
WINDOWS_TARGETS := x86_64-pc-windows-gnu \
                   x86_64-pc-windows-msvc \
                   aarch64-pc-windows-msvc

# All targets
ALL_TARGETS := $(LINUX_TARGETS) $(MACOS_TARGETS) $(WINDOWS_TARGETS)

# ============================================================================
# BUILD CONFIGURATION
# ============================================================================

# Build profiles
PROFILES := debug release

# Features (if any)
FEATURES :=

# Default target - build for current architecture
.DEFAULT_GOAL := build

# ============================================================================
# UTILITY FUNCTIONS
# ============================================================================

# Check if target is installed
define check_target
	@echo "Checking if $(1) is installed..."
	@$(RUSTUP) target list --installed | grep -q "$(1)" || \
		(echo "Installing $(1)..." && $(RUSTUP) target add $(1))
endef

# Build for specific target
define build_target
	@echo "Building for $(1)..."
	@$(CARGO) build --target $(1) --release $(if $(FEATURES),--features $(FEATURES),)
endef

# Copy binary to distribution directory
define copy_binary
	@mkdir -p $(BIN_DIR)
	@if [ -f "$(BUILD_DIR)/$(1)/release/$(PROJECT_NAME)$(2)" ]; then \
		echo "Copying $(PROJECT_NAME)$(2) for $(1)..."; \
		cp "$(BUILD_DIR)/$(1)/release/$(PROJECT_NAME)$(2)" "$(BIN_DIR)/$(PROJECT_NAME)-$(1)$(2)"; \
	else \
		echo "Binary not found for $(1)"; \
	fi
endef

# ============================================================================
# MAIN TARGETS
# ============================================================================

.PHONY: help
help: ## Show this help message
	@echo "MCP Scanner Multi-Architecture Build System"
	@echo "=========================================="
	@echo ""
	@echo "Current System:"
	@echo "  OS: $(HOST_OS)"
	@echo "  Architecture: $(HOST_ARCH)"
	@echo "  Target: $(CURRENT_TARGET)"
	@echo ""
	@echo "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 "Target architectures:"
	@echo "  Linux:   $(LINUX_TARGETS)"
	@echo "  macOS:   $(MACOS_TARGETS)"
	@echo "  Windows: $(WINDOWS_TARGETS)"
	@echo ""
	@echo "Examples:"
	@echo "  make build                    # Build for current architecture"
	@echo "  make build-linux-x86_64      # Build for Linux x86_64"
	@echo "  make build-macos-aarch64     # Build for macOS ARM64"
	@echo "  make build-all               # Build for all targets"
	@echo "  make package                 # Create distribution packages"

.PHONY: build
build: ## Build for current architecture (auto-detected)
	@echo "Building for current architecture: $(CURRENT_TARGET)"
	$(call check_target,$(CURRENT_TARGET))
	$(call build_target,$(CURRENT_TARGET))
	$(call copy_binary,$(CURRENT_TARGET),$(if $(findstring windows,$(CURRENT_TARGET)),.exe,))
	@echo "Build complete for $(CURRENT_TARGET)"

.PHONY: clean
clean: ## Clean all build artifacts
	@echo "Cleaning build artifacts..."
	@$(CARGO) clean
	@rm -rf $(DIST_DIR)
	@echo "Clean complete"

.PHONY: fmt-check
fmt-check: ## Check code formatting (does not modify files)
	@echo "Checking code formatting..."
	@$(CARGO) fmt --all -- --check
	@echo "Formatting check complete"

.PHONY: check
check: ## Check code without building (all features)
	@echo "Checking code (all features)..."
	@$(CARGO) check --all-features
	@echo "Code check complete"

.PHONY: test
test: ## Run tests (all features)
	@echo "Running tests (all features)..."
	@$(CARGO) test --all-features
	@echo "Tests complete"

.PHONY: lint
lint: ## Run clippy linting (all features)
	@echo "Running clippy (all features)..."
	@$(CARGO) clippy --all-features -- -D warnings
	@echo "Clippy complete"

.PHONY: fmt
fmt: ## Format code
	@echo "Formatting code..."
	@$(CARGO) fmt
	@echo "Formatting complete"

.PHONY: audit
audit: ## Audit dependencies
	@echo "Auditing dependencies..."
	@$(CARGO) audit
	@echo "Audit complete"

# ============================================================================
# INDIVIDUAL TARGET BUILDS
# ============================================================================

# Linux builds
.PHONY: build-linux-x86_64
build-linux-x86_64: ## Build for Linux x86_64
	$(call check_target,x86_64-unknown-linux-gnu)
	$(call build_target,x86_64-unknown-linux-gnu)
	$(call copy_binary,x86_64-unknown-linux-gnu,)

.PHONY: build-linux-aarch64
build-linux-aarch64: ## Build for Linux ARM64
	$(call check_target,aarch64-unknown-linux-gnu)
	$(call build_target,aarch64-unknown-linux-gnu)
	$(call copy_binary,aarch64-unknown-linux-gnu,)

.PHONY: build-linux-x86_64-musl
build-linux-x86_64-musl: ## Build for Linux x86_64 (musl)
	$(call check_target,x86_64-unknown-linux-musl)
	$(call build_target,x86_64-unknown-linux-musl)
	$(call copy_binary,x86_64-unknown-linux-musl,)

.PHONY: build-linux-aarch64-musl
build-linux-aarch64-musl: ## Build for Linux ARM64 (musl)
	$(call check_target,aarch64-unknown-linux-musl)
	$(call build_target,aarch64-unknown-linux-musl)
	$(call copy_binary,aarch64-unknown-linux-musl,)

# macOS builds
.PHONY: build-macos-x86_64
build-macos-x86_64: ## Build for macOS x86_64
	$(call check_target,x86_64-apple-darwin)
	$(call build_target,x86_64-apple-darwin)
	$(call copy_binary,x86_64-apple-darwin,)

.PHONY: build-macos-aarch64
build-macos-aarch64: ## Build for macOS ARM64
	$(call check_target,aarch64-apple-darwin)
	$(call build_target,aarch64-apple-darwin)
	$(call copy_binary,aarch64-apple-darwin,)

# Windows builds
.PHONY: build-windows-x86_64-gnu
build-windows-x86_64-gnu: ## Build for Windows x86_64 (GNU)
	$(call check_target,x86_64-pc-windows-gnu)
	$(call build_target,x86_64-pc-windows-gnu)
	$(call copy_binary,x86_64-pc-windows-gnu,.exe)

.PHONY: build-windows-x86_64-msvc
build-windows-x86_64-msvc: ## Build for Windows x86_64 (MSVC)
	$(call check_target,x86_64-pc-windows-msvc)
	$(call build_target,x86_64-pc-windows-msvc)
	$(call copy_binary,x86_64-pc-windows-msvc,.exe)

.PHONY: build-windows-aarch64-msvc
build-windows-aarch64-msvc: ## Build for Windows ARM64 (MSVC)
	$(call check_target,aarch64-pc-windows-msvc)
	$(call build_target,aarch64-pc-windows-msvc)
	$(call copy_binary,aarch64-pc-windows-msvc,.exe)

# ============================================================================
# BATCH BUILDS
# ============================================================================

.PHONY: build-linux
build-linux: ## Build for all Linux targets
	@echo "Building for all Linux targets..."
	@$(MAKE) build-linux-x86_64
	@$(MAKE) build-linux-aarch64
	@$(MAKE) build-linux-x86_64-musl
	@$(MAKE) build-linux-aarch64-musl
	@echo "Linux builds complete"

.PHONY: build-macos
build-macos: ## Build for all macOS targets
	@echo "Building for all macOS targets..."
	@$(MAKE) build-macos-x86_64
	@$(MAKE) build-macos-aarch64
	@echo "macOS builds complete"

.PHONY: build-windows
build-windows: ## Build for all Windows targets
	@echo "Building for all Windows targets..."
	@$(MAKE) build-windows-x86_64-gnu
	@$(MAKE) build-windows-x86_64-msvc
	@$(MAKE) build-windows-aarch64-msvc
	@echo "Windows builds complete"

.PHONY: build-all
build-all: ## Build for all targets
	@echo "Building for all targets..."
	@$(MAKE) build-linux
	@$(MAKE) build-macos
	@$(MAKE) build-windows
	@echo "All builds complete"

# ============================================================================
# PACKAGING
# ============================================================================

.PHONY: package
package: build-all ## Create distribution packages
	@echo "Creating distribution packages..."
	@mkdir -p $(DIST_DIR)/packages
	@echo "Creating README for distribution..."
	@echo "# MCP Scanner v$(VERSION) - Multi-Architecture Builds" > $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "This directory contains pre-built binaries for multiple platforms and architectures." >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "## Available Binaries" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "### Linux" >> $(DIST_DIR)/README.md
	@echo "- \`mcp-scanner-x86_64-unknown-linux-gnu\` - Linux x86_64 (GNU)" >> $(DIST_DIR)/README.md
	@echo "- \`mcp-scanner-aarch64-unknown-linux-gnu\` - Linux ARM64 (GNU)" >> $(DIST_DIR)/README.md
	@echo "- \`mcp-scanner-x86_64-unknown-linux-musl\` - Linux x86_64 (musl)" >> $(DIST_DIR)/README.md
	@echo "- \`mcp-scanner-aarch64-unknown-linux-musl\` - Linux ARM64 (musl)" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "### macOS" >> $(DIST_DIR)/README.md
	@echo "- \`mcp-scanner-x86_64-apple-darwin\` - macOS x86_64" >> $(DIST_DIR)/README.md
	@echo "- \`mcp-scanner-aarch64-apple-darwin\` - macOS ARM64" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "### Windows" >> $(DIST_DIR)/README.md
	@echo "- \`mcp-scanner-x86_64-pc-windows-gnu.exe\` - Windows x86_64 (GNU)" >> $(DIST_DIR)/README.md
	@echo "- \`mcp-scanner-x86_64-pc-windows-msvc.exe\` - Windows x86_64 (MSVC)" >> $(DIST_DIR)/README.md
	@echo "- \`mcp-scanner-aarch64-pc-windows-msvc.exe\` - Windows ARM64 (MSVC)" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "## Installation" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "1. Download the appropriate binary for your platform" >> $(DIST_DIR)/README.md
	@echo "2. Make it executable (Linux/macOS): \`chmod +x mcp-scanner-*\`" >> $(DIST_DIR)/README.md
	@echo "3. Move to a directory in your PATH: \`sudo mv mcp-scanner-* /usr/local/bin/\`" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "## Usage" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "\`\`\`bash" >> $(DIST_DIR)/README.md
	@echo "# Basic scan" >> $(DIST_DIR)/README.md
	@echo "mcp-scanner scan http://localhost:3000" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "# Start microservice" >> $(DIST_DIR)/README.md
	@echo "mcp-scanner server --port 3000" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "# Get help" >> $(DIST_DIR)/README.md
	@echo "mcp-scanner --help" >> $(DIST_DIR)/README.md
	@echo "\`\`\`" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "## Build Information" >> $(DIST_DIR)/README.md
	@echo "" >> $(DIST_DIR)/README.md
	@echo "- **Version**: $(VERSION)" >> $(DIST_DIR)/README.md
	@echo "- **Rust Version**: $(RUST_VERSION)" >> $(DIST_DIR)/README.md
	@echo "- **Build Date**: $(shell date -u +"%Y-%m-%d %H:%M:%S UTC")" >> $(DIST_DIR)/README.md
	@echo "- **Author**: $(AUTHOR)" >> $(DIST_DIR)/README.md
	@echo "Creating SHA256 checksums..."
	@cd $(BIN_DIR) && sha256sum * > ../checksums.txt
	@echo "Packaging complete"

.PHONY: package-linux
package-linux: build-linux ## Create Linux distribution package
	@echo "Creating Linux distribution package..."
	@mkdir -p $(DIST_DIR)/packages
	@tar -czf $(DIST_DIR)/packages/mcp-scanner-$(VERSION)-linux.tar.gz -C $(BIN_DIR) \
		mcp-scanner-x86_64-unknown-linux-gnu \
		mcp-scanner-aarch64-unknown-linux-gnu \
		mcp-scanner-x86_64-unknown-linux-musl \
		mcp-scanner-aarch64-unknown-linux-musl
	@echo "Linux package created: $(DIST_DIR)/packages/mcp-scanner-$(VERSION)-linux.tar.gz"

.PHONY: package-macos
package-macos: build-macos ## Create macOS distribution package
	@echo "Creating macOS distribution package..."
	@mkdir -p $(DIST_DIR)/packages
	@tar -czf $(DIST_DIR)/packages/mcp-scanner-$(VERSION)-macos.tar.gz -C $(BIN_DIR) \
		mcp-scanner-x86_64-apple-darwin \
		mcp-scanner-aarch64-apple-darwin
	@echo "macOS package created: $(DIST_DIR)/packages/mcp-scanner-$(VERSION)-macos.tar.gz"

.PHONY: package-windows
package-windows: build-windows ## Create Windows distribution package
	@echo "Creating Windows distribution package..."
	@mkdir -p $(DIST_DIR)/packages
	@cd $(BIN_DIR) && zip -r ../packages/mcp-scanner-$(VERSION)-windows.zip \
		mcp-scanner-x86_64-pc-windows-gnu.exe \
		mcp-scanner-x86_64-pc-windows-msvc.exe \
		mcp-scanner-aarch64-pc-windows-msvc.exe
	@echo "Windows package created: $(DIST_DIR)/packages/mcp-scanner-$(VERSION)-windows.zip"

# ============================================================================
# DEVELOPMENT TARGETS
# ============================================================================

.PHONY: dev-setup
dev-setup: ## Setup development environment
	@echo "Setting up development environment..."
	@$(RUSTUP) update
	@$(RUSTUP) component add rustfmt clippy
	@echo "Development setup complete"

.PHONY: install-targets
install-targets: ## Install all target toolchains
	@echo "Installing target toolchains..."
	@for target in $(ALL_TARGETS); do \
		echo "Installing $$target..."; \
		$(RUSTUP) target add $$target; \
	done
	@echo "Target installation complete"

.PHONY: coverage
coverage: ## Run code coverage with tarpaulin (Linux only)
	@echo "Running code coverage (Linux only, requires cargo-tarpaulin)..."
	@which cargo-tarpaulin > /dev/null || cargo install cargo-tarpaulin
	@cargo tarpaulin --all-features --out Html --output-dir coverage
	@echo "Coverage report generated in coverage/"

.PHONY: integration-test
integration-test: ## Run integration tests (CLI, config, server startup)
	@echo "Running integration tests..."
	@cargo build --release
	@./target/release/$(PROJECT_NAME) --help
	@./target/release/$(PROJECT_NAME) init-config --force
	@timeout 5s ./target/release/$(PROJECT_NAME) server --port 3000 || true
	@echo "Integration tests complete"

.PHONY: ci-quality
ci-quality: fmt-check check lint test audit coverage integration-test ## Run all CI quality checks
	@echo "All CI quality checks complete"

.PHONY: verify
verify: check test clippy ## Run all verification steps
	@echo "All verification steps complete"

.PHONY: release
release: clean verify build-all package ## Create a complete release
	@echo "Release build complete"
	@echo "Distribution files available in: $(DIST_DIR)"

# ============================================================================
# UTILITY TARGETS
# ============================================================================

.PHONY: list-targets
list-targets: ## List all available targets
	@echo "Available targets:"
	@echo "  Linux:"
	@for target in $(LINUX_TARGETS); do \
		echo "    $$target"; \
	done
	@echo "  macOS:"
	@for target in $(MACOS_TARGETS); do \
		echo "    $$target"; \
	done
	@echo "  Windows:"
	@for target in $(WINDOWS_TARGETS); do \
		echo "    $$target"; \
	done

.PHONY: info
info: ## Show build information
	@echo "MCP Scanner Build Information"
	@echo "============================="
	@echo "Project: $(PROJECT_NAME)"
	@echo "Version: $(VERSION)"
	@echo "Author: $(AUTHOR)"
	@echo "Rust Version: $(RUST_VERSION)"
	@echo "Build Directory: $(BUILD_DIR)"
	@echo "Distribution Directory: $(DIST_DIR)"
	@echo ""
	@echo "Current System:"
	@echo "  OS: $(HOST_OS)"
	@echo "  Architecture: $(HOST_ARCH)"
	@echo "  Target: $(CURRENT_TARGET)"
	@echo ""
	@echo "Available targets: $(words $(ALL_TARGETS))"
	@echo "Linux targets: $(words $(LINUX_TARGETS))"
	@echo "macOS targets: $(words $(MACOS_TARGETS))"
	@echo "Windows targets: $(words $(WINDOWS_TARGETS))"

.PHONY: size
size: build-all ## Show binary sizes
	@echo "Binary sizes:"
	@for binary in $(BIN_DIR)/*; do \
		if [ -f "$$binary" ]; then \
			size=$$(stat -f%z "$$binary" 2>/dev/null || stat -c%s "$$binary" 2>/dev/null || echo "unknown"); \
			echo "  $$(basename $$binary): $$size bytes"; \
		fi; \
	done

# ============================================================================
# DOCKER SUPPORT
# ============================================================================

.PHONY: docker-build
docker-build: ## Build using Docker (requires Dockerfile)
	@if [ -f Dockerfile ]; then \
		echo "Building with Docker..."; \
		docker build -t $(PROJECT_NAME):$(VERSION) .; \
		echo "Docker build complete"; \
	else \
		echo "Dockerfile not found. Creating basic Dockerfile..."; \
		echo "FROM rust:1.75 as builder" > Dockerfile; \
		echo "WORKDIR /app" >> Dockerfile; \
		echo "COPY . ." >> Dockerfile; \
		echo "RUN cargo build --release" >> Dockerfile; \
		echo "" >> Dockerfile; \
		echo "FROM debian:bookworm-slim" >> Dockerfile; \
		echo "RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*" >> Dockerfile; \
		echo "COPY --from=builder /app/target/release/mcp-scanner /usr/local/bin/" >> Dockerfile; \
		echo "EXPOSE 3000" >> Dockerfile; \
		echo "CMD [\"mcp-scanner\", \"server\"]" >> Dockerfile; \
		echo "Dockerfile created. Run 'make docker-build' again."; \
	fi

.PHONY: docker-run
docker-run: ## Run with Docker
	@echo "Running with Docker..."
	@docker run -p 3000:3000 $(PROJECT_NAME):$(VERSION) server --port 3000

# ============================================================================
# CI/CD SUPPORT
# ============================================================================

.PHONY: ci-build
ci-build: ## CI/CD build target
	@echo "Running CI build..."
	@$(MAKE) clean
	@$(MAKE) verify
	@$(MAKE) build-all
	@$(MAKE) package
	@echo "CI build complete"

.PHONY: ci-test
ci-test: ## CI/CD test target
	@echo "Running CI tests..."
	@$(MAKE) check
	@$(MAKE) test
	@$(MAKE) lint
	@echo "CI tests complete"

# ============================================================================
# CLEANUP
# ============================================================================

.PHONY: distclean
distclean: clean ## Deep clean including distribution files
	@echo "Performing deep clean..."
	@rm -rf $(DIST_DIR)
	@rm -rf target
	@echo "Deep clean complete"

.PHONY: help-targets
help-targets: ## Show help for specific target builds
	@echo "Target-specific build commands:"
	@echo ""
	@echo "Current Architecture (Auto-detected):"
	@echo "  make build                    # Build for current architecture"
	@echo ""
	@echo "Linux:"
	@echo "  make build-linux-x86_64      # Linux x86_64 (GNU)"
	@echo "  make build-linux-aarch64     # Linux ARM64 (GNU)"
	@echo "  make build-linux-x86_64-musl # Linux x86_64 (musl)"
	@echo "  make build-linux-aarch64-musl# Linux ARM64 (musl)"
	@echo "  make build-linux             # All Linux targets"
	@echo ""
	@echo "macOS:"
	@echo "  make build-macos-x86_64      # macOS x86_64"
	@echo "  make build-macos-aarch64     # macOS ARM64"
	@echo "  make build-macos             # All macOS targets"
	@echo ""
	@echo "Windows:"
	@echo "  make build-windows-x86_64-gnu # Windows x86_64 (GNU)"
	@echo "  make build-windows-x86_64-msvc# Windows x86_64 (MSVC)"
	@echo "  make build-windows-aarch64-msvc# Windows ARM64 (MSVC)"
	@echo "  make build-windows           # All Windows targets"
	@echo ""
	@echo "Packaging:"
	@echo "  make package-linux           # Linux distribution package"
	@echo "  make package-macos           # macOS distribution package"
	@echo "  make package-windows         # Windows distribution package"
	@echo "  make package                 # All packages"