code-context-mcp

code-context-mcp

Multi-provider embedding MCP server with local Milvus for semantic code search. Works with Claude Code, Cursor, Windsurf, and other MCP-compatible IDEs.

Category
Visit Server

README

Code Context MCP

A multi-provider embedding MCP server with local Milvus for semantic code search. Works with Claude Code, Cursor, Windsurf, and other MCP-compatible IDEs.

Features

  • Multi-provider embeddings: Local Qwen (free), OpenAI, or DeepSeek
  • Dimension mismatch detection: Warns before indexing if dimensions don't match
  • Zero cloud dependency: Use local Qwen for completely offline operation
  • Dual deployment: Docker or local with pnpm

Architecture

┌─────────────────┐     ┌────────────────────┐     ┌─────────────────┐
│  Your Codebase  │────▶│  Embedding Provider │────▶│  Local Milvus   │
│                 │     │  (Qwen/OpenAI/etc) │     │  (Vector Store) │
└─────────────────┘     └────────────────────┘     └─────────────────┘
         │                                                  │
         │         ┌────────────────────────────┐          │
         └────────▶│     code-context-mcp       │◀─────────┘
                   │       (MCP Server)         │
                   └────────────────────────────┘
                            │
              ┌─────────────┴─────────────┐
              ▼             ▼             ▼
        Claude Code      Cursor      Windsurf

Quick Start

Option A: Docker (Recommended)

# 1. Configure
cp .env.example .env
# Edit .env with your settings

# 2. Start all services
docker-compose up -d

# 3. Verify (~60 seconds to initialize)
curl http://localhost:9091/healthz   # Milvus
curl http://localhost:3100/health    # MCP Server

IDE Configuration (Docker):

{
  "mcpServers": {
    "code-context": {
      "url": "http://localhost:3100/sse"
    }
  }
}

Option B: Local Development

# 1. Start only Milvus in Docker
docker-compose up -d milvus

# 2. Install and build
pnpm install
pnpm build

# 3. Configure IDE (see below)

IDE Configuration (Local):

{
  "mcpServers": {
    "code-context": {
      "command": "node",
      "args": ["/path/to/code-context-mcp/dist/index.js"],
      "env": {
        "EMBEDDING_PROVIDER": "qwen-local",
        "QWEN_LOCAL_BASE_URL": "http://172.18.35.123:8001/v1",
        "QWEN_LOCAL_MODEL": "Qwen3-Embedding-4B",
        "MILVUS_ADDRESS": "127.0.0.1:19530"
      }
    }
  }
}

MCP Tools

Tool Description
index_codebase Index a directory into Milvus
search_code Semantic search across indexed code
check_dimensions Check provider/collection dimension compatibility
drop_collection Delete a collection (for re-indexing)
get_provider_info Show current provider configuration

Usage:

index_codebase /path/to/your/project
search_code "authentication logic"
check_dimensions

Embedding Providers

Provider Model Dimensions Cost
qwen-local Qwen3-Embedding-4B 2560 Free
openai text-embedding-3-small 1536 $0.02/1M tokens
openai text-embedding-3-large 3072 $0.13/1M tokens
deepseek deepseek-embedding-v2 768 Paid

Environment Variables

Variable Description Default
EMBEDDING_PROVIDER openai, qwen-local, deepseek openai
MILVUS_ADDRESS Milvus server address 127.0.0.1:19530
DIMENSION_CHECK_ENABLED Check dimensions before indexing true
MCP_TRANSPORT stdio or http stdio
MCP_PORT HTTP port (http mode) 3100

Provider-specific:

Provider Variables
Local Qwen QWEN_LOCAL_BASE_URL, QWEN_LOCAL_MODEL
OpenAI OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_EMBEDDING_MODEL
DeepSeek DEEPSEEK_API_KEY, DEEPSEEK_BASE_URL, DEEPSEEK_EMBEDDING_MODEL

Dimension Mismatch Handling

Different providers produce different dimensions. Switching providers requires re-indexing:

drop_collection code_context confirm=true
index_codebase /path/to/project

Docker Commands

docker-compose up -d              # Start all
docker-compose up -d milvus       # Start only Milvus
docker-compose logs -f            # View logs
docker-compose down               # Stop all
docker-compose down -v            # Reset (delete data)
docker-compose build --no-cache   # Rebuild

Local Development

pnpm install    # Install dependencies
pnpm build      # Build TypeScript
pnpm dev        # Run in dev mode
pnpm start      # Run production build

Project Structure

code-context-mcp/
├── docker-compose.yml      # Milvus + MCP server
├── Dockerfile
├── package.json
├── tsconfig.json
├── .env.example
└── src/
    ├── index.ts            # Entry point (stdio + HTTP)
    ├── config.ts           # Configuration
    ├── providers/          # Embedding providers
    │   ├── base.ts
    │   ├── openai.ts
    │   ├── qwen-local.ts
    │   └── deepseek.ts
    ├── milvus/             # Milvus integration
    │   ├── client.ts
    │   └── dimension-checker.ts
    └── tools/              # MCP tools
        ├── index-codebase.ts
        ├── search-code.ts
        └── check-dimensions.ts

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured