How It Works
When you rungitnexus analyze in a repository:
- Creates local index in
.gitnexus/(KuzuDB database, metadata, embeddings) - Registers in global registry at
~/.gitnexus/registry.json - Installs project skills in
.claude/skills/or.cursor/skills/ - Creates context files (
AGENTS.md,CLAUDE.md)
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 thelist_repos tool to see all indexed repositories:
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:- Exact name match:
repo: "backend"matches registry entry with name “backend” - Path match:
repo: "/Users/you/projects/backend"matches by absolute path - Basename match:
repo: "backend"matches/Users/you/projects/backend
Cross-Repo Queries
To query multiple repos, make separate tool calls:Repository Naming
Repository names are derived from the directory name:Name Conflicts
If you have two repos with the same directory name:Staleness Checking
Each repository tracks its own staleness:Managing Multiple Repos
List All Repos
Re-index a Specific Repo
- Local index (
.gitnexus/) - Global registry entry (
~/.gitnexus/registry.json)
Remove a Repo
- Local index (
.gitnexus/) - Global registry entry
Remove All Repos
Resource URIs with Multi-Repo
All resources use repo-scoped URIs:Best Practices
1. Index Related Repos
Index repositories that work together:2. Use Consistent Naming
Keep directory names simple and descriptive:3. Check Staleness Regularly
After pulling changes:4. Start with list_repos
When working with multiple repos:
Troubleshooting
”Multiple repos indexed” error
When you see this error:Registry out of sync
If you deleted a repo manually (not viagitnexus clean):
Can’t find repo by name
Ifquery({ repo: "myrepo" }) fails:
- Check registry:
gitnexus list - Verify name matches:
cat ~/.gitnexus/registry.json - 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