MCP Setup
GitKB exposes 134 MCP tools (110 core via git-kb mcp, 21 code intelligence via git-kb code mcp, and 3 semantic search via git-kb semantic mcp) for documents, workspaces, sync, code intelligence, and project context. The MCP Tools Reference lists them by category.
How it works
Your client launches git-kb mcp as a local stdio server. MCP initialization and tool discovery can complete before the daemon is running. A tool operation connects to the per-KB daemon and starts it when needed.
Run the client in your project directory so GitKB discovers its .kb/. If the client launches servers elsewhere, configure GITKB_ROOT with the absolute project path.
Claude Code
The Claude scaffold writes the root .mcp.json for you:
git-kb init claudeFor manual setup, add the server to .mcp.json:
{
"mcpServers": {
"gitkb": {
"command": "git-kb",
"args": ["mcp"]
}
}
}Codex
Register the local server:
codex mcp add gitkb -- git-kb mcp
codex mcp listYou can also configure it in Codex’s config.toml:
[mcp_servers.gitkb]
command = "git-kb"
args = ["mcp"]
[mcp_servers.gitkb.env]
GITKB_ROOT = "/absolute/path/to/your-project"The explicit root is useful when the server’s working directory differs from the project. Codex supports user and trusted project configuration; see the official OpenAI MCP documentation.
For GitKB workflow skills and project instructions, also run git-kb init codex. The optional hook bundle has its own MCP entry; see Codex before combining installation methods.
Other clients
The same stdio command works with MCP clients that can launch local processes:
| Client | GitKB scaffold | MCP configuration |
|---|---|---|
| Cursor | git-kb init cursor | .cursor/mcp.json |
| Windsurf | git-kb init windsurf | Use the global MCP settings described by the scaffold |
| OpenCode | git-kb init opencode | opencode.json |
| oh-my-pi | git-kb init oh-my-pi | .omp/mcp.json |
| Grok Build | git-kb init grok | .grok/config.toml |
| Cline and other clients | Manual | Add command git-kb with arguments ["mcp"] in the client’s MCP settings |
Use git-kb init <harness> --help for its options, and --dry-run to preview generated files. Harnesses differ in whether they use project or global MCP configuration; the harness reference covers the supported integrations.
For JSON clients that accept the mcpServers format, the server entry can include an explicit root:
{
"mcpServers": {
"gitkb": {
"command": "git-kb",
"args": ["mcp"],
"env": {
"GITKB_ROOT": "/absolute/path/to/your-project"
}
}
}
}Verify an operation
Restart or reconnect the client after changing configuration. Ask:
“Use GitKB to list the documents in this project’s knowledge base.”
The assistant should call kb_list. Confirm that the returned documents belong to the intended project. Tool discovery alone verifies the stdio connection; a successful KB operation also exercises the daemon path.
MCP writes follow the workspace-first model. Creating or updating a document normally leaves pending edits; use kb_status, kb_diff, and a scoped kb_commit to record them. Some tools offer an explicit commit option; inspect their schemas for that behavior.
Troubleshooting
| Problem | Check |
|---|---|
| Server command not found | Make git-kb available to the client’s process, or configure its absolute path |
| Tools do not appear | Check the client’s MCP status and reconnect after editing configuration |
| Tools list works but an operation fails | Run git-kb daemon status and git-kb doctor --json in the project |
| Wrong KB loaded | Set GITKB_ROOT in the server environment and reconnect |
| Remote sync operation fails | Check authentication and run git-kb sync status origin --json |
Next steps
- MCP Tools Reference — Tool inventory and parameters
- Claude Code — Rules, skills, and hooks
- Codex — Project instructions and optional hooks
- Agent Workflows — Turn tool operations into committed task evidence