@@ -51,20 +51,93 @@ class Authenticator:
5151
5252Code-RAG works as an MCP server, letting Claude automatically search your codebase during conversations.
5353
54+ ### Quick Setup
55+
56+ ** Option 1: Using uvx (after publishing to PyPI)**
5457``` bash
58+ # Claude Desktop (config.json)
59+ claude mcp add code-rag
60+
61+ # Or with Claude Code
62+ claude mcp add code-rag --transport stdio uvx code-rag-mcp
63+ ```
64+
65+ ** Option 2: Local installation**
66+ ``` bash
67+ # Install in virtual environment
68+ pip install -e .
69+
5570# Register with Claude Code
5671claude mcp add code-rag --transport stdio path/to/venv/bin/code-rag-mcp
5772```
5873
59- Then talk to Claude:
74+ ### Configuration
75+
76+ The MCP server reads configuration from environment variables or config files. Configure via your MCP client's settings:
77+
78+ ** Claude Desktop (` ~/Library/Application Support/Claude/claude_desktop_config.json ` )** :
79+ ``` json
80+ {
81+ "mcpServers" : {
82+ "code-rag" : {
83+ "command" : " uvx" ,
84+ "args" : [" code-rag-mcp" ],
85+ "env" : {
86+ "CODE_RAG_EMBEDDING_MODEL" : " nomic-ai/CodeRankEmbed" ,
87+ "CODE_RAG_DATABASE_TYPE" : " chroma" ,
88+ "CODE_RAG_RERANKER_ENABLED" : " true"
89+ }
90+ }
91+ }
92+ }
93+ ```
94+
95+ ** Claude Code (via claude mcp add)** :
96+ ``` bash
97+ # Basic setup
98+ claude mcp add code-rag --transport stdio uvx code-rag-mcp
99+
100+ # Then configure via environment variables or config files
101+ ```
102+
103+ ** Common Configuration Options** :
104+ - ` CODE_RAG_EMBEDDING_MODEL ` - Embedding model (default: ` nomic-ai/CodeRankEmbed ` )
105+ - ` nomic-ai/CodeRankEmbed ` - Code-optimized, runs locally
106+ - ` text-embedding-3-small ` - OpenAI embeddings (requires ` OPENAI_API_KEY ` )
107+ - ` CODE_RAG_DATABASE_TYPE ` - Database backend: ` chroma ` or ` qdrant ` (default: ` chroma ` )
108+ - ` CODE_RAG_CHUNK_SIZE ` - Chunk size in characters (default: ` 1024 ` )
109+ - ` CODE_RAG_RERANKER_ENABLED ` - Enable result reranking (default: ` false ` )
110+ - ` CODE_RAG_SHARED_SERVER ` - Share embedding server across instances (default: ` true ` )
111+
112+ ** Example with OpenAI embeddings** :
113+ ``` json
114+ {
115+ "mcpServers" : {
116+ "code-rag" : {
117+ "command" : " uvx" ,
118+ "args" : [" code-rag-mcp" ],
119+ "env" : {
120+ "CODE_RAG_EMBEDDING_MODEL" : " text-embedding-3-small" ,
121+ "OPENAI_API_KEY" : " sk-..." ,
122+ "CODE_RAG_RERANKER_ENABLED" : " true"
123+ }
124+ }
125+ }
126+ }
127+ ```
128+
129+ ### Usage
130+
131+ Once configured, Claude can automatically search your codebase:
132+
60133```
61134You: "Find the database connection logic"
62135
63136Claude: [Automatically searches and finds the code]
64137 "I found the database connection logic in src/db/connection.py..."
65138```
66139
67- See [ docs/mcp.md] ( docs/mcp.md ) for detailed setup.
140+ See [ docs/mcp.md] ( docs/mcp.md ) for detailed setup and troubleshooting .
68141
69142## Basic Usage
70143
@@ -87,7 +160,20 @@ code-rag --database qdrant
87160
88161## Configuration
89162
90- Set via environment variables:
163+ ### Priority Order
164+
165+ Configuration is loaded in this order (higher priority overrides lower):
166+
167+ 1 . ** Environment variables** (highest priority)
168+ 2 . Custom config file via ` CODE_RAG_CONFIG_FILE ` environment variable
169+ 3 . Project config: ` ./code-rag.config `
170+ 4 . User config: ` ~/.config/code-rag/config ` (auto-created with defaults)
171+
172+ ** For MCP servers** : Set environment variables in your MCP client config (see MCP Integration section above).
173+
174+ ** For CLI usage** : Use environment variables or config files.
175+
176+ ### Environment Variables
91177
92178``` bash
93179# Use code-optimized embeddings (recommended)
@@ -103,20 +189,24 @@ export CODE_RAG_DATABASE_TYPE="qdrant"
103189# Adjust chunk size
104190export CODE_RAG_CHUNK_SIZE=" 2048"
105191
192+ # Enable reranking for better results
193+ export CODE_RAG_RERANKER_ENABLED=" true"
194+
106195# Add custom ignore patterns (comma-separated)
107196export CODE_RAG_ADDITIONAL_IGNORE_PATTERNS=" *.tmp,*.bak,logs/"
108197```
109198
199+ ### Config File Format
110200
111- ### Configuration Files
201+ Config files use the same format (key=value):
112202
113- Code-RAG looks for configuration in the following order (first found wins):
114-
115- 1 . ` CODE_RAG_CONFIG_FILE ` environment variable
116- 2 . ` code-rag.config ` in the current directory (project-specific)
117- 3 . ` ~/.config/code-rag/config ` (user-global)
118- - ** Auto-created with default values ** if it doesn't exist.
119- 4 . Shell environment variables (highest priority - these override files)
203+ ``` bash
204+ # ~/.config/code-rag/config or ./code-rag.config
205+ CODE_RAG_EMBEDDING_MODEL=nomic-ai/CodeRankEmbed
206+ CODE_RAG_DATABASE_TYPE=chroma
207+ CODE_RAG_CHUNK_SIZE=1024
208+ CODE_RAG_RERANKER_ENABLED=false
209+ ```
120210
121211Full configuration options in [ docs/IMPLEMENTATION.md] ( docs/IMPLEMENTATION.md#configuration-system ) .
122212
0 commit comments