summaryrefslogtreecommitdiff
path: root/internal/mcp
AgeCommit message (Collapse)Author
45 hoursv0.41.1v0.41.1mainPaul Buetow
2026-03-23chore: bump version to v0.25.9v0.25.9Paul Buetow
Code quality fixes from audit: - Log silently discarded errors in status sinks and stats.Update call sites - Fix json.Marshal errors silently ignored in LSP handlers - Replace time.Sleep in tests with channel signaling (mcp) and fake clock (stats) - Make context cancellation work in production time.Sleep sites (handlers_document, cmdentry) - Remove init()-based provider registration from llm package; use explicit RegisterAllProviders() - Add WaitGroup goroutine tracking to MCP server Run() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16Replace Summary: prefixes with standard Go package doc commentsPaul Buetow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16Split mcp/server.go (962L) into server, handlers_prompt, handlers_toolPaul Buetow
server.go (223L): core lifecycle and routing handlers_prompt.go (420L): prompt CRUD handlers handlers_tool.go (335L): tool handlers and schema builders Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16Refactor oversized functions and split large test filesPaul Buetow
Split DefaultPrompts (201L), loadFromFile (83L), and Update (74L) into focused helper functions under 50 lines each. Split handlers_test.go (1650L) and config_test.go (1419L) into logical sub-files under 1000L. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02io: use errors.Is for EOF checks in lsp and mcp servers (task 409)Paul Buetow
2026-03-02mcp: depend on SlashCommandSyncer interface instead of concrete type (task 410)Paul Buetow
2026-02-12feat: add automatic MCP prompt to slash command syncingPaul Buetow
Adds optional syncing of MCP prompts to Markdown slash command files for AI agents that don't yet support MCP prompts (e.g., Cursor IDE). Features: - Syncs prompts on create/update/delete operations - Configurable via TOML config, environment vars, or CLI flags - Backfill support with --sync-all flag - Thread-safe atomic file writes - Non-fatal sync failures (logged but don't break operations) - Comprehensive test coverage (81.1% total) Configuration: - Config: [mcp] slashcommand_sync = true, slashcommand_dir = "~/.cursor/commands" - Env: HEXAI_MCP_SLASHCOMMAND_SYNC, HEXAI_MCP_SLASHCOMMAND_DIR - CLI: --slashcommand-sync, --slashcommand-dir, --sync-all Fixes config merging bug where project config would reset global MCP settings. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11feat: add MCP Tools support for prompt managementPaul Buetow
Implements tools/list and tools/call endpoints to expose prompt management operations (create, update, delete) as callable MCP tools. This enables Claude to use the meta-prompts (save_prompt, update_prompt) to actually create and modify prompts. Key changes: - Add Tool type definitions (Tool, ListToolsRequest, CallToolRequest, etc.) - Implement handleToolsList() returning 3 tools with JSON Schemas - Implement handleToolsCall() with tool wrappers for create/update/delete - Add 17 comprehensive unit tests (82.8% coverage maintained) - Update meta-prompts to reference tools instead of JSON-RPC methods - Enable listChanged notifications for immediate prompt availability - Refactor large functions into helpers to stay under 50-line limit Tools advertised alongside Prompts capability. All functions under 50 lines. Backward compatible - existing prompts/* JSON-RPC methods unchanged. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11Fix MCP protocol version negotiation and null prompts arrayPaul Buetow
Two issues prevented Claude Code CLI from discovering MCP prompts: 1. Protocol version mismatch: Server always returned "2025-06-18" but Claude Code sends "2025-11-25". Per MCP spec, server must echo back the client's version if supported. Now supports all known versions (2024-11-05 through 2025-11-25). 2. Null prompts array: Go nil slices marshal as JSON null, but Claude Code expects an empty array []. Initialize prompts slice with make() to ensure [] in JSON output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11Fix MCP transport to use JSONL instead of Content-Length framingPaul Buetow
The MCP stdio protocol uses newline-delimited JSON (JSONL), not LSP-style Content-Length headers. This was discovered during integration testing with Claude Code CLI which could not connect to the server. Also updates docs/mcp-setup.md with correct Claude Code CLI configuration (use `claude mcp add` instead of editing JSON files) and adds integration test runbook for testing against real Claude Code CLI instances. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10Refactor MCP server to meet project standards and remove built-in promptsPaul Buetow
Ensures all code complies with AGENTS.md standards: - Refactored functions to be under 50 lines each - Removed built-in prompts - all prompts now served from database only - Split handlePromptsCreate (72→37 lines) with helper functions - Split handlePromptsUpdate (76→44 lines) with helper function - Deleted internal/promptstore/builtin.go (no longer needed) - Updated tests to create prompts dynamically instead of relying on built-ins All tests pass with 81.5% coverage maintained. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-10Add MCP server implementation with comprehensive test coveragePaul Buetow
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>