1. Conduid
  2. Developer Tools
  3. code-context
MCP server · Developer Tools

code-context

Model Context Protocol integration for Code Context

67Good

Scored yesterday · breakdown

About code-context

code-context is an MCP server published by git+tan-yong-sheng in the Developer Tools category: model Context Protocol integration for Code Context.

The repository has 13K stars and 0 forks, with the last commit 3 months ago. Recent commit activity is the strongest signal that reported issues will get attention.

Install

Claude Code
claude mcp add code-context -- npx -y @zilliz/code-context-mcp
npx
npx -y @zilliz/code-context-mcp

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about code-context

Powered by Claude · Grounded in docs

I know everything about code-context. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ✓README presentThe repository ships documentation.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

4 checks have not been run yet.

README

Your entire codebase as Claude's context

Note: This project is a fork of Code Context: https://github.com/zilliztech/code-context to replace the milvus vector database to sqlite

License Node.js Documentation npm - core npm - mcp DeepWiki

Code Context is an MCP plugin that adds semantic code search to Claude Code and other AI coding agents, giving them deep context from your entire codebase.

🧠 Your Entire Codebase as Context: Code Context uses semantic search to find all relevant code from millions of lines. No multi-round discovery needed. It brings results straight into the Claude's context.

💰 Cost-Effective for Large Codebases: Instead of loading entire directories into Claude for every request, which can be very expensive, Code Context efficiently stores your codebase in a vector database and only uses related code in context to keep your costs manageable.


Quick Start

Prerequisites

You need an OpenAI API key for the embedding model. You can get one by signing up at OpenAI.

Your API key will look like this: it always starts with sk-.
Copy your key and use it in the configuration examples below as your-openai-api-key.

Configure MCP for Claude Code

System Requirements:

  • Node.js >= 20.0.0 and < 24.0.0

Code Context is not compatible with Node.js 24.0.0, you need downgrade it first if your node version is greater or equal to 24.

Configuration

Use the command line interface to add the Code Context MCP server:

claude mcp add code-context \
  -e OPENAI_API_KEY=sk-your-openai-api-key \
  -- npx @tan-yong-sheng/code-context-mcp@latest

See the Claude Code MCP documentation for more details about MCP server management.

Other MCP Client Configurations

Codex CLI uses TOML configuration files:

  1. Create or edit the ~/.codex/config.toml file.

  2. Add the following configuration:

# IMPORTANT: the top-level key is `mcp_servers` rather than `mcpServers`.
[mcp_servers.code-context]
command = "npx"
args = ["@tan-yong-sheng/code-context-mcp@latest"]
env = { "OPENAI_API_KEY" = "your-openai-api-key" }
# Optional: override the default 10s startup timeout
startup_timeout_ms = 20000
  1. Save the file and restart Codex CLI to apply the changes.

