Back to MCP directory
publicPublicdnsLocal runtime

wp-code-review-mcp-server

一个轻量级、可配置的MCP服务器,用于开发团队获取外部托管的编码规范、安全规则和验证模式。

article

README

🚀 WordPress代码审查MCP服务器v2.0

这是一款轻量级、可配置的MCP(模型上下文协议)服务器,专为开发团队打造。它能够从外部源或你托管自定义指南的URL获取编码规范、安全规则和验证模式。

🚀 快速开始

WordPress代码审查MCP服务器v2.0为开发团队提供了便捷的代码审查和规范管理功能。通过以下步骤,你可以快速搭建并使用该服务器。

✨ 主要特性

  • 无硬编码规则:可从任意URL获取指南。
  • 动态配置:通过环境变量指定数据源。
  • 自定义验证:添加你自己的编码标准和安全规则。
  • 轻量级:依赖外部指南,代码库精简。

📋 可用工具

  • get_guidelines:按类别获取开发指南。
  • validate_code:根据配置的标准验证代码。
  • security_check:进行安全漏洞扫描。

📦 安装指南

步骤1:克隆仓库

git clone https://github.com/miniOrangeDev/wp-code-review-mcp-server.git
cd wp-code-review-mcp

步骤2:安装依赖并构建

npm install
npm run build

步骤3:托管你的指南

sample-guidelines/html/ 中的文件托管到你的Web服务器上,并配置基础URL,例如:https://yourdomain.com/guidelines/

MCP服务器将获取以下文件:

  • https://yourdomain.com/guidelines/guidelines.md
  • https://yourdomain.com/guidelines/validation-rules.md
  • https://yourdomain.com/guidelines/security-rules.md

步骤4:配置Cursor

在你的Cursor设置中添加以下内容(Ctrl + Shift + P → “Preferences: Open User Settings (JSON)”):

{
  "mcpServers": {
    "wp-code-review-mcp": {
      "command": "node",
      "args": ["/path/to/wp-code-review-mcp-server/build/index.js"],
      "env": {
        "GUIDELINES_URL": "https://yourdomain.com/guidelines"
      }
    }
  }
}

请将 /path/to/wp-code-review-mcp-server 替换为你实际的路径(例如,/home/wp-code-review-mcp-server)。

⚠️ 重要提示

之所以需要指定路径,是因为这是一个本地MCP服务器,与已发布的npm包不同。该路径会告知Cursor确切的已构建服务器文件位置。

如果未看到MCP服务器已连接,请重启Cursor,MCP服务器即可正常使用。

指南格式

你的指南服务器应提供以下文件:

  • /guidelines.md:主要开发指南
  • /validation-rules.md:代码验证规则
  • /security-rules.md:安全扫描规则

步骤5:在Cursor中测试

  1. 在Cursor中打开任意PHP文件。
  2. 向AI提问:“检查此代码是否存在安全问题:class mo_Test {}”。
  3. AI应能检测到短前缀违规!

🔧 技术细节

若遇到配置问题,请参考 配置故障排除指南,其中包含常见错误及解决方案。

📚 详细文档

你可以通过编辑 sample-guidelines/html/ 中的文件来添加你自己的内容:

  • 编码标准
  • 验证规则
  • 安全模式
  • 公司特定的指南

MCP服务器会自动使用更新后的规则,无需重启。

📄 许可证

本项目采用MIT许可证。


为动态、可维护的开发指南而构建 🛡️

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client