Some checks are pending
Build Ghidra Plugin / build (push) Waiting to run
- Add ghydramcp Python package with FastMCP server implementation - Add docker-compose.yml for easy container management - Add Makefile with build/run targets - Add QUICKSTART.md for getting started - Add uv.lock for reproducible dependencies
172 lines
5.2 KiB
Makefile
172 lines
5.2 KiB
Makefile
# GhydraMCP Makefile
|
|
# Convenient commands for Docker and development operations
|
|
|
|
.PHONY: help build build-dev up up-dev down down-dev logs logs-dev \
|
|
shell status clean analyze test health
|
|
|
|
# Default target
|
|
help:
|
|
@echo "GhydraMCP Docker Management"
|
|
@echo "============================"
|
|
@echo ""
|
|
@echo "Build commands:"
|
|
@echo " make build Build production Docker image"
|
|
@echo " make build-dev Build development Docker image"
|
|
@echo " make build-all Build both images"
|
|
@echo ""
|
|
@echo "Run commands:"
|
|
@echo " make up Start production container"
|
|
@echo " make up-dev Start development container"
|
|
@echo " make down Stop production container"
|
|
@echo " make down-dev Stop development container"
|
|
@echo " make down-all Stop all containers"
|
|
@echo ""
|
|
@echo "Analysis commands:"
|
|
@echo " make analyze FILE=path/to/binary Analyze a binary"
|
|
@echo " make analyze-bg FILE=path/to/binary Analyze in background"
|
|
@echo ""
|
|
@echo "Utility commands:"
|
|
@echo " make shell Start interactive shell in container"
|
|
@echo " make logs View production container logs"
|
|
@echo " make logs-dev View development container logs"
|
|
@echo " make status Check container status"
|
|
@echo " make health Check API health"
|
|
@echo " make clean Remove containers and volumes"
|
|
@echo " make clean-all Remove everything including images"
|
|
@echo ""
|
|
@echo "MCP Server commands:"
|
|
@echo " make mcp Start the MCP server (Python)"
|
|
@echo " make mcp-dev Start MCP server in development mode"
|
|
@echo ""
|
|
|
|
# =============================================================================
|
|
# Build Commands
|
|
# =============================================================================
|
|
|
|
build:
|
|
docker compose build ghydramcp
|
|
|
|
build-dev:
|
|
docker compose build ghydramcp-dev
|
|
|
|
build-all: build build-dev
|
|
|
|
# =============================================================================
|
|
# Run Commands
|
|
# =============================================================================
|
|
|
|
up:
|
|
docker compose --profile prod up -d ghydramcp
|
|
@echo "GhydraMCP starting... checking health in 30 seconds"
|
|
@sleep 30
|
|
@$(MAKE) health || echo "Server may still be starting up..."
|
|
|
|
up-dev:
|
|
docker compose --profile dev up -d ghydramcp-dev
|
|
@echo "GhydraMCP (dev) starting..."
|
|
|
|
down:
|
|
docker compose --profile prod down
|
|
|
|
down-dev:
|
|
docker compose --profile dev down
|
|
|
|
down-all:
|
|
docker compose --profile prod --profile dev --profile debug down
|
|
|
|
restart: down up
|
|
|
|
restart-dev: down-dev up-dev
|
|
|
|
# =============================================================================
|
|
# Analysis Commands
|
|
# =============================================================================
|
|
|
|
# Analyze a binary file
|
|
# Usage: make analyze FILE=/path/to/binary
|
|
analyze:
|
|
ifndef FILE
|
|
@echo "Error: FILE is required. Usage: make analyze FILE=/path/to/binary"
|
|
@exit 1
|
|
endif
|
|
@echo "Analyzing: $(FILE)"
|
|
docker compose run --rm -v "$(dir $(FILE)):/binaries:ro" ghydramcp /binaries/$(notdir $(FILE))
|
|
|
|
# Analyze in background (detached)
|
|
analyze-bg:
|
|
ifndef FILE
|
|
@echo "Error: FILE is required. Usage: make analyze-bg FILE=/path/to/binary"
|
|
@exit 1
|
|
endif
|
|
@echo "Starting background analysis of: $(FILE)"
|
|
docker compose run -d -v "$(dir $(FILE)):/binaries:ro" ghydramcp /binaries/$(notdir $(FILE))
|
|
|
|
# =============================================================================
|
|
# Utility Commands
|
|
# =============================================================================
|
|
|
|
shell:
|
|
docker compose --profile debug run --rm ghydramcp-shell
|
|
|
|
logs:
|
|
docker compose logs -f ghydramcp
|
|
|
|
logs-dev:
|
|
docker compose logs -f ghydramcp-dev
|
|
|
|
status:
|
|
@echo "=== Container Status ==="
|
|
@docker compose ps -a
|
|
@echo ""
|
|
@echo "=== Resource Usage ==="
|
|
@docker stats --no-stream $$(docker compose ps -q 2>/dev/null) 2>/dev/null || echo "No containers running"
|
|
|
|
health:
|
|
@echo "Checking GhydraMCP API health..."
|
|
@curl -sf http://localhost:$${GHYDRA_PORT:-8192}/ | python3 -m json.tool 2>/dev/null \
|
|
|| echo "API not responding (server may be starting or binary being analyzed)"
|
|
|
|
# =============================================================================
|
|
# Cleanup Commands
|
|
# =============================================================================
|
|
|
|
clean:
|
|
docker compose --profile prod --profile dev --profile debug down -v
|
|
@echo "Containers and volumes removed"
|
|
|
|
clean-all: clean
|
|
docker rmi ghydramcp:latest ghydramcp:dev 2>/dev/null || true
|
|
@echo "Images removed"
|
|
|
|
prune:
|
|
docker system prune -f
|
|
@echo "Docker system pruned"
|
|
|
|
# =============================================================================
|
|
# MCP Server Commands
|
|
# =============================================================================
|
|
|
|
mcp:
|
|
uv run python -m ghydramcp
|
|
|
|
mcp-dev:
|
|
uv run python -m ghydramcp --verbose
|
|
|
|
# =============================================================================
|
|
# Development Commands
|
|
# =============================================================================
|
|
|
|
test:
|
|
uv run pytest tests/ -v
|
|
|
|
lint:
|
|
uv run ruff check src/
|
|
|
|
format:
|
|
uv run ruff format src/
|
|
|
|
# Check if binaries directory exists
|
|
check-binaries:
|
|
@mkdir -p binaries
|
|
@echo "Binaries directory ready at ./binaries/"
|