Skip to main content
Glama

Code Knowledge MCP Server

by davidvc

代码知识工具

一个使用向量嵌入的代码库知识管理工具。此工具使用高级嵌入技术,帮助您维护和查询代码库知识。

构建和安装

1. 构建包

首先,您需要构建分发文件:

# 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

这将在 dist/ 目录中创建两个文件:

  • code_knowledge_tool-0.1.0-py3-none-any.whl(安装用wheel文件)
  • code_knowledge_tool-0.1.0.tar.gz(源代码分发)

2.安装软件包

先决条件
  1. 确保 Ollama 已安装并正在运行:
# Install Ollama (if not already installed) curl https://ollama.ai/install.sh | sh # Start Ollama service ollama serve
  1. 安装软件包:
选项 1:从 wheel 文件安装(推荐使用)
# 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
选项 2:以可编辑模式安装(推荐用于开发)

如果您想修改该工具或为其开发做出贡献,那么此选项是最好的:

# 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]"

与 RooCode/Cline 集成

  1. 将 MCP 配置复制到您的设置中:

对于 Cline (VSCode):

# Open the settings file open ~/Library/Application\ Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json

添加此配置:

{ "mcpServers": { "code_knowledge": { "command": "python", "args": ["-m", "code_knowledge_tool.mcp_tool"], "env": { "PYTHONPATH": "${workspaceFolder}" } } } }

对于 RooCode:

# Open the settings file open ~/Library/Application\ Support/RooCode/roocode_config.json

添加与上面相同的配置。

  1. 重新启动 RooCode/Cline 以加载新工具。

用作记忆库和 RAG 上下文提供程序

此工具可用作项目的记忆库和 RAG 上下文提供程序。设置方法如下:

  1. 将提供的模板复制到您的项目中:
cp clinerules_template.md /path/to/your/project/.clinerules
  1. 根据项目需求定制 .clinerules 中的规则和模式

该模板包含以下方面的全面说明:

  • 知识库管理
  • 基于 RAG 的开发工作流程
  • 代码质量指南
  • 内存管理实践

有关完整配置和使用详情,请参阅 clinerules_template.md。

特征

  • 用于代码知识的本地向量存储
  • 使用 Ollama 高效生成嵌入
  • 支持多种文件类型
  • 上下文感知代码理解
  • 通过 MCP 与 RooCode 和 Cline 集成
  • 基于 RAG 的上下文增强
  • 持久知识存储

要求

  • Python 3.8 或更高版本
  • Ollama 服务在本地运行
  • 用于向量运算的 chromadb

发展

运行测试

该项目采用集成优先的测试方法,重点关注端到端功能和 MCP 合同合规性。测试套件包括:

  1. MCP 合同测试
    • 工具注册和执行
    • 资源管理
    • 知识运营
    • 错误处理
  2. 包构建测试
    • 安装验证
    • 依赖关系解析
    • MCP 服务器初始化
    • 基本功能

运行测试:

# 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

测试环境要求:

# Ensure Ollama is running ollama serve

测试使用临时目录(test_knowledge_store),该目录会在测试运行之间自动清理。

有关测试策略和模式的更多详细信息,请参阅docs/中的文档。

未来分布

如果您想通过 pip 使用这个包(即pip install code-knowledge-tool ),您需要:

  1. PyPI上注册一个账户
  2. 安装 twine: pip install twine
  3. 上传你的发行版: twine upload dist/*

但是,目前请使用上面描述的本地构建和安装方法。

执照

MIT 许可证

-
security - not tested
F
license - not found
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

提供项目存储库和 RAG 上下文提供程序,通过矢量嵌入增强代码理解和管理,并与 RooCode 和 Cline 集成。

  1. 构建和安装
    1. 构建包
    2. 2.安装软件包
  2. 与 RooCode/Cline 集成
    1. 用作记忆库和 RAG 上下文提供程序
      1. 特征
        1. 要求
          1. 发展
            1. 运行测试
          2. 未来分布
            1. 执照

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                A VS Code extension provides a MCP server that exposes Roslyn language features. It enables tools like find usages, go to definition, quick info, etc.
                Last updated -
                111
                TypeScript
                AGPL 3.0
                • Linux
                • Apple
              • -
                security
                A
                license
                -
                quality
                A comprehensive code analysis and management tool that integrates with Claude Desktop to analyze code at project and file levels, helping adapt changes to projects intelligently.
                Last updated -
                29
                Python
                MIT License
              • A
                security
                A
                license
                A
                quality
                Chat with your codebase through intelligent code searching without embeddings by breaking files into logical chunks, giving the LLM tools to search these chunks, and letting it find specific code needed to answer your questions.
                Last updated -
                8
                51
                Python
                MIT License
              • -
                security
                F
                license
                -
                quality
                A server component of the Model Context Protocol that provides intelligent analysis of codebases using vector search and machine learning to understand code patterns, architectural decisions, and documentation.
                Last updated -
                4
                Python

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/davidvc/code-knowledge-mcptool'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server