-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathllms-full.txt
More file actions
1909 lines (1450 loc) · 64.8 KB
/
llms-full.txt
File metadata and controls
1909 lines (1450 loc) · 64.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<div align="center">
<img src="./docs/assets/ragcode-banner.png" alt="RagCode MCP - Semantic Code Navigation with AI" width="100%">
</div>
<div align="center">
[](./LICENSE)
[](https://go.dev/)
[](https://modelcontextprotocol.io)




[](https://github.com/doITmagic/rag-code-mcp)
</div>
# RagCode MCP - Make Your Codebase AI-Ready
<!-- AI Agents: This is the full documentation for RagCode MCP. For a quick summary, see llms.txt -->
> **The privacy-first MCP server that transforms any repository into an AI-ready codebase with semantic search and RAG.**
RagCode is a **Model Context Protocol (MCP) server** that instantly makes your project **AI-ready**. It enables AI assistants like **GitHub Copilot**, **Cursor**, **Windsurf**, and **Claude** to understand your entire codebase through **semantic vector search**, bridging the gap between your code and Large Language Models (LLMs).
Built with the official [Model Context Protocol Go SDK](https://github.com/modelcontextprotocol/go-sdk), RagCode provides **9 powerful tools** to index, search, and analyze code, making it the ultimate solution for **AI-ready software development**.
## 🔒 Privacy-First: 100% Local AI
**Your code never leaves your machine.** RagCode runs entirely on your local infrastructure:
- ✅ **Local AI Models** - Uses Ollama for LLM and embeddings (runs on your hardware)
- ✅ **Local Vector Database** - Qdrant runs in Docker on your machine
- ✅ **Zero Cloud Dependencies** - No external API calls, no data transmission
- ✅ **No API Costs** - Free forever, no usage limits or subscriptions
- ✅ **Complete Privacy** - Your proprietary code stays private and secure
- ✅ **Offline Capable** - Works without internet connection (after initial model download)
- ✅ **Full Control** - You own the data, models, and infrastructure
**Perfect for:** Enterprise codebases, proprietary projects, security-conscious teams, and developers who value privacy.
### 🎯 Key Features
- 🔍 **Semantic Code Search** - Find code by meaning, not just keywords
- 🚀 **5-10x Faster** - Instant results vs. reading entire files
- 💰 **98% Token Savings** - Reduce AI context usage dramatically
- 🌐 **Multi-Language** - Go, PHP (Laravel), Python with full support
- 🏢 **Multi-Workspace** - Handle multiple projects simultaneously
- 🤖 **AI-Ready** - Works with Copilot, Cursor, Windsurf, Claude, Antigravity
### 🛠️ Technology Stack
**100% Local Stack:** Ollama (local LLM + embeddings) + Qdrant (local vector database) + Docker + MCP Protocol
### 💻 Compatible IDEs & AI Assistants
Windsurf • Cursor • Antigravity • Claude Desktop • **VS Code + GitHub Copilot** • MCP Inspector
---
## 🚀 Why RagCode? Performance Benefits
### **5-10x Faster Code Understanding**
Without RagCode, AI assistants must:
- 📄 Read entire files to find relevant code
- 🔍 Search through thousands of lines manually
- 💭 Use precious context window tokens on irrelevant code
- ⏱️ Wait for multiple file reads and searches
**With RagCode:**
- ⚡ **Instant semantic search** - finds relevant code in milliseconds
- 🎯 **Pinpoint accuracy** - returns only the exact functions/types you need
- 💰 **90% less context usage** - AI sees only relevant code, not entire files
- 🧠 **Smarter responses** - AI has more tokens for actual reasoning
### Real-World Impact
| Task | Without RagCode | With RagCode | Speedup |
|------|----------------|--------------|---------|
| Find authentication logic | 30-60s (read 10+ files) | 2-3s (semantic search) | **10-20x faster** |
| Understand function signature | 15-30s (grep + read file) | 1-2s (direct lookup) | **15x faster** |
| Find all API endpoints | 60-120s (manual search) | 3-5s (hybrid search) | **20-40x faster** |
| Navigate type hierarchy | 45-90s (multiple files) | 2-4s (type definition) | **20x faster** |
### Token Efficiency
**Example: Finding a function in a 50,000 line codebase**
- **Without RagCode:** AI reads 5-10 files (~15,000 tokens) to find the function
- **With RagCode:** AI gets exact function + context (~200 tokens)
- **Savings:** **98% fewer tokens** = faster responses + lower costs
### 🆚 RagCode vs Cloud-Based Solutions
| Feature | RagCode (Local) | Cloud-Based AI Code Search |
|---------|-----------------|---------------------------|
| **Privacy** | ✅ 100% local, code never leaves machine | ❌ Code sent to cloud servers |
| **Cost** | ✅ $0 - Free forever | ❌ $20-100+/month subscriptions |
| **API Limits** | ✅ Unlimited usage | ❌ Rate limits, token caps |
| **Offline** | ✅ Works without internet | ❌ Requires constant connection |
| **Data Control** | ✅ You own everything | ❌ Vendor controls your data |
| **Enterprise Ready** | ✅ No compliance issues | ⚠️ May violate security policies |
| **Setup** | ⚠️ Requires local resources | ✅ Instant cloud access |
| **Performance** | ✅ Fast (local hardware) | ⚠️ Depends on network latency |
**Bottom Line:** RagCode gives you enterprise-grade AI code search with zero privacy concerns and zero ongoing costs.
---
## ✨ Core Features & Capabilities
### 🔧 9 Powerful MCP Tools for AI Code Assistants
1. **`search_code`** - **USE FIRST** - Semantic search by MEANING. Returns complete source + file:line. Better than hybrid_search for exploration. **Go, PHP, Python, HTML.**
2. **`hybrid_search`** - Keyword + semantic for **EXACT matches** only. Returns code + file:line + metadata. Use when search_code misses exact terms. **Go, PHP, Python, HTML.**
3. **`get_function_details`** - **COMPLETE** function source: signature, params, return types, body. **Go, PHP, Python.**
4. **`find_type_definition`** - Complete type source with fields, methods, inheritance chain. **Go, PHP, Python.**
5. **`find_implementations`** - All callers/usages with code snippets + file:line. **Use before refactoring.** **Go, PHP, Python.**
6. **`list_package_exports`** - Structured list: symbol names, types, signatures. **Go, PHP, Python.**
7. **`search_docs`** - Doc snippets with file paths. **Markdown only. Not for code** - use search_code.
8. **`get_code_context`** - Code snippet with configurable context lines. **Any text file.**
9. **`index_workspace`** - Reindex codebase. **USUALLY AUTOMATIC.** Call after git pull/branch switch. **Go, PHP, Python, HTML.**
### 🌐 Multi-Language Code Intelligence
- **Go** - Full AST analysis with functions, types, interfaces, methods
- **PHP** - Full support + Laravel framework (Eloquent models, routes, controllers)
- **Python** - Full support with classes, functions, decorators, type hints, mixins, metaclasses
- **JavaScript/TypeScript** - Planned for future releases (tree-sitter based)
### 🏗️ Advanced Architecture
- **Multi-Workspace Detection** - Automatically detects project boundaries (git, go.mod, composer.json, package.json, pyproject.toml, requirements.txt)
- **Per-Language Collections** - Separate vector databases for each language (`ragcode-{workspace}-go`, `ragcode-{workspace}-php`, `ragcode-{workspace}-python`)
- **Automatic Indexing** - Background indexing on first use, no manual intervention needed
- **Vector Embeddings** - Uses Ollama's `mxbai-embed-large` for high-quality semantic embeddings
- **Hybrid Search Engine** - Combines vector similarity with BM25 lexical matching
- **Direct File Access** - Read code without indexing for quick lookups
- **Smart Caching** - Efficient re-indexing only for changed files
---
## 📦 System Requirements
### Minimum Requirements
| Component | Requirement | Notes |
|-----------|-------------|-------|
| **CPU** | 4 cores | For running Ollama models |
| **RAM** | 16 GB | 8 GB for `phi3:medium`, 4 GB for `mxbai-embed-large`, 4 GB system |
| **Disk** | 10 GB free | ~8 GB for models + 2 GB for data |
| **OS** | Linux, macOS, Windows | Docker required for Qdrant |
### Recommended Requirements
| Component | Requirement | Notes |
|-----------|-------------|-------|
| **CPU** | 8+ cores | Better performance for concurrent operations |
| **RAM** | 32 GB | Allows comfortable multi‑workspace indexing |
| **GPU** | NVIDIA GPU with 8 GB+ VRAM | Significantly speeds up Ollama inference (optional) |
| **Disk** | 20 GB free SSD | Faster indexing and search |
### Model Sizes
- `mxbai-embed-large`: ~274 MB (embeddings model)
- `phi3:medium`: ~7.9 GB (LLM for code analysis)
- **Total**: ~8.2 GB for models
---
## ⚡ Quick Start (One‑Command Installer)
**Linux (amd64):**
```bash
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=docker
```
**macOS (Apple Silicon):**
```bash
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_darwin_arm64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=docker
```
**macOS (Intel):**
```bash
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_darwin_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=docker
```
**Windows (PowerShell):**
```powershell
Invoke-WebRequest -Uri "https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_windows_amd64.zip" -OutFile "ragcode.zip"
Expand-Archive ragcode.zip -DestinationPath . -Force
.\ragcode-installer.exe -ollama=docker -qdrant=docker
```
> ⚠️ Windows requires [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed and running.
**Windows with WSL (alternative):**
If you run Docker via WSL and have IDEs on Windows, install the Linux version inside WSL:
```bash
# Inside WSL terminal
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=docker
```
Then manually configure your Windows IDE (e.g., Windsurf at `%USERPROFILE%\.codeium\windsurf\mcp_config.json`):
```json
{
"mcpServers": {
"ragcode": {
"command": "wsl.exe",
"args": ["-e", "/home/YOUR_USERNAME/.local/share/ragcode/bin/rag-code-mcp"],
"env": {
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "phi3:medium",
"OLLAMA_EMBED": "mxbai-embed-large",
"QDRANT_URL": "http://localhost:6333"
},
"disabled": false
}
}
}
```
> 💡 Replace `YOUR_USERNAME` with your WSL username. The `localhost` URLs work because WSL2 shares network ports with Windows.
The installer is end-to-end:
1. ✅ Installs the `rag-code-mcp` and `index-all` binaries into `~/.local/share/ragcode/bin`
2. ✅ Configures Windsurf, Cursor, Claude, VS Code, etc.
3. ✅ Starts Docker and launches the Ollama + Qdrant containers
4. ✅ Downloads the required models (`phi3:medium`, `mxbai-embed-large`)
5. ✅ Runs health-check and starts the MCP server
### Customization Options
```bash
# Everything in Docker (default)
./ragcode-installer -ollama=docker -qdrant=docker
# Keep Ollama local, run only Qdrant in Docker
./ragcode-installer -ollama=local -qdrant=docker
# Use existing remote services
./ragcode-installer -ollama=local -qdrant=remote --skip-build
# Enable GPU + mount models directory
./ragcode-installer -ollama=docker -qdrant=docker -gpu -models-dir=$HOME/.ollama
```
Key flags:
- `-ollama`: `docker` (default) or `local`
- `-qdrant`: `docker` (default) or `remote`
- `-models-dir`, `-gpu`, `-skip-build`, `-ides`
See [QUICKSTART.md](./QUICKSTART.md) for detailed installation and usage instructions.
### Manual Build (for developers)
```bash
git clone https://github.com/doITmagic/rag-code-mcp.git
cd rag-code-mcp
go run ./cmd/install
```
---
## 📋 Step‑by‑Step Setup
### 1. Install Prerequisites
**Docker is required** (for Qdrant, and optionally for Ollama):
```bash
# Ubuntu/Debian
sudo apt update && sudo apt install docker.io
sudo systemctl start docker
sudo usermod -aG docker $USER # log out / log in again
# macOS
brew install docker
```
### 2. Run the Installer
**Option A: Everything in Docker (recommended, no extra installs needed)**
```bash
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=docker
```
**Option B: Use local Ollama (if you already have Ollama installed)**
```bash
# First, install Ollama locally (skip if already installed)
curl -fsSL https://ollama.com/install.sh | sh
# Then run installer with local Ollama
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=local -qdrant=docker
```
Installation takes roughly 5‑10 minutes (downloading the Ollama models is the longest step).
### 3. Verify Installation
```bash
# Check the binary
~/.local/share/ragcode/bin/rag-code-mcp --version
# Verify services are running
docker ps | grep qdrant
ollama list
```
### 4. Health Check (the server starts automatically)
```bash
~/.local/share/ragcode/bin/rag-code-mcp --health
docker ps | grep ragcode-qdrant
docker ps | grep ragcode-ollama
```
---
## 🎯 Using RagCode in Your IDE
After installation, RagCode is automatically available in supported IDEs. No additional configuration is required.
### Supported IDEs
- **Windsurf** - Full MCP support
- **Cursor** - Full MCP support
- **Antigravity** - Full MCP support
- **Claude Desktop** - Full MCP support
- **VS Code + GitHub Copilot** - Agent mode integration (requires VS Code 1.95+)
### VS Code + GitHub Copilot Integration
RagCode integrates with **GitHub Copilot's Agent Mode** through MCP, enabling semantic code search as part of Copilot's autonomous workflow.
**Quick Setup:**
1. Install RagCode using the release `ragcode-installer` (it automatically configures VS Code)
2. Open VS Code in your project
3. Open Copilot Chat (Ctrl+Shift+I / Cmd+Shift+I)
4. Enable **Agent Mode** (click "Agent" button or type `/agent`)
5. Ask questions - Copilot will automatically use RagCode tools
**Example Prompts:**
```
Find all authentication middleware functions in this codebase
Show me the User model definition and all its methods
Search for functions that handle database connections
```
**Manual Configuration:**
Edit `~/.config/Code/User/globalStorage/mcp-servers.json`:
```json
{
"mcpServers": {
"ragcode": {
"command": "/home/YOUR_USERNAME/.local/share/ragcode/bin/rag-code-mcp",
"args": [],
"env": {
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "phi3:medium",
"OLLAMA_EMBED": "mxbai-embed-large",
"QDRANT_URL": "http://localhost:6333"
}
}
}
}
```
**Verify Integration:**
- Command Palette → `MCP: Show MCP Servers`
- Check that `ragcode` appears with "Connected" status
**📖 Detailed Guide:** See [docs/vscode-copilot-integration.md](./docs/vscode-copilot-integration.md) for complete setup, troubleshooting, and advanced features.
See [QUICKSTART.md](./QUICKSTART.md) for detailed VS Code setup and troubleshooting.
### Available Tools
1. **`search_code`** – **USE FIRST** – Semantic search by MEANING. Returns complete source + file:line. Better than hybrid_search. **Go, PHP, Python, HTML.**
2. **`hybrid_search`** – Keyword + semantic for **EXACT matches** only. Use when search_code misses exact terms. **Go, PHP, Python, HTML.**
3. **`get_function_details`** – **COMPLETE** function source: signature, params, return types, body. **Go, PHP, Python.**
4. **`find_type_definition`** – Complete type source with fields, methods, inheritance. **Go, PHP, Python.**
5. **`find_implementations`** – All callers/usages with code snippets + file:line. **Use before refactoring.** **Go, PHP, Python.**
6. **`list_package_exports`** – Structured list: symbol names, types, signatures. **Go, PHP, Python.**
7. **`search_docs`** – Doc snippets with file paths. **Markdown only. Not for code.**
8. **`get_code_context`** – Code snippet with configurable context lines. **Any text file.**
9. **`index_workspace`** – Reindex codebase. **USUALLY AUTOMATIC.** Call after git pull/branch switch. **Go, PHP, Python, HTML.**
**All tools require a `file_path` parameter** so that RagCode can determine the correct workspace.
---
## 🔄 Automatic Indexing
When a tool is invoked for the first time in a workspace, RagCode will:
1. Detect the workspace from `file_path`
2. Create a Qdrant collection for that workspace and language
3. Index the code in the background
4. Return results immediately (even if indexing is still in progress)
You never need to run `index_workspace` manually.
---
## 🛠 Advanced Configuration
### Changing AI Models
Edit `~/.local/share/ragcode/config.yaml`:
```yaml
llm:
provider: "ollama"
base_url: "http://localhost:11434"
model: "phi3:medium" # change to another model if desired
embed_model: "mxbai-embed-large"
```
Recommended models:
- **LLM:** `phi3:medium`, `llama3.1:8b`, `qwen2.5:7b`
- **Embeddings:** `mxbai-embed-large`, `all-minilm`
### Qdrant Configuration
```yaml
qdrant:
url: "http://localhost:6333"
collection_prefix: "ragcode"
```
### Excluding Directories
```yaml
workspace:
exclude_patterns:
- "vendor"
- "node_modules"
- ".git"
- "dist"
- "build"
```
---
## 🐛 Troubleshooting
### "Workspace '/home' is not indexed yet"
**Cause:** `file_path` is missing or points outside a recognized project.
**Fix:** Provide a valid `file_path` inside your project, e.g.:
```json
{ "query": "search query", "file_path": "/path/to/your/project/file.go" }
```
### "Could not connect to Qdrant"
**Cause:** Docker is not running or the Qdrant container is stopped.
**Fix:**
```bash
sudo systemctl start docker # Linux
# Then start Qdrant (the installer does this automatically)
~/.local/share/ragcode/start.sh
```
### "Ollama model not found"
**Cause:** Required models have not been downloaded.
**Fix:**
```bash
ollama pull mxbai-embed-large
ollama pull phi3:medium
```
### Indexing is too slow
**Cause:** Large workspace or a heavy model.
**Fix:**
- Use a smaller model (`phi3:mini`)
- Exclude large directories in `config.yaml`
- Wait – indexing runs in the background.
---
## 📚 Example Requests
```json
{ "query": "user authentication login", "file_path": "/home/user/myproject/auth/handler.go" }
```
```json
{ "type_name": "UserController", "file_path": "/home/user/laravel-app/app/Http/Controllers/UserController.php" }
```
```json
{ "query": "API endpoints documentation", "file_path": "/home/user/myproject/docs/API.md" }
```
---
## 🔗 Resources & Documentation
### 📖 Project Documentation
- **[Quick Start Guide](./QUICKSTART.md)** - Get started in 5 minutes
- **[VS Code + Copilot Integration](./docs/vscode-copilot-integration.md)** - Detailed setup for GitHub Copilot
- **[Architecture Overview](./docs/architecture.md)** - Technical deep dive
- **[Tool Schema Reference](./docs/tool_schema_v2.md)** - Complete API documentation
### 🌐 External Resources
- **[GitHub Repository](https://github.com/doITmagic/rag-code-mcp)** - Source code and releases
- **[Issue Tracker](https://github.com/doITmagic/rag-code-mcp/issues)** - Report bugs or request features
- **[Model Context Protocol](https://modelcontextprotocol.io)** - Official MCP specification
- **[Ollama Documentation](https://ollama.com)** - LLM and embedding models
- **[Qdrant Documentation](https://qdrant.tech)** - Vector database guide
### 🎓 Learning Resources
- **[What is RAG?](https://en.wikipedia.org/wiki/Prompt_engineering#Retrieval-augmented_generation)** - Understanding Retrieval-Augmented Generation
- **[Vector Embeddings Explained](https://qdrant.tech/articles/what-are-embeddings/)** - How semantic search works
- **[MCP for Developers](https://github.com/modelcontextprotocol/specification)** - Building MCP servers
---
## 🤝 Contributing & Community
We welcome contributions from the community! Here's how you can help:
- 🐛 **Report Bugs** - [Open an issue](https://github.com/doITmagic/rag-code-mcp/issues/new)
- 💡 **Request Features** - Share your ideas for new tools or languages
- 🔧 **Submit PRs** - Improve code, documentation, or add new features
- ⭐ **Star the Project** - Show your support on GitHub
- 📢 **Spread the Word** - Share RagCode with other developers
### Development Setup
```bash
git clone https://github.com/doITmagic/rag-code-mcp.git
cd rag-code-mcp
go mod download
go run ./cmd/rag-code-mcp
```
---
## 📄 License
RagCode MCP is open source software licensed under the **MIT License**.
See the [LICENSE](./LICENSE) file for full details.
---
## 🏷️ Keywords & Topics
`semantic-code-search` `rag` `retrieval-augmented-generation` `mcp-server` `model-context-protocol` `ai-code-assistant` `vector-search` `code-navigation` `ollama` `qdrant` `github-copilot` `cursor-ai` `windsurf` `go` `php` `laravel` `python` `django` `flask` `fastapi` `code-intelligence` `ast-analysis` `embeddings` `llm-tools` `local-ai` `privacy-first` `offline-ai` `self-hosted` `on-premise` `zero-cost` `no-cloud` `private-code-search` `enterprise-ai` `secure-coding-assistant`
---
<div align="center">
**Built with ❤️ for developers who want smarter AI code assistants**
⭐ **[Star us on GitHub](https://github.com/doITmagic/rag-code-mcp)** if RagCode helps your workflow!
**Questions? Problems?** [Open an Issue](https://github.com/doITmagic/rag-code-mcp/issues) • [Read the Docs](./QUICKSTART.md) • [Join Discussions](https://github.com/doITmagic/rag-code-mcp/discussions)
</div>
# 🚀 RagCode MCP - Quick Start Guide
**Semantic code navigation using RAG (Retrieval-Augmented Generation)**
---
## 📦 What is RagCode?
RagCode is an MCP (Model Context Protocol) server that allows you to navigate and understand code using semantic search. It works with **Windsurf**, **Cursor**, **Antigravity**, **Claude Desktop**, and other MCP-compatible IDEs to provide:
- 🔍 **Semantic Search** in your codebase (not just text matching)
- 📚 **Contextual Understanding** of code (functions, classes, relationships)
- 🎯 **Multi-workspace** - works on multiple projects simultaneously
- 🌐 **Multi-language** - support for Go, PHP (Laravel), JavaScript, Python
---
## ⚡ Quick Install (1 Command)
### Option 1: Release Installer (Recommended)
**Linux (amd64):**
```bash
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=docker
```
**macOS (Apple Silicon):**
```bash
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_darwin_arm64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=docker
```
**macOS (Intel):**
```bash
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_darwin_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=docker
```
**Windows (PowerShell):**
```powershell
Invoke-WebRequest -Uri "https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_windows_amd64.zip" -OutFile "ragcode.zip"
Expand-Archive ragcode.zip -DestinationPath . -Force
.\ragcode-installer.exe -ollama=docker -qdrant=docker
```
> ⚠️ Windows requires [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed and running.
**Windows with WSL:** Install Linux version in WSL, then configure Windows IDEs to use `wsl.exe` as command with args `["-e", "/home/USER/.local/share/ragcode/bin/rag-code-mcp"]`. See README for full config example.
The installer will:
1. ✅ Download and install the `rag-code-mcp` and `index-all` binaries into `~/.local/share/ragcode/bin`
2. ✅ Add the binaries to your PATH
3. ✅ Configure Windsurf, Cursor, Antigravity, VS Code, etc. (MCP config)
4. ✅ Start Docker (if needed) and launch the Ollama + Qdrant containers
5. ✅ Download required AI models (`mxbai-embed-large`, `phi3:medium`)
6. ✅ Run health checks and start the MCP server in the background
**Installer Flags (examples):**
```bash
# Everything inside Docker (default)
./ragcode-installer -ollama=docker -qdrant=docker
# Use existing local Ollama but keep Qdrant in Docker
./ragcode-installer -ollama=local -qdrant=docker
# Point to remote services / re-use local binaries
./ragcode-installer -ollama=local -qdrant=remote --skip-build
# Mount a custom models directory and enable GPU
./ragcode-installer -ollama=docker -models-dir=$HOME/.ollama -gpu
```
**Key flags:** `-ollama`, `-qdrant`, `-models-dir`, `-gpu`, `-skip-build`, `-ides`.
### Option 2: Local Build (For Developers)
```bash
git clone https://github.com/doITmagic/rag-code-mcp.git
cd rag-code-mcp
go run ./cmd/install
```
---
## 🔧 System Requirements
### Mandatory:
- **Docker** - for Qdrant (vector database)
- **Ollama** - for LLM and embeddings
- **Go 1.21+** - only for local build
### Optional:
- **Windsurf**, **Cursor**, **Antigravity**, **Claude Desktop**, or other MCP compatible IDEs
---
## 📋 Step-by-Step Setup
### 1. Install Prerequisites
**Docker is required** (for Qdrant, and optionally for Ollama):
```bash
# Ubuntu/Debian
sudo apt update && sudo apt install docker.io
sudo systemctl start docker
sudo usermod -aG docker $USER # Logout/login after
# macOS
brew install docker
```
### 2. Run the Installer
**Option A: Everything in Docker (recommended, no extra installs needed)**
```bash
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=docker -qdrant=docker
```
**Option B: Use local Ollama (if you already have Ollama installed)**
```bash
# First, install Ollama locally (skip if already installed)
curl -fsSL https://ollama.com/install.sh | sh
# Then run installer with local Ollama
curl -fsSL https://github.com/doITmagic/rag-code-mcp/releases/latest/download/rag-code-mcp_linux_amd64.tar.gz | tar xz && ./ragcode-installer -ollama=local -qdrant=docker
```
**Installation time:** ~5-10 minutes (model downloads dominate)
### 3. Verify Installation
```bash
# Verify binaries are installed
~/.local/share/ragcode/bin/rag-code-mcp --version
# Verify services are running
docker ps | grep qdrant
ollama list
```
### 4. Health Check (everything starts automatically)
```bash
~/.local/share/ragcode/bin/rag-code-mcp --health
docker ps | grep ragcode-qdrant
docker ps | grep ragcode-ollama
```
---
## 💡 First Time Setup - Index Your Workspace
After installation, you need to index each project you want to work with. This is a **one-time setup per project**.
### Quick Start Prompt for Your AI Assistant
Open your project in Windsurf or Cursor and paste this prompt to the AI:
```
Please use the RagCode MCP tool 'index_workspace' to index this project
for semantic code search. Provide the file_path parameter pointing to any
file in this workspace. Once indexing completes, I'll be able to use
search_code, get_function_details, and other tools to help you navigate
and understand the codebase.
Note: Indexing runs in the background and may take a few minutes depending
on project size. You can start using search immediately - results will
improve as indexing progresses.
```
### What Happens During Indexing?
1. 🔍 **Workspace Detection** - RagCode detects your project root (looks for `.git`, `go.mod`, `composer.json`, etc.)
2. 📊 **Language Detection** - Identifies programming languages in your project
3. 🗂️ **Collection Creation** - Creates a Qdrant collection: `ragcode-{workspace-id}-{language}`
4. 📝 **Code Analysis** - Extracts functions, classes, types, and their relationships
5. 🧠 **Embedding Generation** - Creates semantic embeddings using Ollama
6. 💾 **Vector Storage** - Stores embeddings in Qdrant for fast retrieval
### Example Workflow
```bash
# 1. Open your project in Windsurf/Cursor
cd ~/projects/my-awesome-app
# 2. Ask AI to index (using the prompt above)
# AI will call: index_workspace with file_path="/path/to/my-awesome-app/main.go"
# 3. Wait for confirmation (usually 1-5 minutes)
# ✓ Indexing started for workspace '/path/to/my-awesome-app'
# Languages: go
# Collections will be created: ragcode-abc123-go
# 4. Start using semantic search!
# Ask: "Find all authentication middleware functions"
# Ask: "Show me the User model definition"
# Ask: "What functions call the database connection?"
```
### Multi-Project Support
**Repeat the indexing process for each project:**
```bash
# Project 1
cd ~/projects/backend-api
# Ask AI to index this workspace
# Project 2
cd ~/projects/frontend-app
# Ask AI to index this workspace
# Project 3
cd ~/projects/mobile-app
# Ask AI to index this workspace
```
Each project gets its own collection in Qdrant, and RagCode automatically switches between them based on which file you're working with.
---
## 🎯 How to Use RagCode?
### In Your MCP-Compatible IDE (Windsurf, Cursor, Antigravity, etc.)
After installation, RagCode is automatically available in the IDE. **No manual action required!**
### In VS Code with GitHub Copilot
RagCode integrates with **GitHub Copilot's Agent Mode** in VS Code through the Model Context Protocol (MCP). This allows Copilot to use RagCode's semantic search capabilities as part of its autonomous coding workflow.
#### Prerequisites
- **VS Code** with **GitHub Copilot** subscription
- RagCode installed (via the `ragcode-installer` above)
- VS Code version **1.95+** (for MCP support)
#### Setup
`ragcode-installer` automatically configures RagCode for VS Code by creating:
```
~/.config/Code/User/globalStorage/mcp-servers.json
```
**Manual Configuration (if needed):**
Create or edit `~/.config/Code/User/globalStorage/mcp-servers.json`:
```json
{
"mcpServers": {
"ragcode": {
"command": "/home/YOUR_USERNAME/.local/share/ragcode/bin/rag-code-mcp",
"args": [],
"env": {
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "phi3:medium",
"OLLAMA_EMBED": "mxbai-embed-large",
"QDRANT_URL": "http://localhost:6333"
}
}
}
}
```
**Note:** Replace `YOUR_USERNAME` with your actual username.
#### Using RagCode with Copilot Agent Mode
1. **Open VS Code** in your project directory
2. **Open Copilot Chat** (Ctrl+Shift+I or Cmd+Shift+I)
3. **Enable Agent Mode** by clicking the "Agent" button or typing `/agent`
4. **Use RagCode tools** - Copilot will automatically invoke them based on your prompts
**Example Prompts:**
```
Find all authentication middleware functions in this codebase
```
```
Show me the User model definition and all its methods
```
```
Search for functions that handle database connections
```
```
Find all API endpoints related to user management
```
Copilot will automatically use RagCode's `search_code`, `get_function_details`, `find_type_definition`, and other tools to answer your questions.
#### Explicit Tool Usage
You can also explicitly reference RagCode tools using the `#` symbol:
```
#ragcode search for payment processing functions
```
```
#ragcode find the UserController type definition
```
#### Verifying MCP Integration
1. Open **Command Palette** (Ctrl+Shift+P / Cmd+Shift+P)
2. Type: `MCP: Show MCP Servers`
3. Verify that `ragcode` appears in the list
4. Check status shows "Connected"
#### Troubleshooting VS Code Integration
**MCP server not showing:**
- Verify config file exists: `~/.config/Code/User/globalStorage/mcp-servers.json`
- Restart VS Code
- Check VS Code version (requires 1.95+)
**Tools not working:**
- Ensure Qdrant and Ollama are running: `docker ps | grep qdrant`
- Check MCP server logs in VS Code Output panel (select "MCP" from dropdown)
- Verify binary path is correct in config
**Copilot not using tools:**
- Make sure you're in **Agent Mode** (not regular chat)
- Try explicitly mentioning `#ragcode` in your prompt
- Ensure workspace is indexed (ask Copilot to index first)
**📖 For more details:** See [docs/vscode-copilot-integration.md](../docs/vscode-copilot-integration.md) for:
- Advanced configuration options
- Custom Ollama models
- Remote Ollama/Qdrant setup
- Detailed troubleshooting
- Multi-workspace workflows
- Performance optimization tips
#### Available Tools:
1. **`search_code`** - **USE FIRST** - Semantic search by MEANING. Returns complete source + file:line. Better than hybrid_search for exploration. **Go, PHP, Python, HTML.**
```json
{
"query": "authentication middleware",
"file_path": "/path/to/your/project/file.go"
}
```
2. **`hybrid_search`** - Keyword + semantic for **EXACT matches** only. Use when search_code misses exact terms. **Go, PHP, Python, HTML.**
```json
{
"query": "user login function",
"file_path": "/path/to/your/project/file.php"
}
```
3. **`get_function_details`** - **COMPLETE** function source: signature, params, return types, body. **Go, PHP, Python.**
```json
{
"function_name": "HandleLogin",
"file_path": "/path/to/your/project/auth.go"
}
```
4. **`find_type_definition`** - Complete type source with fields, methods, inheritance. **Go, PHP, Python.**
```json
{
"type_name": "User",
"file_path": "/path/to/your/project/models/user.php"
}
```
5. **`find_implementations`** - All callers/usages with code snippets + file:line. **Use before refactoring.** **Go, PHP, Python.**
```json
{
"symbol_name": "ProcessPayment",
"file_path": "/path/to/your/project/payment.go"
}
```
6. **`list_package_exports`** - Structured list: symbol names, types, signatures. **Go, PHP, Python.**
```json
{
"package": "github.com/myapp/auth",
"file_path": "/path/to/your/project/auth/handler.go"
}
```
7. **`search_docs`** - Doc snippets with file paths. **Markdown only. Not for code.**
```json
{
"query": "API authentication",
"file_path": "/path/to/your/project/README.md"
}
```
8. **`get_code_context`** - Code snippet with configurable context lines. **Any text file.**
```json
{
"file_path": "/path/to/your/project/auth.go",
"start_line": 45,
"end_line": 60
}
```
9. **`index_workspace`** - Reindex codebase. **USUALLY AUTOMATIC.** Call after git pull/branch switch. **Go, PHP, Python, HTML.**
```json
{
"file_path": "/path/to/your/project/main.go"
}
```
### 📌 **IMPORTANT:** All tools require `file_path`!
RagCode automatically detects the workspace from `file_path`. Ensure you provide a valid path from your project.
---
## 🔄 Automatic Indexing
**RagCode automatically indexes the workspace on first use!**
When you call a tool (e.g., `search_code`) for the first time in a workspace:
1. ✅ Detects workspace from `file_path`
2. ✅ Creates a Qdrant collection for that workspace + language
3. ✅ Indexes code in background
4. ✅ Returns results (even if indexing is not complete)
**You do not need to run `index_workspace` manually** - it happens automatically!
---
## 🛠️ Advanced Configuration
### Change AI Models
Edit `~/.local/share/ragcode/config.yaml`:
```yaml
llm:
provider: "ollama"
base_url: "http://localhost:11434"
model: "phi3:medium" # Change to another model
embed_model: "mxbai-embed-large" # Change embedding model
```
Recommended models:
- **LLM:** `phi3:medium`, `llama3.1:8b`, `qwen2.5:7b`
- **Embeddings:** `mxbai-embed-large`, `all-minilm`