Skip to main content

Syntax

Description

Starts the MCP server in stdio mode, serving all indexed repositories. This command is typically invoked automatically by your AI editor’s MCP configuration. The MCP server:
  • Loads all indexed repositories from the global registry (~/.gitnexus/registry.json)
  • Exposes all GitNexus tools via the Model Context Protocol
  • Discovers new repositories lazily (repos indexed after the server starts are picked up automatically)
  • Runs continuously until the editor closes

Multi-Repo Support

The MCP server serves all indexed repositories automatically. When you have multiple repos indexed:
  • Tools accept an optional repo parameter to specify which repository to query
  • If only one repo is indexed, the repo parameter is optional
  • If multiple repos are indexed and no repo is specified, the tool returns an error

Error Handling

The MCP server is designed to be resilient:
  • Uncaught exceptions are logged but don’t crash the server
  • KuzuDB lock conflicts degrade gracefully
  • Zero repos — The server starts even with no indexed repos. It prints a warning but remains running, and tools will discover repos lazily.

How Editors Use It

Typical MCP configuration:
The editor spawns this command as a subprocess and communicates via stdio using the MCP protocol.

Manual Usage

You typically don’t run this command manually. Use gitnexus setup to configure your editor to run it automatically. However, you can test it manually:
The server will print to stderr (since stdout is reserved for MCP protocol messages):
Or if no repos are indexed:

MCP Tools Exposed

See the MCP Tools Reference for detailed documentation.

MCP Resources Exposed

See the MCP Resources Reference for detailed documentation.

MCP Prompts Exposed

See the MCP Prompts Reference for detailed documentation.

Lazy Repository Discovery

The MCP server doesn’t require a restart when you index new repositories. Tools call refreshRepos() internally before each operation, automatically discovering repos indexed after the server started. This means you can:
  1. Start your editor (MCP server starts)
  2. Index a new repo: gitnexus analyze
  3. Use MCP tools immediately — no restart needed