feature/mcp-feature #10

Merged
gmgauthier merged 3 commits from feature/mcp-feature into master 2026-04-06 17:03:52 +00:00
Showing only changes of commit f3a2bfd5a3 - Show all commits

View File

@ -85,3 +85,53 @@ Each tool handler:
| Tests | `grokkit testgen` | Claude generates + validates tests | | Tests | `grokkit testgen` | Claude generates + validates tests |
| Recipes | `grokkit recipe` | Claude orchestrates multi-step workflows | | Recipes | `grokkit recipe` | Claude orchestrates multi-step workflows |
| Analysis | `grokkit analyze` | Claude gets language-aware code analysis | | 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`.