This guide explains how to integrate RagCode MCP with Visual Studio Code and GitHub Copilot to enable semantic code search capabilities in Copilot’s agent mode.
RagCode integrates with GitHub Copilot through the Model Context Protocol (MCP), which is a standardized way for AI models to interact with external tools and services. When configured, Copilot can automatically use RagCode’s semantic search tools as part of its autonomous coding workflow.
Before setting up RagCode with VS Code + Copilot, ensure you have:
ragcode-installer from the latest GitHub release (recommended)go run ./cmd/installragcode-installer automatically configures VS Code and creates the MCP entry:
# Linux (amd64) - ONE COMMAND
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
This creates the MCP configuration file at:
~/.config/Code/User/globalStorage/mcp-servers.json
If you need to configure manually or customize the setup:
mkdir -p ~/.config/Code/User/globalStorage
mcp-servers.json:
nano ~/.config/Code/User/globalStorage/mcp-servers.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"
}
}
}
}
Important: Replace YOUR_USERNAME with your actual Linux username.
On Windows, the MCP configuration file is located at:
%APPDATA%\Code\User\mcp.json
Example configuration:
{
"servers": {
"ragcode": {
"command": "C:\\Users\\YOUR_USERNAME\\.local\\share\\ragcode\\bin\\rag-code-mcp.exe",
"args": [],
"env": {
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "phi3:medium",
"OLLAMA_EMBED": "mxbai-embed-large",
"QDRANT_URL": "http://localhost:6333"
}
}
}
}
If you installed RagCode in WSL but use VS Code on Windows:
{
"servers": {
"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"
}
}
}
}
💡 The
localhostURLs work because WSL2 shares network ports with Windows.
MCP: Show MCP Serversragcode appears in the listIn the MCP Servers view, expand the ragcode server to see available tools:
search_codehybrid_searchget_function_detailsfind_type_definitionfind_implementationslist_package_exportssearch_docsget_code_contextindex_workspaceRagCode tools work with GitHub Copilot’s Agent Mode:
/agent in the chatOnce in agent mode, Copilot will automatically use RagCode tools when appropriate:
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
What are all the API endpoints related to user management?
Find where the ProcessPayment function is called
You can explicitly reference RagCode tools using the # symbol:
#ragcode search for payment processing functions
#ragcode find the UserController type definition
#ragcode list all exports from the auth package
cd ~/projects/my-app
code .
Edit the MCP configuration to use different models:
{
"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", // ← Changed
"OLLAMA_EMBED": "all-minilm", // ← Changed
"QDRANT_URL": "http://localhost:6333"
}
}
}
}
Recommended Models:
phi3:mediummxbai-embed-large, all-minilmIf running Ollama or Qdrant on a different machine:
{
"mcpServers": {
"ragcode": {
"command": "/home/YOUR_USERNAME/.local/share/ragcode/bin/rag-code-mcp",
"args": [],
"env": {
"OLLAMA_BASE_URL": "http://192.168.1.100:11434", // ← Remote Ollama
"OLLAMA_MODEL": "phi3:medium",
"OLLAMA_EMBED": "mxbai-embed-large",
"QDRANT_URL": "http://192.168.1.101:6333" // ← Remote Qdrant
}
}
}
}
Enable detailed logging for troubleshooting:
{
"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",
"MCP_LOG_LEVEL": "debug", // ← Enable debug logs
"MCP_LOG_FILE": "/tmp/ragcode-mcp.log" // ← Log file path
}
}
}
}
View logs:
tail -f /tmp/ragcode-mcp.log
Problem: RagCode doesn’t appear in the MCP Servers list.
Solutions:
cat ~/.config/Code/User/globalStorage/mcp-servers.json
Problem: MCP server shows “Disconnected” or “Error” status.
Solutions:
ls -la ~/.local/share/ragcode/bin/rag-code-mcp
chmod +x ~/.local/share/ragcode/bin/rag-code-mcp
docker ps | grep ragcode-qdrant || docker start ragcode-qdrant
ollama list
If not running:
ollama serve
~/.local/share/ragcode/bin/rag-code-mcp --version
Problem: Copilot doesn’t use RagCode tools or tools fail.
Solutions:
/agent# Add logging to config (see Configuration Options above)
tail -f /tmp/ragcode-mcp.log
docker ps | grep qdrant
ollama list
#ragcode search for authentication functions
Problem: Error message “Workspace ‘/path’ is not indexed yet”
Solutions:
index_workspace with a file path from your projectfile_path parameter from your projectProblem: RagCode tools are slow to respond.
Solutions:
"OLLAMA_MODEL": "phi3:mini" // Instead of phi3:medium
~/.local/share/ragcode/config.yaml:
workspace:
exclude_patterns:
- "node_modules"
- "vendor"
- "dist"
- "build"
- ".git"
RagCode automatically handles multiple projects:
ragcode-{workspace-id}-{language}Example:
# Project 1
cd ~/projects/backend-api
code .
# Ask Copilot to index → creates ragcode-abc123-go
# Project 2
cd ~/projects/frontend-app
code .
# Ask Copilot to index → creates ragcode-def456-javascript
RagCode creates separate collections per language:
ragcode-{workspace}-goragcode-{workspace}-phpragcode-{workspace}-pythonragcode-{workspace}-htmlThis improves search accuracy and performance.
You can create .github/copilot-instructions.md in your project to guide Copilot’s use of RagCode:
# Copilot Instructions
When searching for code:
- Always use RagCode semantic search first
- Prefer `hybrid_search` for finding specific function names
- Use `get_function_details` to understand implementation details
- Index the workspace on first use
| Feature | VS Code + Copilot | Windsurf/Cursor | Antigravity |
|---|---|---|---|
| MCP Support | ✅ Agent Mode | ✅ Native | ✅ Native |
| Auto Tool Selection | ✅ | ✅ | ✅ |
| Explicit Tool Invocation | ✅ (#ragcode) | ✅ | ✅ |
| Configuration | JSON file | JSON file | JSON file |
| Setup Complexity | Medium | Easy | Easy |
VS Code Advantages:
Considerations:
If you encounter issues:
Happy coding with RagCode + VS Code + Copilot! 🚀