Gemini CLI requires manual configuration through a JSON file:

  1. Create or edit the ~/.gemini/settings.json file.
  2. Add the following configuration:
{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["@tan-yong-sheng/code-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}
  1. Save the file and restart Gemini CLI to apply the changes.

Create or edit the ~/.qwen/settings.json file and add the following configuration:

{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["@tan-yong-sheng/code-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}

Go to: Settings -> Cursor Settings -> MCP -> Add new global MCP server

Pasting the following configuration into your Cursor ~/.cursor/mcp.json file is the recommended approach. You may also install in a specific project by creating .cursor/mcp.json in your project folder. See Cursor MCP docs for more info.

{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["-y", "@tan-yong-sheng/code-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}

Go to: Settings -> MCP -> Add MCP Server

Add the following configuration to your Void MCP settings:

{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["-y", "@tan-yong-sheng/code-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["@tan-yong-sheng/code-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}

Windsurf supports MCP configuration through a JSON file. Add the following configuration to your Windsurf MCP settings:

{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["-y", "@tan-yong-sheng/code-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}

The Code Context MCP server can be used with VS Code through MCP-compatible extensions. Add the following configuration to your VS Code MCP settings:

{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["-y", "@tan-yong-sheng/code-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}

Cherry Studio allows for visual MCP server configuration through its settings interface. While it doesn't directly support manual JSON configuration, you can add a new server via the GUI:

  1. Navigate to Settings → MCP Servers → Add Server.
  2. Fill in the server details:
    • Name: code-context
    • Type: STDIO
    • Command: npx
    • Arguments: ["@tan-yong-sheng/code-context-mcp@latest"]
    • Environment Variables:
      • OPENAI_API_KEY: your-openai-api-key
  3. Save the configuration to activate the server.

Cline uses a JSON configuration file to manage MCP servers. To integrate the provided MCP server configuration:

  1. Open Cline and click on the MCP Servers icon in the top navigation bar.

  2. Select the Installed tab, then click Advanced MCP Settings.

  3. In the cline_mcp_settings.json file, add the following configuration:

{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["@tan-yong-sheng/code-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}
  1. Save the file.

To configure Code Context MCP in Augment Code, you can use either the graphical interface or manual configuration.

A. Using the Augment Code UI

  1. Click the hamburger menu.

  2. Select Settings.

  3. Navigate to the Tools section.

  4. Click the + Add MCP button.

  5. Enter the following command:

    npx @tan-yong-sheng/code-context-mcp@latest
    
  6. Name the MCP: Code Context.

  7. Click the Add button.


B. Manual Configuration

  1. Press Cmd/Ctrl Shift P or go to the hamburger menu in the Augment panel
  2. Select Edit Settings
  3. Under Advanced, click Edit in settings.json
  4. Add the server configuration to the mcpServers array in the augment.advanced object
"augment.advanced": {
  "mcpServers": [
    {
      "name": "code-context",
      "command": "npx",
      "args": ["-y", "@tan-yong-sheng/code-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  ]
}

Roo Code utilizes a JSON configuration file for MCP servers:

  1. Open Roo Code and navigate to Settings → MCP Servers → Edit Global Config.

  2. In the mcp_settings.json file, add the following configuration:

{
  "mcpServers": {
    "code-context": {
      "command": "npx",
      "args": ["@tan-yong-sheng/code-context-mcp@latest"],
      "env": {
        "OPENAI_API_KEY": "your-openai-api-key"
      }
    }
  }
}
  1. Save the file to activate the server.

Zencoder offers support for MCP tools and servers in both its JetBrains and VS Code plugin versions.

  1. Go to the Zencoder menu (...)
  2. From the dropdown menu, select Tools
  3. Click on the Add Custom MCP
  4. Add the name (i.e. Code Context and server configuration from below, and make sure to hit the Install button
{
    "command": "npx",
    "args": ["@tan-yong-sheng/code-context-mcp@latest"],
    "env": {
      "OPENAI_API_KEY": "your-openai-api-key"
    }
}

  1. Save the server by hitting the Install button.

For LangChain/LangGraph integration examples, see this example.

The server uses stdio transport and follows the standard MCP protocol. It can be integrated with any MCP-compatible client by running:

npx @tan-yong-sheng/code-context-mcp@latest

Usage in Your Codebase

  1. Open Claude Code

    cd your-project-directory
    claude
    
  2. Index your codebase:

    Index this codebase
    
  3. Check indexing status:

    Check the indexing status
    
  4. Start searching:

    Find functions that handle user authentication
    

🎉 That's it! You now have semantic code search in Claude Code.


Environment Variables Configuration

For more detailed MCP environment variable configuration, see our Environment Variables Guide.

Using Different Embedding Models

To configure custom embedding models (e.g., text-embedding-3-large for OpenAI, voyage-code-3 for VoyageAI), see the MCP Configuration Examples for detailed setup instructions for each provider.

File Inclusion & Exclusion Rules

For detailed explanation of file inclusion and exclusion rules, and how to customize them, see our File Inclusion & Exclusion Rules.

Available Tools

1. index_codebase

Index a codebase directory for hybrid search (BM25 + dense vector).

2. search_code

Search the indexed codebase using natural language queries with hybrid search (BM25 + dense vector).

3. clear_index

Clear the search index for a specific codebase.

4. get_indexing_status

Get the current indexing status of a codebase. Shows progress percentage for actively indexing codebases and completion status for indexed codebases.


🏗️ Architecture

🔧 Implementation Details

  • 🔍 Hybrid Code Search: Ask questions like "find functions that handle user authentication" and get relevant, context-rich code instantly using advanced hybrid search (BM25 + dense vector).
  • 🧠 Context-Aware: Discover large codebase, understand how different parts of your codebase relate, even across millions of lines of code.
  • ⚡ Incremental Indexing: Efficiently re-index only changed files using Merkle trees.
  • 🧩 Intelligent Code Chunking: Analyze code in Abstract Syntax Trees (AST) for chunking.
  • 🗄️ Local-First: Uses sqlite-vec for local vector storage - no external database needed, works offline.
  • 🛠️ Customizable: Configure file extensions, ignore patterns, and embedding models.

Core Components

Code Context is a monorepo containing two main packages:

  • @tan-yong-sheng/code-context-core: Core indexing engine with embedding and vector database integration
  • @tan-yong-sheng/code-context-mcp: Model Context Protocol server for AI agent integration

And it also has a VSCode extension here: https://marketplace.visualstudio.com/items?itemName=tan-yong-sheng.ai-code-context

Supported Technologies

  • Embedding Providers: OpenAI, VoyageAI, Ollama, Gemini
  • Vector Database: sqlite-vec (local SQLite-based vector database - zero config!)
  • Code Splitters: AST-based splitter (with automatic fallback), LangChain character-based splitter
  • Languages: TypeScript, JavaScript, Python, Java, C++, C#, Go, Rust, PHP, Ruby, Swift, Kotlin, Scala, Markdown
  • Development Tools: VSCode, Model Context Protocol

📦 Other Ways to Use Code Context

While MCP is the recommended way to use Code Context with AI assistants, you can also use it directly via the Core Package.

Build Applications with Core Package

The @tan-yong-sheng/code-context-core package provides the fundamental functionality for code indexing and semantic search.

import { Context, SqliteVecVectorDatabase, OpenAIEmbedding } from '@tan-yong-sheng/code-context-core';

// Initialize embedding provider
const embedding = new OpenAIEmbedding({
    apiKey: process.env.OPENAI_API_KEY || 'your-openai-api-key',
    model: 'text-embedding-3-small'
});

// Initialize vector database (sqlite-vec - zero config!)
const vectorDatabase = new SqliteVecVectorDatabase();

// Create context instance
const context = new Context({
    embedding,
    vectorDatabase
});

// Index your codebase with progress tracking
const stats = await context.indexCodebase('./your-project', (progress) => {
    console.log(`${progress.phase} - ${progress.percentage}%`);
});
console.log(`Indexed ${stats.indexedFiles} files, ${stats.totalChunks} chunks`);

// Perform semantic search
const results = await context.semanticSearch('./your-project', 'vector database operations', 5);
results.forEach(result => {
    console.log(`File: ${result.relativePath}:${result.startLine}-${result.endLine}`);
    console.log(`Score: ${(result.score * 100).toFixed(2)}%`);
    console.log(`Content: ${result.content.substring(0, 100)}...`);
});

🛠️ Development

Setup Development Environment

Prerequisites

  • Node.js 20.x or 22.x
  • pnpm (recommended package manager)

Cross-Platform Setup

# Clone repository
git clone https://github.com/tan-yong-sheng/code-context.git
cd code-context

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Start development mode
pnpm dev

Windows-Specific Setup

On Windows, ensure you have:

  • Git for Windows with proper line ending configuration
  • Node.js installed via the official installer or package manager
  • pnpm installed globally: npm install -g pnpm
# Windows PowerShell/Command Prompt
git clone https://github.com/tan-yong-sheng/code-context.git
cd code-context

# Configure git line endings (recommended)
git config core.autocrlf false

# Install dependencies
pnpm install

# Build all packages (uses cross-platform scripts)
pnpm build

# Start development mode
pnpm dev

Building

# Build all packages (cross-platform)
pnpm build

# Build specific package
pnpm build:core
pnpm build:mcp

# Performance benchmarking
pnpm benchmark

Windows Build Notes

  • All build scripts are cross-platform compatible using rimraf
  • Build caching is enabled for faster subsequent builds
  • Use PowerShell or Command Prompt - both work equally well

Running Examples

# Development with file watching
cd examples/basic-usage
pnpm dev

📖 Examples

Check the /examples directory for complete usage examples:

  • Basic Usage: Simple indexing and search example

❓ FAQ

Common Questions:

❓ For detailed answers and more troubleshooting tips, see our FAQ Guide.

🔧 Encountering issues? Visit our Troubleshooting Guide for step-by-step solutions.

📚 Need more help? Check out our complete documentation for detailed guides and troubleshooting tips.


🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details on how to get started.

Package-specific contributing guides:


🗺️ Roadmap

  • AST-based code analysis for improved understanding
  • Support for additional embedding providers
  • Agent-based interactive search mode
  • Enhanced code chunking strategies
  • Search result ranking optimization

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🔗 Links

README copy captured when this server was indexed; it may lag the repository. The original is authoritative.

Questions

About code-context

How do I install code-context?

Run claude mcp add code-context -- npx -y @zilliz/code-context-mcp, then add the server to your MCP client's configuration.

Is code-context safe to use with an AI agent?

Its trust score is 67 out of 100 (good). It passes 1 of the 2 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is code-context still maintained?

Yes — the last commit was 3 months ago. The repository has 13K stars and 0 forks.