Skip to main content
Glama

MCP Code Expert System

by tomsiwik

MCP代码专家系统

一个基于 Python 的代码审查系统,使用模型上下文协议 (MCP)。它通过模拟专家角色(例如 Martin Fowler 和 Robert C. Martin(鲍勃叔叔))提供代码审查功能。

特征

  • 根据 Martin Fowler 的重构原则进行代码审查
  • 根据 Robert C. Martin 的清洁代码原则进行代码审查
  • 代码、评论和关系的知识图谱存储
  • 与 Ollama 集成,实现人工智能评论
  • Web 集成的服务器端事件 (SSE) 支持

先决条件

Python 3.10+

该项目需要 Python 3.10 或更高版本。

奥拉马

人工智能代码审查需要Ollama

  1. 为您的平台安装 Ollama:
    • macOS :从ollama.com下载
    • Linuxcurl -fsSL https://ollama.com/install.sh | sh
    • Windows :通过 Linux 指令支持 Windows WSL2
  2. 拉个推荐模型:
    ollama pull llama3:8b
  3. 启动 Ollama 服务器:
    ollama serve

安装

运行安装脚本来安装依赖项并创建虚拟环境:

chmod +x setup.sh ./setup.sh

配置

编辑.env文件进行配置(如果需要,可以从.env.example创建):

# Knowledge Graph Settings KNOWLEDGE_GRAPH_PATH=data/knowledge_graph.json # Ollama Configuration (local AI models) OLLAMA_HOST=http://localhost:11434 OLLAMA_MODEL=llama3:8b

用法

运行服务器

标准模式(用于光标集成)
source .venv/bin/activate python server.py
HTTP/SSE 模式(用于 Web 集成)
source .venv/bin/activate python server.py --transport sse

这将在http://localhost:8000/sse启动服务器以进行 SSE 传输。

对于自定义端口:

python server.py --transport sse --port 9000

在光标处安装

要在 Cursor IDE 中安装:

source .venv/bin/activate mcp install server.py --name "Code Expert System"

可用工具

服务器公开了这些工具:

  • ask_martin :请 Martin Fowler 审查代码并提出重构建议
  • ask_bob :请 Robert C. Martin(鲍勃大叔)根据清洁代码原则审查代码
  • read_graph :读取整个知识图谱
  • search_nodes :搜索知识图谱中的节点
  • open_nodes :通过名称打开特定节点

示例用法

与 Martin Fowler 一起审查代码片段:

{ "code": "function calculateTotal(items) {\n var total = 0;\n for (var i = 0; i < items.length; i++) {\n total += items[i].price;\n }\n return total;\n}", "language": "javascript", "description": "Calculate the total price of items" }

项目结构

  • server.py :集成 MCP 的主服务器实现
  • experts/ :实现代码审查功能的专家模块
    • __init__.py :共享模型和接口
    • martin_fowler/ :Martin Fowler 专家实施
    • robert_c_martin/ :Robert C. Martin 专家实施
  • knowledge_graph.py :用于存储代码和评论的知识图谱
  • ollama_service.py :与 Ollama 集成,实现 AI 驱动的评论
  • examples/ :用于审查不同语言的示例代码
  • requirements.txt :Python 依赖项
  • setup.sh :安装脚本

建筑学

该系统采用模块化架构:

  1. 服务器层:处理 MCP 协议通信并路由请求
  2. 专家层:封装每个专家的代码审查逻辑
  3. 服务层:提供AI集成和知识图谱功能

每个专家都实现了一个标准接口,允许一致处理和轻松添加新专家。

执照

麻省理工学院

-
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.

这是一个基于 Python 的系统,使用模型上下文协议 (MCP),通过 Martin Fowler 和 Robert C. Martin 等模拟专家角色提供 AI 驱动的代码审查。

  1. 特征
    1. 先决条件
      1. Python 3.10+
      2. 奥拉马
    2. 安装
      1. 配置
        1. 用法
          1. 运行服务器
          2. 在光标处安装
          3. 可用工具
          4. 示例用法
        2. 项目结构
          1. 建筑学
            1. 执照

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                Provides access to Perplexity AI models through two tools: ask\_perplexity for expert programming assistance and chat\_perplexity for maintaining ongoing conversations with context preservation.
                Last updated -
                Python
                MIT License
                • Linux
                • Apple
              • -
                security
                A
                license
                -
                quality
                An MCP server that analyzes codebases and generates contextual prompts, making it easier for AI assistants to understand and work with code repositories.
                Last updated -
                10
                Python
                MIT License
              • -
                security
                F
                license
                -
                quality
                A server that implements the Model Context Protocol (MCP) for orchestrating code reviews using a multi-agent system with Melchior, Balthasar, and Casper agents.
                Last updated -
                Python
              • -
                security
                -
                license
                -
                quality
                A Model Context Protocol (MCP) connector that allows AI agents to directly interact with Google Sheets, enabling creation, reading, and modification of spreadsheets through natural language.
                Last updated -
                23
                JavaScript
                MIT License

              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/tomsiwik/mcp-experts'

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