From 5551695f3b0d10c9a22cfacdb10c2cf7bd572421 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 10 Feb 2026 19:28:27 +0200 Subject: Add MCP server implementation with comprehensive test coverage Implements a full Model Context Protocol (MCP) server for managing and serving prompts to LLM applications. The server provides CRUD operations for prompts with automatic backups and template rendering support. Key additions: - cmd/hexai-mcp-server: Main MCP server binary entrypoint - internal/hexaimcp: Server orchestrator with configuration and setup - internal/mcp: Core MCP protocol implementation (JSON-RPC 2.0) - internal/promptstore: Prompt storage with JSONL backend and automatic backups - Comprehensive test suites achieving 80%+ coverage for all MCP packages - Magefile targets for building and installing the MCP server - Complete documentation for setup, API, prompts, and backups Test coverage: - internal/hexaimcp: 84.3% - internal/mcp: 80.3% - internal/promptstore: 81.2% - Overall project: 81.5% Co-Authored-By: Claude Sonnet 4.5 --- Magefile.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'Magefile.go') diff --git a/Magefile.go b/Magefile.go index fb43238..f0ce2f0 100644 --- a/Magefile.go +++ b/Magefile.go @@ -24,7 +24,7 @@ var ( // Build builds binaries. func Build() error { - mg.Deps(BuildHexaiLSP, BuildHexaiCLI, BuildHexaiTmuxAction, BuildHexaiTmuxEdit) + mg.Deps(BuildHexaiLSP, BuildHexaiCLI, BuildHexaiTmuxAction, BuildHexaiTmuxEdit, BuildHexaiMCPServer) printCoverage() return nil } @@ -53,7 +53,13 @@ func BuildHexaiTmuxEdit() error { return sh.RunV("go", "build", "-o", "hexai-tmux-edit", "cmd/hexai-tmux-edit/main.go") } -// Dev runs tests, vet, lint, then builds with race for both binaries. +// BuildHexaiMCPServer builds the MCP server binary. +func BuildHexaiMCPServer() error { + printCoverage() + return sh.RunV("go", "build", "-o", "hexai-mcp-server", "cmd/hexai-mcp-server/main.go") +} + +// Dev runs tests, vet, lint, then builds with race for all binaries. func Dev() error { printCoverage() mg.Deps(Test, Vet, Lint) @@ -66,7 +72,10 @@ func Dev() error { if err := sh.RunV("go", "build", "-race", "-o", "hexai-tmux-action", "cmd/hexai-tmux-action/main.go"); err != nil { return err } - return sh.RunV("go", "build", "-race", "-o", "hexai-tmux-edit", "cmd/hexai-tmux-edit/main.go") + if err := sh.RunV("go", "build", "-race", "-o", "hexai-tmux-edit", "cmd/hexai-tmux-edit/main.go"); err != nil { + return err + } + return sh.RunV("go", "build", "-race", "-o", "hexai-mcp-server", "cmd/hexai-mcp-server/main.go") } // Run launches the LSP server via go run (useful during development). @@ -109,7 +118,10 @@ func Install() error { if err := sh.RunV("cp", "-v", "./hexai-tmux-action", bin+"/"); err != nil { return err } - return sh.RunV("cp", "-v", "./hexai-tmux-edit", bin+"/") + if err := sh.RunV("cp", "-v", "./hexai-tmux-edit", bin+"/"); err != nil { + return err + } + return sh.RunV("cp", "-v", "./hexai-mcp-server", bin+"/") } // RunTmuxAction runs the hexai-tmux-action TUI via go run (reads stdin). -- cgit v1.2.3