diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-10 19:28:27 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-10 19:28:27 +0200 |
| commit | 5551695f3b0d10c9a22cfacdb10c2cf7bd572421 (patch) | |
| tree | 282611eacf1fd4c38d54d5cea87decdf2b1cbdb7 /internal/appconfig | |
| parent | ec745129258ae800065e302a2a40b54488cbca08 (diff) | |
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 <noreply@anthropic.com>
Diffstat (limited to 'internal/appconfig')
| -rw-r--r-- | internal/appconfig/config.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/appconfig/config.go b/internal/appconfig/config.go index f8c1827..859b2c1 100644 --- a/internal/appconfig/config.go +++ b/internal/appconfig/config.go @@ -124,6 +124,9 @@ type App struct { TmuxEditPopupHeight string `json:"-" toml:"-"` TmuxEditDefaultAgent string `json:"-" toml:"-"` TmuxEditAgents []TmuxEditAgentCfg `json:"-" toml:"-"` + + // MCP: Model Context Protocol server settings + MCPPromptsDir string `json:"-" toml:"-"` // Directory for prompt storage } // CustomAction describes a user-defined code action. @@ -303,6 +306,7 @@ type fileConfig struct { Stats sectionStats `toml:"stats"` Ignore sectionIgnore `toml:"ignore"` TmuxEdit sectionTmuxEdit `toml:"tmux_edit"` + MCP sectionMCP `toml:"mcp"` } type sectionGeneral struct { @@ -377,6 +381,11 @@ type sectionTmuxEditAgent struct { SubmitKeys string `toml:"submit_keys"` } +// sectionMCP configures the MCP server settings. +type sectionMCP struct { + PromptsDir string `toml:"prompts_dir"` +} + type sectionOpenAI struct { Model string `toml:"model"` BaseURL string `toml:"base_url"` @@ -706,6 +715,11 @@ func (fc *fileConfig) toApp() App { // tmux_edit fc.applyTmuxEdit(&out) + // mcp + if strings.TrimSpace(fc.MCP.PromptsDir) != "" { + out.MCPPromptsDir = strings.TrimSpace(fc.MCP.PromptsDir) + } + return out } @@ -1580,6 +1594,12 @@ func loadFromEnv(logger *log.Logger) *App { any = true } + // MCP settings + if s := getenv("HEXAI_MCP_PROMPTS_DIR"); s != "" { + out.MCPPromptsDir = s + any = true + } + if !any { return nil } |
