使用说明
Codex MCP服务器
一种MCP(模型上下文协议)服务器,使用OpenAI兼容的LLM来评估其他LLM的输出。它为代码审查、架构设计、UI/UX设计、测试用例和自定义场景提供了专门的评估工具。
特性
-
6评估工具:
evaluate_code_review-评估代码的质量、错误、安全性和性能evaluate_architecture-评估系统/软件架构设计evaluate_uiux-评估UI/UX设计的可用性和可访问性evaluate_test_cases-评估测试用例的覆盖率和质量evaluate_custom-使用自定义用户定义的条件进行评估list_evaluation_criteria-列出预定义的评估标准
-
灵活输入: 接受内容作为直接文本或文件路径
-
结构化输出: JSON结果,包括分数、问题、优势和改进
-
OpenAI兼容: 与任何与OpenAI兼容的API(OpenAI、Azure、本地LLM)配合使用
安装
- 克隆或下载此存储库
- 安装依赖项:
npm install
- 构建TypeScript代码:
npm run build
配置
服务器需要以下环境变量:
| 变量 | 描述 | 必填 | 默认 |
|---|---|---|---|
LLM_API_KEY |
LLM服务的API密钥 | 是 | - |
LLM_API_BASE_URL |
OpenAI兼容的API基础URL | 否 | https://api.openai.com/v1 |
LLM_MODEL |
要使用的型号名称 | 否 | gpt-5.2 |
LLM_MAX_TOKENS |
响应的最大令牌数 | 否 | 4096 |
LLM_TEMPERATURE |
发电温度 | 否 | 0.3 |
MCP配置
将此服务器添加到MCP设置文件中:
基洛代码(VS代码)
编辑 ~/Library/Application Support/Code/User/globalStorage/kilocode.kilo-code/settings/mcp_settings.json:
{
"mcpServers": {
"codex-evaluator": {
"command": "node",
"args": ["/path/to/codex-mcp/build/index.js"],
"env": {
"LLM_API_KEY": "your-openai-api-key",
"LLM_API_BASE_URL": "https://api.openai.com/v1",
"LLM_MODEL": "gpt-5.2",
"LLM_MAX_TOKENS": "4096",
"LLM_TEMPERATURE": "0.3"
},
"disabled": false,
"alwaysAllow": [],
"disabledTools": []
}
}
}
适用于克劳德桌面
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"codex-evaluator": {
"command": "node",
"args": ["/path/to/codex-mcp/build/index.js"],
"env": {
"LLM_API_KEY": "your-openai-api-key",
"LLM_MODEL": "gpt-5.2"
}
}
}
}
使用示例
代码审查
Use evaluate_code_review to review this Python function:
def calculate_discount(price, discount):
return price - (price * discount / 100)
体系结构评价
Use evaluate_architecture to evaluate this microservices design:
Service A -> Message Queue -> Service B -> Database
Service A -> Cache -> Service C -> External API
UI/UX评估
Use evaluate_uiux to evaluate this login page design:
- Header with logo
- Email input field
- Password input field
- "Remember me" checkbox
- "Forgot password" link
- Login button
- "Sign up" link at bottom
测试用例评估
Use evaluate_test_cases to evaluate these unit tests:
describe('Calculator', () => {
it('should add two numbers', () => {
expect(add(2, 3)).toBe(5);
});
});
自定义评估
Use evaluate_custom with criteria "Check for SQL injection vulnerabilities and XSS attacks" on this code:
const query = "SELECT * FROM users WHERE name = '" + userName + "'";
列表标准
Use list_evaluation_criteria with scenario "code_review" to see what criteria are used.
输出格式
所有评估工具都会返回结构化的JSON响应:
{
"summary": "Brief overall assessment",
"score": {
"overall": 7.5,
"categories": {
"correctness": 8,
"security": 7,
"performance": 8,
"maintainability": 7,
"best_practices": 7
}
},
"issues": [
{
"severity": "high",
"category": "security",
"location": "line 5",
"description": "SQL injection vulnerability",
"suggestion": "Use parameterized queries"
}
],
"strengths": [
"Clear function naming",
"Good code organization"
],
"improvements": [
{
"priority": "high",
"description": "Add input validation",
"rationale": "Prevents invalid data from causing errors"
}
],
"metadata": {
"evaluator_model": "gpt-5.2",
"scenario": "code_review",
"timestamp": "2024-01-15T10:30:00Z",
"input_type": "text",
"processing_time_ms": 2500
}
}
发展
构建
npm run build
观看模式
npm run dev
直接运行
npm start
评估标准
代码审查
- 正确性 (25%):逻辑错误、边缘情况、类型安全
- 安全 (20%):漏洞、输入验证、数据暴露
- 演出 (15%):效率、内存使用、异步模式
- 可维护性 (20%):组织、命名、复杂性
- 最佳实践 (20%):设计图案,实心,干/KISS
建筑
- 可扩展性 (20%):扩展能力、瓶颈
- 可靠性 (20%):容错、冗余
- 可维护性 (20%):模块化、耦合、内聚
- 安全 (15%):身份验证、数据保护
- 成本效益 (10%):资源利用率
- 演出 (15%):延迟、吞吐量
UI/UX
- 可用性 (25%):导航、效率、防错
- 无障碍 (20%):WCAG、屏幕阅读器、对比度
- 视觉设计 (15%):一致性、层次结构、排版
- 用户流量 (20%):任务完成,反馈
- 响应性 (10%):设备自适应
- 内容 (10%):信息清晰,帮助文本
测试用例
- 覆盖 (25%):代码/分支/路径覆盖率
- 边缘案例 (20%):边界、错误、空输入
- 断言 (20%):有意义的断言,清晰
- 结构 (20%):组织、命名、隔离
- 可维护性 (15%):独立性、数据管理
许可证
麻省理工学院
