
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
code-context-mcp
Advanced tools
MCP server for semantic code search powered by MongoDB Atlas Vector Search and Voyage AI embeddings
An MCP (Model Context Protocol) server that provides semantic code search capabilities to AI assistants using MongoDB Atlas Vector Search and Voyage AI embeddings.
MongoDB Atlas Account (Free tier available)
Voyage AI API Key (200M tokens free)
# Install globally
npm install -g code-context-mcp
# Or use npx (recommended)
npx code-context-mcp
Add to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"code-context": {
"command": "npx",
"args": ["code-context-mcp"],
"env": {
"MONGODB_URI": "mongodb+srv://username:password@cluster.mongodb.net/",
"VOYAGE_API_KEY": "va_xxx"
}
}
}
}
Add to ~/.cursor/mcp.json
:
{
"mcpServers": {
"code-context": {
"command": "npx",
"args": ["code-context-mcp"],
"env": {
"MONGODB_URI": "mongodb+srv://...",
"VOYAGE_API_KEY": "va_xxx"
}
}
}
}
Add to your Windsurf configuration:
{
"mcpServers": {
"code-context": {
"command": "npx",
"args": ["code-context-mcp"],
"env": {
"MONGODB_URI": "mongodb+srv://...",
"VOYAGE_API_KEY": "va_xxx"
}
}
}
}
The MCP server provides the following tools to AI assistants:
index_codebase
Index a codebase for semantic search.
{
"path": "/path/to/project",
"name": "my-project"
}
search_code
Search for code semantically.
{
"projectPath": "/path/to/project",
"query": "authentication middleware",
"limit": 10,
"threshold": 0.7
}
get_file_content
Retrieve specific file content.
{
"projectPath": "/path/to/project",
"relativePath": "src/auth.ts",
"startLine": 10,
"endLine": 50
}
list_indexed_projects
List all indexed projects.
clear_index
Clear the index for a project.
{
"projectPath": "/path/to/project"
}
get_project_stats
Get statistics about an indexed project.
{
"projectPath": "/path/to/project"
}
Variable | Description | Required | Default |
---|---|---|---|
MONGODB_URI | MongoDB Atlas connection string | ✅ | - |
VOYAGE_API_KEY | Voyage AI API key | ✅ | - |
MONGODB_DATABASE | Database name | ❌ | code_context |
MONGODB_COLLECTION | Collection name | ❌ | embeddings |
VOYAGE_MODEL | Voyage AI model | ❌ | voyage-3.5 |
BATCH_SIZE | Embedding batch size | ❌ | 10 |
MAX_FILE_SIZE | Max file size (MB) | ❌ | 10 |
Model | Best For | Performance |
---|---|---|
voyage-context-3 | RAG systems, long documents | +14.24% vs OpenAI |
voyage-3-large | Highest accuracy | +9.74% vs OpenAI |
voyage-3.5 | General purpose (default) | +8.26% vs OpenAI |
voyage-3.5-lite | High throughput | +6.34% vs OpenAI |
voyage-code-3 | Source code | Best for code |
In MongoDB Atlas:
{
"fields": [{
"type": "vector",
"path": "embedding",
"numDimensions": 1024,
"similarity": "cosine"
}]
}
For MongoDB 8.0+, create both vector and text indexes:
{
"mappings": {
"fields": {
"embedding": {
"type": "knnVector",
"dimensions": 1024,
"similarity": "cosine"
},
"content": {
"type": "string",
"analyzer": "lucene.standard"
}
}
}
}
Based on 2025 benchmarks:
Once configured, you can use natural language commands:
"Index my TypeScript project at /Users/me/my-project"
"Search for authentication middleware in my-project"
"Show me the implementation of the UserService class"
"Find all database connection code"
"What files handle error logging?"
MongoDB Connection Failed
Voyage AI Authentication Failed
MCP Not Responding
Set DEBUG=true
in environment variables for verbose logging:
{
"env": {
"DEBUG": "true",
"MONGODB_URI": "...",
"VOYAGE_API_KEY": "..."
}
}
Contributions are welcome! Please see our Contributing Guide.
MIT License - see LICENSE for details.
Built with 💚 by MongoDB and Voyage AI
FAQs
MCP server for semantic code search powered by MongoDB Atlas Vector Search and Voyage AI embeddings
The npm package code-context-mcp receives a total of 7 weekly downloads. As such, code-context-mcp popularity was classified as not popular.
We found that code-context-mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.