Code Context MCP Server
by fkesheh
A Model Context Protocol (MCP) server for providing code context from local git repositories. It allows you to clone, process, and semantically search code within git repositories.
Last updated: N/A
What is Code Context MCP Server?
Code Context MCP Server is a server that provides code context from local git repositories. It clones repositories, processes branches and files, generates embeddings for code chunks, and performs semantic search over the code.
How to use Code Context MCP Server?
- Clone the repository.
- Install dependencies using
npm install
. - Build the project using
npm run build
. - Configure environment variables like
DATA_DIR
andREPO_CACHE_DIR
. - Optionally, install and configure Ollama for faster embeddings.
- Add the server configuration to your Claude Desktop configuration file.
- Use the
queryRepo
tool to clone repositories, process code, and perform semantic search.
Key features of Code Context MCP Server
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
Use cases of Code Context MCP Server
Semantic code search within a project
Providing code context to language models
Analyzing codebases for specific patterns or keywords
Integrating with Claude Desktop for enhanced code understanding
FAQ from Code Context MCP Server
What is the purpose of this server?
What is the purpose of this server?
To provide code context from local git repositories for semantic search and integration with tools like Claude Desktop.
What are the prerequisites for running this server?
What are the prerequisites for running this server?
Node.js (v16+), Git, and Ollama with an embedding model.
How do I configure the server?
How do I configure the server?
Set the environment variables DATA_DIR
and REPO_CACHE_DIR
. Optionally, configure Ollama for embeddings.
How do I perform a semantic search?
How do I perform a semantic search?
Use the queryRepo
tool with the repository URL, branch (optional), query, keywords (optional), and file patterns (optional).
What database does the server use?
What database does the server use?
The server uses SQLite to store information about repositories, branches, files, and code chunks.