Skip to main content
GitNexus supports indexing and querying multiple repositories simultaneously. Each repository maintains its own knowledge graph, and the MCP server serves all indexed repos from a global registry.

How It Works

When you run gitnexus analyze in a repository:
  1. Creates local index in .gitnexus/ (KuzuDB database, metadata, embeddings)
  2. Registers in global registry at ~/.gitnexus/registry.json
  3. Installs project skills in .claude/skills/ or .cursor/skills/
  4. Creates context files (AGENTS.md, CLAUDE.md)
The MCP server (npx gitnexus mcp) reads the global registry and serves all indexed repos automatically.

Global Registry

The global registry is a JSON file at ~/.gitnexus/registry.json:

Registry Management

The registry is managed automatically:
  • Add/Update: gitnexus analyze (registers or updates entry)
  • Remove: gitnexus clean (unregisters entry)
  • List: gitnexus list (shows all registered repos)
  • Validate: Registry validates on MCP server start (removes stale entries)

Multi-Repo Architecture

Single MCP Server: One MCP server process serves all indexed repositories. Your editor spawns it once, and it handles routing to the correct repo based on the repo parameter.

Using the repo Parameter

All GitNexus tools accept an optional repo parameter:

When repo is Optional

With only one indexed repo, the repo parameter is optional:

When repo is Required

With multiple indexed repos, specify which one:

Discovering Indexed Repos

Use the list_repos tool to see all indexed repositories:
Returns:
Or read the repos resource:
Always start here when working with multiple repos. This tells you which repos are indexed and what to pass as the repo parameter.

Connection Pooling

The MCP server maintains a connection pool for KuzuDB databases:
  • Lazy loading: Databases are opened on first query
  • Connection reuse: Subsequent queries reuse existing connections
  • Automatic cleanup: Connections close on server shutdown
Connection pooling is transparent. You don’t need to manage connections manually.

Repository Resolution

The MCP server resolves repositories by:
  1. Exact name match: repo: "backend" matches registry entry with name “backend”
  2. Path match: repo: "/Users/you/projects/backend" matches by absolute path
  3. Basename match: repo: "backend" matches /Users/you/projects/backend
All three resolve to the same repository:

Cross-Repo Queries

To query multiple repos, make separate tool calls:
GitNexus does not support cross-repo relationship queries. Each repository’s knowledge graph is independent. Use separate queries and combine results in your code.

Repository Naming

Repository names are derived from the directory name:

Name Conflicts

If you have two repos with the same directory name:
Use the full path to disambiguate:

Staleness Checking

Each repository tracks its own staleness:
Returns:
See Index Staleness for details.

Managing Multiple Repos

List All Repos

Output:

Re-index a Specific Repo

This updates both:
  • Local index (.gitnexus/)
  • Global registry entry (~/.gitnexus/registry.json)

Remove a Repo

This removes:
  • Local index (.gitnexus/)
  • Global registry entry

Remove All Repos

This deletes all indexes and clears the global registry. Use with caution.

Resource URIs with Multi-Repo

All resources use repo-scoped URIs:
The repo name in the URI matches the registry entry name:

Best Practices

Index repositories that work together:

2. Use Consistent Naming

Keep directory names simple and descriptive:

3. Check Staleness Regularly

After pulling changes:
Or read the context resource to check staleness:

4. Start with list_repos

When working with multiple repos:

Troubleshooting

”Multiple repos indexed” error

When you see this error:
Solution:

Registry out of sync

If you deleted a repo manually (not via gitnexus clean):

Can’t find repo by name

If query({ repo: "myrepo" }) fails:
  1. Check registry: gitnexus list
  2. Verify name matches: cat ~/.gitnexus/registry.json
  3. Try full path: query({ repo: "/full/path/to/repo" })

Next Steps

Using the Tools

Learn how to use GitNexus tools effectively

Index Staleness

Understand when to re-index repositories

Resources

Explore MCP resources for structured data

CLI Reference

Complete CLI command reference