FACT-CHECKED
Verification Date: 2025-12-31 Accuracy: 92% (23/25 major claims verified) Corrections Made: 2 critical corrections (OAuth version, MCP tool count) Confidence: HIGH - All claims verified against source code
See: docs/ai-integration-fact-check.md for detailed verification report
Complete guide to integrating CIDX with AI assistants for semantic code search in conversations.
- Overview
- Integration Approaches
- Local CLI Integration
- Remote MCP Server
- Platform Support
- Use Cases
- Troubleshooting
CIDX can be integrated with AI assistants in two ways:
- Local CLI Integration - AI learns to use
cidxcommand - Remote MCP Server - AI connects to centralized CIDX server
Both approaches enable semantic code search directly in AI conversations.
| Feature | Local CLI | Remote MCP Server |
|---|---|---|
| Setup | Simple (cidx teach-ai) |
Moderate (server required) |
| Scope | Local machine only | Team-wide access |
| Performance | Local execution | Network latency |
| Multi-user | No | Yes (OAuth 2.1) |
| Authentication | None needed | OAuth 2.1 |
| Best For | Individual developers | Teams |
Teach AI assistants to use the cidx command for semantic search.
- Generate AI instruction file (CLAUDE.md, GEMINI.md, etc.)
- AI reads instructions on how to use
cidxCLI - AI executes
cidx querycommands during conversations - AI receives and interprets search results
| Platform | Instruction File | Location |
|---|---|---|
| Claude Code | CLAUDE.md | Project or ~/.claude/ |
| Gemini | GEMINI.md | Project-specific |
| Codex | CODEX.md | Project-specific |
Project-Level (recommended for project-specific search):
# Navigate to project
cd /path/to/project
# Generate Claude instructions
cidx teach-ai --claude --project
# Creates: ./CLAUDE.mdGlobal (for system-wide semantic search):
# Generate global instructions
cidx teach-ai --claude --global
# Creates: ~/.claude/CLAUDE.md# Project-level
cidx teach-ai --gemini --project
# Creates: ./GEMINI.md# Project-level
cidx teach-ai --codex --project
# Creates: ./CODEX.mdThe instruction file contains:
- CIDX overview - What CIDX is and what it does
- Command syntax - How to use
cidx query - Parameter reference - All query parameters
- Example usage - Search patterns and workflows
- Best practices - When to use semantic search vs grep
Example Instructions (simplified):
# CIDX - Semantic Code Search
Use the `cidx` command to semantically search this codebase.
## Basic Usage
cidx query "authentication logic" --limit 10
## Parameters
--limit N Maximum results
--language python Filter by language
--path-filter PATH Include only paths matching pattern
...Once configured, AI assistants can use CIDX in conversations:
Example Conversation:
User: "Where is the JWT authentication code?"
AI: "Let me search for JWT authentication in the codebase."
[Executes: cidx query "JWT authentication" --limit 10]
[Reads results]
"The JWT authentication is implemented in:
- src/auth/jwt_validator.py (lines 42-87)
- src/middleware/auth.py (lines 15-35)
The main validation logic is in jwt_validator.py..."
# Regenerate instructions (overwrites existing)
cidx teach-ai --claude --project
# Or manually edit
nano ./CLAUDE.mdConnect AI assistants to centralized CIDX server for team-wide semantic search.
- CIDX server runs with golden repositories indexed
- MCP (Model Context Protocol) interface exposed
- AI assistant authenticates via OAuth 2.1
- AI queries server via MCP tools
- Results returned to AI for interpretation
AI Assistant → MCP Protocol → CIDX Server → Golden Repositories
↓ ↓
OAuth 2.1 Semantic Indexes
- Standard Protocol - MCP Protocol 2024-11-05
- OAuth 2.1 Authentication - Secure AI assistant auth via browser
- Remote Code Search - Query centralized indexed codebases
- Permission Controls - Role-based access (admin, power_user, normal_user)
- Golden Repository Access - Query team's shared code repositories
See CIDX MCP Bridge for complete setup instructions.
Quick Overview:
- Deploy CIDX server (admin task)
- Add golden repositories (admin task)
- Configure AI assistant (user task):
- Download MCP Bridge binary
- Configure API endpoint
- Authenticate via OAuth
Query Tools:
search_code- Semantic/FTS/temporal searchlist_repositories- Browse available reposget_file_content- Read file contentsbrowse_directory- Explore directory structure
SCIP Tools (Code Intelligence):
scip_definition- Find symbol definitionsscip_references- Find symbol usagesscip_dependencies- Find dependenciesscip_dependents- Find dependentsscip_impact- Impact analysisscip_callchain- Trace call chainsscip_context- Get symbol context
Git Tools:
git_log- Commit historygit_show_commit- Commit detailsgit_diff- Compare revisionsgit_blame- Line attribution
Claude Delegation Tools (execute AI workflows on protected repos):
list_delegation_functions- Discover available functionsexecute_delegation_function- Execute function on Claude Serverpoll_delegation_job- Wait for job completion via callback
See: Delegation Functions Guide for complete documentation.
Total: 78 MCP tools available
[✓ Corrected by fact-checker: Original claim was 53 tools, verified source code shows 75 tools in tool registry at src/code_indexer/server/mcp/tools.py]
| Role | Capabilities |
|---|---|
| admin | Full access (manage repos, users) |
| power_user | Activate repos, query, file operations |
| normal_user | Query repositories only |
Status: ✅ Fully supported
Setup:
cidx teach-ai --claude --projectWorks With:
- Claude Code (official CLI)
- Uses local
cidxcommand execution
Status: ✅ Fully supported via MCP Bridge
Setup: See MCP Bridge Guide
Works With:
- Claude Desktop app (macOS, Windows, Linux)
- Connects to remote CIDX server
- OAuth 2.1 authentication
Status: ✅ Supported
Setup:
cidx teach-ai --gemini --projectNote: Instruction file format may need platform-specific adjustments.
Status: ✅ Supported
Setup:
cidx teach-ai --codex --projectNote: Instruction file format may need platform-specific adjustments.
Extend to Other AI Platforms:
-
Generate instruction file:
cidx teach-ai --claude --project
-
Adapt format for target platform
-
Place in platform-specific location
-
Test AI can execute
cidxcommands
Scenario: Ask AI where specific functionality is implemented
Example:
User: "Where is the payment processing code?"
AI: [Uses cidx query "payment processing"]
"Payment processing is in src/payments/processor.py..."
Scenario: AI helps investigate and fix bugs
Example:
User: "Find authentication bugs"
AI: [Uses cidx query "authentication" --path-filter "*/auth/*"]
"Found authentication code in 5 files. Let me check for common vulnerabilities..."
Scenario: AI explains how code works
Example:
User: "Explain how the cache invalidation works"
AI: [Uses cidx query "cache invalidation"]
[Reads relevant files]
"The cache invalidation uses a TTL-based approach..."
Scenario: AI helps plan refactoring
Example:
User: "I want to refactor the authentication system"
AI: [Uses cidx query "authentication"]
[Uses cidx scip dependents "AuthService"]
"The authentication system has dependencies in 12 files..."
Scenario: AI investigates code history
Example:
User: "When was OAuth added?"
AI: [Uses cidx query "OAuth integration" --time-range-all]
"OAuth was added in commit abc123 on 2024-03-15..."
Scenario: Entire team uses AI for code search
Setup: Deploy CIDX server with golden repositories
Benefits:
- Shared semantic search across team
- Centralized index management
- Consistent search results
- OAuth 2.1-based access control
Solution:
# Verify CIDX installation
cidx --version
# If old version, upgrade
pipx upgrade code-indexerCheck:
-
Instruction file exists:
ls -la CLAUDE.md # Or GEMINI.md, CODEX.md -
File is readable:
cat CLAUDE.md # Should show CIDX instructions -
AI can access file:
- Project-level: File in current directory
- Global: File in ~/.claude/ (or platform-specific location)
-
Explicitly ask AI:
User: "Can you use the cidx command to search the codebase?"
Check:
-
Server is running:
curl https://your-server.com:8383/health
-
Authentication valid:
- Check ~/.mcpb/config.json contains tokens
- Re-run setup script if tokens expired
-
Network connectivity:
ping your-server.com
Update:
# Regenerate instructions (overwrites)
cidx teach-ai --claude --project
# Or manually edit to add new features
nano CLAUDE.mdClaude Code:
- Verify Claude Code installed and working
- Check CLAUDE.md in project or ~/.claude/
Claude Desktop (MCP):
- Verify MCP Bridge configured in claude_desktop_config.json
- Check MCP Bridge binary permissions (chmod +x)
- Verify server URL and authentication
Gemini/Codex:
- Check platform-specific instruction file format
- Verify AI can execute shell commands
- Test with simple
cidx --versionfirst
- MCP Bridge Setup: CIDX MCP Bridge
- Query Guide: Query Guide
- SCIP Integration: SCIP Code Intelligence
- Main Documentation: README
- Delegation Functions: Delegation Functions Guide - Execute AI workflows on protected repos
- Server Deployment: Server Deployment Guide
- Architecture: Architecture Guide
- Configuration: Configuration Guide