grokkit/docs/user-guide/mcp.md

62 lines
2.0 KiB
Markdown
Raw Normal View History

# MCP Server Mode (`grokkit mcp`)
Grokkit can run as an **MCP (Model Context Protocol)** server, allowing AI coding agents like **Claude Code**, Cursor, or other MCP-compatible clients to call Grokkit tools directly during their workflows.
## What is MCP?
MCP is a protocol that lets LLMs call external tools and access resources in a standardized way. By running `grokkit mcp`, you turn Grokkit into a service that other AI tools can use.
## Starting the MCP Server
```bash
grokkit mcp
```
This starts the server over **stdio** (standard input/output), which is the default transport used by Claude Code and most MCP clients.
The server will run until the client disconnects.
## Available Tools
When running in MCP mode, the following tools are available:
- **`lint_code`** — Run linter on a file and return results
- **`analyze_code`** — Deep project analysis with educational report
- **`generate_docs`** — Generate documentation comments for a source file
- **`generate_tests`** — Generate unit tests for supported languages
- **`generate_commit_msg`** — Generate conventional commit message from staged changes
- **`run_recipe`** — Execute a named recipe from `.grokkit/recipes/`
## Configuration
You can control MCP behavior in your config file (`~/.config/grokkit/config.toml` or `./config.toml`):
```toml
[mcp]
enabled = true
tools = ["lint_code", "analyze_code", "generate_docs"]
resources = ["recipes://local", "prompts://language"]
```
## Example Usage with Claude Code
Once `grokkit mcp` is running, you can tell Claude Code:
> "Use the grokkit MCP server to lint this file and then generate tests for it."
Claude can then call the tools directly.
## Resources
MCP also exposes resources:
- `recipes://local` — List of local recipes
- `recipes://global` — List of global recipes
- `prompts://language` — Available language prompts
---
**See also:**
- [Developer Guide](../developer-guide/mcp.md) for technical details
- [Main README](../../README.md) for installation