# Ghost MCP Development Makefile .PHONY: help install install-uv start-ghost stop-ghost setup-tokens test test-connection run dev clean logs status check-deps # Default target help: ## Show this help message @echo "Ghost MCP Development Commands" @echo "=============================" @echo "" @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' @echo "" @echo "Quick start:" @echo " make install-uv # Install uv package manager (if not installed)" @echo " make install # Install Python dependencies" @echo " make start-ghost # Start Ghost and database containers" @echo " make setup-tokens # Extract API keys and create .env file" @echo " make test # Test the implementation" @echo " make run # Run the MCP server" # Python environment setup install-uv: ## Install uv package manager @echo "๐Ÿ“ฆ Installing uv package manager..." @if command -v uv >/dev/null 2>&1; then \ echo "โœ… uv is already installed"; \ uv --version; \ else \ echo "Installing uv..."; \ curl -LsSf https://astral.sh/uv/install.sh | sh; \ echo "โœ… uv installed successfully"; \ fi install: ## Install Python dependencies using uv @echo "๐Ÿ“ฆ Installing Python dependencies with uv..." @if ! command -v uv >/dev/null 2>&1; then \ echo "โŒ uv not found. Run 'make install-uv' first"; \ exit 1; \ fi uv sync @echo "โœ… Dependencies installed successfully" install-pip: ## Install Python dependencies using pip (fallback) @echo "๐Ÿ“ฆ Installing Python dependencies with pip..." python -m pip install -e . @echo "โœ… Dependencies installed successfully" # Docker environment start-ghost: ## Start Ghost and database containers @echo "๐Ÿณ Starting Ghost development environment..." docker-compose up -d @echo "โณ Waiting for containers to be healthy..." @timeout=60; \ while [ $$timeout -gt 0 ]; do \ if docker-compose ps | grep -q "ghost-mcp-dev.*Up" && docker-compose ps | grep -q "ghost-db-dev.*Up.*healthy"; then \ echo "โœ… Ghost containers are running and healthy"; \ break; \ fi; \ echo " Waiting for containers... ($$timeout seconds remaining)"; \ sleep 2; \ timeout=$$((timeout - 2)); \ done; \ if [ $$timeout -le 0 ]; then \ echo "โŒ Containers did not start properly"; \ make logs; \ exit 1; \ fi @echo "" @echo "๐ŸŽ‰ Ghost is ready!" @echo " Ghost admin: http://localhost:2368/ghost/" @echo " Ghost site: http://localhost:2368/" @echo " Database: Available on port 3306" stop-ghost: ## Stop Ghost and database containers @echo "๐Ÿ›‘ Stopping Ghost development environment..." docker-compose down @echo "โœ… Ghost containers stopped" restart-ghost: ## Restart Ghost and database containers @echo "๐Ÿ”„ Restarting Ghost development environment..." docker-compose restart @echo "โœ… Ghost containers restarted" # API token setup setup-tokens: ## Extract API keys from Ghost database and create .env file @echo "๐Ÿ”‘ Setting up API tokens..." ./scripts/setup-tokens.sh # Testing test-connection: ## Test Ghost API connectivity @if [ ! -f .env ]; then \ echo "โŒ .env file not found. Run 'make setup-tokens' first"; \ exit 1; \ fi @python scripts/test-connection.py test: check-deps test-connection ## Run all tests @echo "๐Ÿงช Running comprehensive tests..." @echo "Testing MCP tools registration..." @python -c "\ import sys; \ sys.path.insert(0, 'src'); \ from ghost_mcp.server import mcp; \ print(f'โœ… FastMCP server initialized'); \ print(f' Tools registered: {len([attr for attr in dir(mcp) if not attr.startswith(\"_\")])}+')" @echo "โœ… All tests passed!" # Running the server run: check-deps ## Run the Ghost MCP server @echo "๐Ÿš€ Starting Ghost MCP server..." @if [ ! -f .env ]; then \ echo "โŒ .env file not found. Run 'make setup-tokens' first"; \ exit 1; \ fi python -m ghost_mcp.server dev: check-deps ## Run the Ghost MCP server in development mode with auto-reload @echo "๐Ÿš€ Starting Ghost MCP server in development mode..." @if [ ! -f .env ]; then \ echo "โŒ .env file not found. Run 'make setup-tokens' first"; \ exit 1; \ fi python -m ghost_mcp.server --dev # Utilities logs: ## Show Docker container logs @echo "๐Ÿ“‹ Showing container logs..." docker-compose logs -f status: ## Show status of all components @echo "๐Ÿ“Š Ghost MCP Status" @echo "==================" @echo "" @echo "๐Ÿณ Docker Containers:" @docker-compose ps || echo " No containers running" @echo "" @echo "๐Ÿ“ Configuration:" @if [ -f .env ]; then \ echo " โœ… .env file exists"; \ echo " ๐Ÿ“ Ghost URL: $$(grep GHOST_URL .env | cut -d= -f2)"; \ echo " ๐Ÿ”‘ Content API: $$(grep GHOST_CONTENT_API_KEY .env | cut -d= -f2 | cut -c1-10)..."; \ echo " ๐Ÿ”‘ Admin API: $$(grep GHOST_ADMIN_API_KEY .env | cut -d= -f2 | cut -c1-10)..."; \ else \ echo " โŒ .env file missing"; \ fi @echo "" @echo "๐Ÿ Python Environment:" @if command -v uv >/dev/null 2>&1; then \ echo " โœ… uv: $$(uv --version)"; \ else \ echo " โŒ uv not installed"; \ fi @echo " ๐Ÿ Python: $$(python --version)" @if python -c "import ghost_mcp" 2>/dev/null; then \ echo " โœ… ghost_mcp package installed"; \ else \ echo " โŒ ghost_mcp package not installed"; \ fi check-deps: ## Check if all dependencies are available @if [ ! -f .env ]; then \ echo "โŒ .env file not found. Run 'make setup-tokens' first"; \ exit 1; \ fi @if ! python -c "import ghost_mcp" 2>/dev/null; then \ echo "โŒ ghost_mcp package not installed. Run 'make install' first"; \ exit 1; \ fi clean: ## Clean up development environment @echo "๐Ÿงน Cleaning up development environment..." docker-compose down -v rm -f .env @if command -v uv >/dev/null 2>&1; then \ uv clean; \ fi @echo "โœ… Cleanup complete" # Development workflow setup: install-uv install start-ghost setup-tokens ## Complete setup from scratch @echo "" @echo "๐ŸŽ‰ Ghost MCP setup complete!" @echo "" @echo "Ready to use:" @echo " make test # Test the implementation" @echo " make run # Run the MCP server" @echo " make status # Check system status" # Documentation docs: ## Show important URLs and information @echo "๐Ÿ“š Ghost MCP Documentation" @echo "=========================" @echo "" @echo "๐ŸŒ Web Interfaces:" @echo " Ghost Admin: http://localhost:2368/ghost/" @echo " Ghost Site: http://localhost:2368/" @echo " phpMyAdmin: http://localhost:8080/ (if enabled)" @echo "" @echo "๐Ÿ“ Important Files:" @echo " Configuration: .env" @echo " Project: pyproject.toml" @echo " Docker: docker-compose.yml" @echo " Setup Script: scripts/setup-tokens.sh" @echo "" @echo "๐Ÿ”ง Development Commands:" @echo " make setup # Complete initial setup" @echo " make test # Test functionality" @echo " make run # Run MCP server" @echo " make logs # View container logs" @echo " make status # Check system status"