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:

shell
git-kb init claude

For manual setup, add the server to .mcp.json:

json
{
  "mcpServers": {
    "gitkb": {
      "command": "git-kb",
      "args": ["mcp"]
    }
  }
}

Codex

Register the local server:

shell
codex mcp add gitkb -- git-kb mcp
codex mcp list

You can also configure it in Codex’s config.toml:

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:

ClientGitKB scaffoldMCP configuration
Cursorgit-kb init cursor.cursor/mcp.json
Windsurfgit-kb init windsurfUse the global MCP settings described by the scaffold
OpenCodegit-kb init opencodeopencode.json
oh-my-pigit-kb init oh-my-pi.omp/mcp.json
Grok Buildgit-kb init grok.grok/config.toml
Cline and other clientsManualAdd 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:

json
{
  "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

ProblemCheck
Server command not foundMake git-kb available to the client’s process, or configure its absolute path
Tools do not appearCheck the client’s MCP status and reconnect after editing configuration
Tools list works but an operation failsRun git-kb daemon status and git-kb doctor --json in the project
Wrong KB loadedSet GITKB_ROOT in the server environment and reconnect
Remote sync operation failsCheck authentication and run git-kb sync status origin --json

Next steps