Code Context (Semantic Code Search)

by fkesheh

5 stars
185 downloads
Not rated
GitHub

About

Enables semantic code search and understanding by cloning git repositories, splitting code into semantic chunks, and generating embeddings for natural language querying of large codebases

Details

Author
fkesheh
Repository
fkesheh/code-context-mcp
GitHub stars
5
Downloads
185
License
MIT License
Categories
Developer Tools, Other, Design, File Management, AI, Search, Frontend, Database

- Uses local git repositories instead of GitHub API
- Stores data in SQLite database
- Splits code into semantic chunks
- Generates embeddings for code chunks using Ollama
- Provides semantic search over code

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Code Context (Semantic Code Search)
    Command (node, npx, python, etc.) /path/to/your/node
    Arguments
    • Argument 1 /path/to/code-context-mcp/dist/index.js

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

npm install

npm uninstall better-sqlite3
export npm_config_arch=arm64
export npm_config_target_arch=arm64
npm install better-sqlite3 --build-from-source


If you're using Rosetta, make sure your entire environment is consistent. Your error shows x86_64 binaries being built but your system needs arm64.
For persistent configuration, add to your .zshrc or .bashrc:


export npm_config_arch=arm64
export npm_config_target_arch=arm64
```

queryRepo

Clones a repository, processes code, and performs semantic search. Parameters: repoUrl (string), branch (optional string), query (string), keywords (optional array of strings), filePatterns (optional array of strings), excludePatterns (optional array of strings), limit (optional integer)

The server provides the following tool:

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "code context (semantic code search)": {
            "env": {},
            "args": [
                "/path/to/code-context-mcp/dist/index.js"
            ],
            "shell": false,
            "command": "/path/to/your/node"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "/path/to/code-context-mcp/dist/index.js"
    ],
    "command": "/path/to/your/node"
}

Macos

{
    "env": [],
    "args": [
        "/path/to/code-context-mcp/dist/index.js"
    ],
    "shell": false,
    "command": "/path/to/your/node"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "/path/to/your/node",
        "/path/to/code-context-mcp/dist/index.js"
    ],
    "command": "cmd"
}

Provides code context from local git repositories.

A Model Context Protocol (MCP) server for providing code context from local git repositories. This server allows you to:
- Clone git repositories locally
- Process branches and files
- Generate embeddings for code chunks
- Perform semantic search over code

- Uses local git repositories instead of GitHub API
- Stores data in SQLite database
- Splits code into semantic chunks
- Generates embeddings for code chunks using Ollama
- Provides semantic search over code

- Node.js (v16+)
- Git
- Ollama with an embedding model

# Clone the repository git clone <repository-url> cd code-context-mcp # Install dependencies npm install # Build the project npm run build

Set the following environment variables:

- DATA_DIR: Directory for SQLite database (default: '~/.codeContextMcp/data')
- REPO_CACHE_DIR: Directory for cloned repositories (default: '~/.codeContextMcp/repos')

For faster and more powerful embeddings, you can use Ollama:

# Install Ollama from https://ollama.ai/ # Pull an embedding model (unclemusclez/jina-embeddings-v2-base-code is recommended) ollama pull unclemusclez/jina-embeddings-v2-base-code

Add the following configuration to your Claude Desktop configuration file (claude_desktop_config.json):

{ "mcpServers": { "code-context-mcp": { "command": "/path/to/your/node", "args": ["/path/to/code-context-mcp/dist/index.js"] } } }

Clones a repository, processes code, and performs semantic search:

{ "repoUrl": "https://github.com/username/repo.git", "branch": "main", // Optional - defaults to repository's default branch "query": "Your search query", "keywords": ["keyword1", "keyword2"], // Optional - filter results by keywords "filePatterns": ["/.ts", "src/.js"], // Optional - filter files by glob patterns "excludePatterns": ["/node_modules/"], // Optional - exclude files by glob patterns "limit": 10 // Optional - number of results to return, default: 10 }

Thebranchparameter is optional. If not provided, the tool will automatically use the repository's default branch.

Thekeywordsparameter is optional. If provided, the results will be filtered to only include chunks that contain at least one of the specified keywords (case-insensitive matching).

ThefilePatternsandexcludePatternsparameters are optional. They allow you to filter which files are processed and searched using glob patterns (e.g.,/*.tsfor all TypeScript files).

The server uses SQLite with the following schema:

- repository: Stores information about repositories
- branch: Stores information about branches
- file: Stores information about files
- branch_file_association: Associates files with branches
- file_chunk: Stores code chunks and their embeddings

When installing better-sqlite3 on Mac M-series chips (ARM architecture), if you encounter errors like "mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')", you need to ensure the binary matches your architecture. Here's how to resolve this issue:

# Check your Node.js architecture node -p "process.arch" # If it shows 'arm64', but you're still having issues, try: npm rebuild better-sqlite3 --build-from-source # Or for a clean install: npm uninstall better-sqlite3 export npm_config_arch=arm64 export npm_config_target_arch=arm64 npm install better-sqlite3 --build-from-source

If you're using Rosetta, make sure your entire environment is consistent. Your error shows x86_64 binaries being built but your system needs arm64. For persistent configuration, add to your .zshrc or .bashrc:

export npm_config_arch=arm64 export npm_config_target_arch=arm64

curlhttp://localhost:11434/api/embed-d '{"model":"unclemusclez/jina-embeddings-v2-base-code","input":"Llamas are members of the camelid family"}' curlhttp://127.0.01:11434/api/embed-d '{"model":"unclemusclez/jina-embeddings-v2-base-code","input":"Llamas are members of the camelid family"}' curl http://[::1]:11434/api/embed -d '{"model":"unclemusclez/jina-embeddings-v2-base-code","input":"Llamas are members of the camelid family"}'

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Anchor is local repo and org memory for AI coding agents. It indexes GitHub PR history, current code, tests, regressions, architecture, and cross-repo impact locally, then exposes concise cited context through MCP and CLI workflows. Local-first. Read-only GitHub access. No CLI telemetry. No SaaS. No remote LLM calls.

Design system MCP server — query tokens, components, icons, and WCAG contrast data from Git-backed design systems.

Local-first documentation for AI agents. Indexes docs from any git repo into SQLite for offline, instant, private access to up-to-date library documentation.

DOS is a small open-source kernel that doesn't believe your AI agents: it verifies what actually shipped from git evidence, arbitrates file collisions between parallel agents, and refuses with structured reasons.

Prevents regression by providing Blast Radius data to AI based on your git history

Fabrx is a no-code platform where users can setup custom document processing workflows

Model Context Protocol (MCP) server for GitLab — exposes 1006 GitLab REST & GraphQL API operations as MCP tools (28 meta-tools / 43 enterprise), 24 resources, 38 prompts, and 17 completion types for AI assistants. Written in Go, single static binary, stdio and HTTP transport.

kemdiCode MCP is a Model Context Protocol server that gives AI agents and IDE assistants access to 124 specialized tools for code analysis, generation, git operations, file management, AST-aware editing, project memory, cognition & self-improvement, multi-board kanban, and multi-agent coordination.

Lix Agent Version Control is a paid hosted remote MCP for Lix. It exposes Streamable HTTP tool calls, bearer-token access, public server-card metadata, usage logs, and receipt-oriented JSON

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.