**Description**: Add an MCP (Model Context Protocol) server mode to grokkit, exposing its capabilities as tools and resources for Claude Code and other MCP-compatible clients.
## Problem It Solves
Grokkit's AI-powered code operations (linting, docs, test generation, analysis) are locked behind the CLI. MCP integration lets external AI clients invoke them programmatically, composing grokkit's strengths with broader workflows.
## Benefits
- **Composability**: Claude Code (or any MCP client) can call grokkit tools mid-conversation.
- **No core changes**: New `grokkit mcp` command wraps existing functionality via interfaces.
- **Stdio transport**: No HTTP server to manage — Claude Code pipes stdio directly.
- **Recipes as resources**: MCP clients can browse and invoke workflow recipes.
- **Leverages existing architecture**: `AIClient` and `GitRunner` interfaces already support dependency injection.
## Architecture Notes
Grokkit is well-suited for this:
- **Interface-based design**: `AIClient` and `GitRunner` are already abstractions — inject real implementations into MCP tool handlers.
- **Clean package separation**: Each internal package (grok, git, linter, recipe, prompts) maps naturally to an MCP tool.
- **Cobra command tree**: Adding `cmd/mcp.go` is trivial.
- **Streaming caveat**: MCP tools return complete results, so use `StreamSilent` (captures without printing) rather than `Stream`.
- **File-writing tools** (`edit`, `workon`): Need careful scoping so the MCP client understands what changed.
## High-Level Implementation
### Phase 1: Foundation
1.**Add MCP Go SDK** (e.g., `github.com/mark3labs/mcp-go`) to `go.mod`.
2.**Create `internal/mcp/server.go`** — MCP server that registers tools and resources.
3.**Create `cmd/mcp.go`** — `grokkit mcp` command that starts the stdio server.
### Phase 2: Tools
Wrap existing functionality as MCP tools. Priority order: