From f3a2bfd5a334c3816d28039856af6ac4e056384a Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Mon, 6 Apr 2026 11:14:10 +0100 Subject: [PATCH] Start working on mcp-feature --- todo/{queued => doing}/mcp-feature.md | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) rename todo/{queued => doing}/mcp-feature.md (63%) diff --git a/todo/queued/mcp-feature.md b/todo/doing/mcp-feature.md similarity index 63% rename from todo/queued/mcp-feature.md rename to todo/doing/mcp-feature.md index b7a6b87..87564ef 100644 --- a/todo/queued/mcp-feature.md +++ b/todo/doing/mcp-feature.md @@ -85,3 +85,53 @@ Each tool handler: | Tests | `grokkit testgen` | Claude generates + validates tests | | Recipes | `grokkit recipe` | Claude orchestrates multi-step workflows | | Analysis | `grokkit analyze` | Claude gets language-aware code analysis | +## Work Plan + +1. **Evaluate and add MCP SDK** + - Research Go MCP SDKs (`github.com/mark3labs/mcp-go` or equivalent). + - Add to `go.mod`, run `go mod tidy`. + - Commit: `feat(mcp): add MCP SDK dependency`. + +2. **Implement MCP server foundation** (`internal/mcp`) + - Create `internal/mcp/server.go`: Initialize stdio server, register tools/resources. + - Inject real `AIClient` and `GitRunner` impls. + - Use `StreamSilent` for non-streaming results. + - Commit: `feat(mcp): add MCP server foundation`. + +3. **Add `cmd/mcp.go`** + - Cobra command `grokkit mcp` to start stdio server. + - Add config flags: `--tools`, `--resources` (comma-separated). + - Blocks until EOF. + - Test: Manual `grokkit mcp` + simple MCP client. + - Commit: `feat(mcp): add grokkit mcp CLI command`. + +4. **Extract reusable functions from existing commands** + - `lint_code`: Extract from `cmd/lint.go` → `internal/linter.RunLint(path) string`. + - `generate_commit_msg`: Extract from `cmd/commit.go` → `internal/git.GenerateCommitMsg() string`. + - Commit per extraction: `refactor(lint): extract reusable lint function`. + +5. **Implement Phase 2 tools** (priority order, 1 commit per 2 tools) + - Register each as MCP tool in `server.go`. + - `lint_code`, `analyze_code`. + - `generate_docs`, `generate_tests`. + - `generate_commit_msg`, `run_recipe`. + - Table-driven unit tests with mocked `AIClient`/`GitRunner`. + - Commit: `feat(mcp): add lint_code and analyze_code tools`. + +6. **Implement Phase 3 resources** + - `recipes://local`, `recipes://global`, `prompts://language`. + - List directories and contents as MCP resources. + - Unit tests for path resolution and listing. + - Commit: `feat(mcp): add recipe and prompt resources`. + +7. **Add config flags and validation** + - Support `mcp.enabled`, `mcp.tools`, `mcp.resources` in config. + - Validate tool/resource lists on startup. + - Integration test: Full `grokkit mcp` run with subset tools. + - Commit: `feat(mcp): add config flags and validation`. + +8. **End-to-end testing and docs** + - Test with Claude Code or MCP client simulator. + - Add `README.md` section: "MCP Server Mode". + - Smoke test all tools/resources. + - Final commit: `feat(mcp): complete MCP server + docs/tests`. \ No newline at end of file