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.
Ensure Ollama is installed and running:
# Install Ollama (if not already installed)
curl https://ollama.ai/install.sh | sh
# Start Ollama service
ollama serve
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)# 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
# 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}"
}
}
}
}
# Open the settings file
open ~/Library/Application\ Support/RooCode/roocode_config.json
Add the same configuration as above.
To set up the tool as your project's memory bank:
cp clinerules_template.md /path/to/your/project/.clinerules
.clinerules
for your project's needsThe template includes comprehensive instructions for:
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.
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"
]
}
}
}
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.
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.