Integrations
Supports environment configuration through .env files, enabling customization of knowledge graph settings and Ollama configuration parameters.
Provides integration with Ollama for AI-powered code reviews using local models, allowing the MCP server to utilize Ollama's capabilities to generate expert code reviews based on different programming principles.
MCP代码专家系统
一个基于 Python 的代码审查系统,使用模型上下文协议 (MCP)。它通过模拟专家角色(例如 Martin Fowler 和 Robert C. Martin(鲍勃叔叔))提供代码审查功能。
特征
- 根据 Martin Fowler 的重构原则进行代码审查
- 根据 Robert C. Martin 的清洁代码原则进行代码审查
- 代码、评论和关系的知识图谱存储
- 与 Ollama 集成,实现人工智能评论
- Web 集成的服务器端事件 (SSE) 支持
先决条件
Python 3.10+
该项目需要 Python 3.10 或更高版本。
奥拉马
人工智能代码审查需要Ollama 。
- 为您的平台安装 Ollama:
- macOS :从ollama.com下载
- Linux :
curl -fsSL https://ollama.com/install.sh | sh
- Windows :通过 Linux 指令支持 Windows WSL2
- 拉个推荐模型:Copy
- 启动 Ollama 服务器:Copy
安装
运行安装脚本来安装依赖项并创建虚拟环境:
Copy
配置
编辑.env
文件进行配置(如果需要,可以从.env.example
创建):
Copy
用法
运行服务器
标准模式(用于光标集成)
Copy
HTTP/SSE 模式(用于 Web 集成)
Copy
这将在http://localhost:8000/sse
启动服务器以进行 SSE 传输。
对于自定义端口:
Copy
在光标处安装
要在 Cursor IDE 中安装:
Copy
可用工具
服务器公开了这些工具:
ask_martin
:请 Martin Fowler 审查代码并提出重构建议ask_bob
:请 Robert C. Martin(鲍勃大叔)根据清洁代码原则审查代码read_graph
:读取整个知识图谱search_nodes
:搜索知识图谱中的节点open_nodes
:通过名称打开特定节点
示例用法
与 Martin Fowler 一起审查代码片段:
Copy
项目结构
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
:安装脚本
建筑学
该系统采用模块化架构:
- 服务器层:处理 MCP 协议通信并路由请求
- 专家层:封装每个专家的代码审查逻辑
- 服务层:提供AI集成和知识图谱功能
每个专家都实现了一个标准接口,允许一致处理和轻松添加新专家。
执照
麻省理工学院
Related MCP Servers
- -securityAlicense-qualityProvides 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 -PythonMIT License
- -securityAlicense-qualityAn MCP server that analyzes codebases and generates contextual prompts, making it easier for AI assistants to understand and work with code repositories.Last updated -2PythonMIT License
- -securityFlicense-qualityA 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-qualityA 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 -23JavaScriptMIT License