Skip to main content

Syntax

Description

One-time global MCP configuration writer. Detects installed AI editors and writes the appropriate MCP config so the GitNexus MCP server is available in all projects. This command auto-detects your editors and configures them to use GitNexus MCP server globally. You only need to run it once.

Supported Editors

Cursor

Writes to ~/.cursor/mcp.json:
Also installs agent skills to ~/.cursor/skills/.

Claude Code

Prints manual installation command (MCP must be added via CLI):
Also:
  • Installs agent skills to ~/.claude/skills/
  • Registers PreToolUse hooks in ~/.claude/settings.json for automatic context enrichment

OpenCode

Writes to ~/.config/opencode/config.json:
Also installs agent skills to ~/.config/opencode/skill/.

Agent Skills

The setup command installs the following skills globally:
  • gitnexus-exploring — Navigate unfamiliar code using the knowledge graph
  • gitnexus-debugging — Trace bugs through call chains
  • gitnexus-impact-analysis — Analyze blast radius before changes
  • gitnexus-refactoring — Plan safe refactors using dependency mapping
  • gitnexus-guide — General usage guide
  • gitnexus-cli — CLI reference
Skills are installed per-editor:
  • Cursor: ~/.cursor/skills/
  • Claude Code: ~/.claude/skills/
  • OpenCode: ~/.config/opencode/skill/

Claude Code Hooks

For Claude Code, the setup command registers a PreToolUse hook that automatically enriches Grep, Glob, and Bash tool calls with knowledge graph context. The hook is written to ~/.claude/hooks/gitnexus/gitnexus-hook.cjs and registered in ~/.claude/settings.json:
This hook intercepts file search and grep operations to automatically inject relevant knowledge graph context, improving AI agent accuracy.

Windows Support

On Windows, the MCP entry uses cmd /c npx instead of npx directly, since npx is a .cmd script.

Usage Example

Output Example

When to Run

You only need to run this command once per machine. It configures MCP globally for all projects. If you install a new editor later, run gitnexus setup again to configure it.