Code Knowledge Tool
A knowledge management tool for code repositories using vector embeddings, powered by a local Ollama service.
Code Knowledge Tool
A knowledge management tool for code repositories using vector embeddings. This tool helps maintain and query knowledge about your codebase using advanced embedding techniques.
Building and Installing
1. Build the Package
First, you need to 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 will create 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)
2. Install the Package
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
- Install the package:
Option 1: Install from wheel file (recommended for usage)
# 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
Option 2: Install in editable mode (recommended for development)
This option is best if you want to modify the tool or contribute to its development:
# Assuming you're already in the code-knowledge-tool directory
# and have activated your virtual environment
# Install in editable mode with development dependencies
pip install -e ".[dev]"
Integration with RooCode/Cline
- Copy the MCP configuration to your settings:
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}"
}
}
}
}
For RooCode:
# Open the settings file
open ~/Library/Application\ Support/RooCode/roocode_config.json
Add the same configuration as above.
- Restart RooCode/Cline to load the new tool.
Using as Memory Bank and RAG Context Provider
This tool can serve as your project's memory bank and RAG context provider. To set this up:
- Copy the provided template to your project:
cp clinerules_template.md /path/to/your/project/.clinerules
- 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
See clinerules_template.md for the full configuration and usage details.
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
Requirements
- Python 3.8 or higher
- Ollama service running locally
- chromadb for vector operations
Development
Running Tests
The project follows an integration-first testing approach, focusing on end-to-end functionality and MCP contract compliance. The test suite consists of:
-
MCP Contract Tests
- Tool registration and execution
- Resource management
- Knowledge operations
- Error handling
-
Package Build Tests
- Installation verification
- Dependency resolution
- MCP server initialization
- Basic functionality
To run the tests:
# Install test dependencies
pip install -e ".[dev]"
# Run all tests
pytest
# Run specific test suites
pytest tests/integration/test_mcp_contract.py -v # MCP functionality
pytest tests/integration/test_package_build.py -v # Installation verification
Test Environment Requirements:
# Ensure Ollama is running
ollama serve
The tests use a temporary directory (test_knowledge_store) that is cleaned up automatically between test runs.
For more details on the testing strategy and patterns, see the documentation in docs/.
Future Distribution
If you want to make this package available through pip (i.e., pip install code-knowledge-tool), you would need to:
- Register an account on PyPI
- Install twine:
pip install twine - Upload your distribution:
twine upload dist/*
However, for now, use the local build and installation methods described above.
License
MIT License
관련 서버
Scout Monitoring MCP
스폰서Put performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
스폰서Access financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Package README Core MCP Server
Automatically detects package managers and routes requests to appropriate MCP servers for unified package documentation access.
MCP Tools for Open WebUI
An MCP server for Open WebUI that provides tools for secure Python code execution, time, and SDXL image generation.
Bruno MCP Server
Execute Bruno collections using the Bruno CLI, with support for environment files and detailed test results.
ADT MCP Server
An MCP server for ABAP Development Tools (ADT) that exposes various ABAP repository-read tools over a standardized interface.
Claude Project Coordinator
Manage and coordinate multiple Xcode/Swift projects with features like project tracking, smart search, and analytics.
MCP OAuth Sample
A sample MCP OAuth server implementation using Next.js, providing OAuth 2.1 authentication with Google and PostgreSQL.
DreamFactory MCP
An MCP server for integrating with the DreamFactory API to manage and access data sources.
Limetest
A lightweight, AI-powered end-to-end testing framework for CI workflows. Requires an OpenAI API key.
Laravel Loop
An MCP server for Laravel applications to connect with AI assistants using the MCP protocol.
MCP Dev Utils
A modular and extensible MCP server with essential utilities for developers.