Code Embeddings MCP server

A knowledge management tool for code repositories using vector embeddings.
Back to servers
Provider
David VC
Release date
Feb 17, 2025
Language
Python
Stats
10 stars

The Code Knowledge Tool provides a vector-based knowledge management system for code repositories. It helps you maintain and query knowledge about your codebase using advanced embedding techniques, making it easier to understand and work with complex codebases.

Installation

Prerequisites

Ensure Ollama is installed and running:

# Install Ollama (if not already installed)
curl https://ollama.ai/install.sh | sh

# Start Ollama service
ollama serve

Building and Installing the Package

First, build the distribution files:

# Clone the repository
git clone https://github.com/yourusername/code-knowledge-tool.git
cd code-knowledge-tool

# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate

# Install build tools
python -m pip install --upgrade pip build

# Build the package
python -m build

This process creates two files in the dist/ directory:

  • code_knowledge_tool-0.1.0-py3-none-any.whl (wheel file for installation)
  • code_knowledge_tool-0.1.0.tar.gz (source distribution)

Installing the Built Package

# Navigate to where you built the package
cd /path/to/code_knowledge_tool

# Install from the wheel file
pip install dist/code_knowledge_tool-0.1.0-py3-none-any.whl

Integration with RooCode/Cline

Setting Up MCP Configuration

  1. For Cline (VSCode):
# Open the settings file
open ~/Library/Application\ Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json

Add this configuration:

{
  "mcpServers": {
    "code_knowledge": {
      "command": "python",
      "args": ["-m", "code_knowledge_tool.mcp_tool"],
      "env": {
        "PYTHONPATH": "${workspaceFolder}"
      }
    }
  }
}
  1. For RooCode:
# Open the settings file
open ~/Library/Application\ Support/RooCode/roocode_config.json

Add the same configuration as above.

  1. Restart RooCode/Cline to load the new tool.

Using as Memory Bank and RAG Context Provider

To set up the tool as your project's memory bank:

  1. Copy the provided template to your project:
cp clinerules_template.md /path/to/your/project/.clinerules
  1. Customize the rules and patterns in .clinerules for your project's needs

The template includes comprehensive instructions for:

  • Knowledge base management
  • RAG-based development workflows
  • Code quality guidelines
  • Memory management practices

Features and Requirements

Key Features

  • Local vector storage for code knowledge
  • Efficient embedding generation using Ollama
  • Support for multiple file types
  • Context-aware code understanding
  • Integration with RooCode and Cline via MCP
  • RAG-based context augmentation
  • Persistent knowledge storage

System Requirements

  • Python 3.8 or higher
  • Ollama service running locally
  • chromadb for vector operations

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later