Token导航 LogoToken导航TokenDH.com
Better Rspec MCP logo
运维云端未说明官方级别未说明来源级核验

Better Rspec MCP

MCP Server

一个基于Better Specs指南的MCP服务器,提供RSpec测试规范指导、代码示例生成和验证功能,适用于Ruby测试开发场景。

工具数

6

提示词数

0

GitHub Stars

0

资源数

0
TypeScriptClaude测试自动化Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

dautroc

提供方

dautroc

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

更好的RSpec MCP服务器

一个模型上下文协议(MCP)服务器,基于以下内容提供全面的RSpec指导、示例和最佳实践 更好的规格 指导方针。

概述

此MCP服务器使AI助手能够访问结构化的RSpec知识,并提供智能测试指导。它包括用于生成示例、验证代码、获取配置帮助和访问全面的Better Specs指南的工具。

特性

🛠️ 工具

  • get_rspec_guidance -获取特定主题的更好规格指导
  • search_rspec_guidelines -使用关键字搜索更好的规范指南
  • get_category_overview -获取特定类别中所有指南的概述
  • generate_spec_example -根据最佳实践生成RSpec示例
  • validate_spec_code -根据更好的规范指南验证RSpec代码
  • get_rspec_configuration -获取配置模板和设置指南

📚 资源

  • 更好的规格指南 -按类别完整收集指南
  • 代码示例库 -不同规格类型的综合示例
  • 反模式数据库 -常见错误以及如何避免
  • 配置模板 -即用型RSpec配置
  • 备忘单 -更好规格原则的快速参考

💬 提示

  • 代码审查 -全面的RSpec代码审查模板
  • 测试计划 -规划全面测试覆盖率的模板
  • 重构 -改进现有测试套件的指南
  • 项目设置 -新RSpec项目的完整设置指南

安装

先决条件

  • Node.js 18+

快速设置(推荐)

使用npx(无需安装):

添加到您的MCP客户端配置中(例如,Claude Desktop):

{
  "mcpServers": {
    "better-rspec": {
      "command": "npx",
      "args": ["--yes", "better-rspec-mcp@latest"]
    }
  }
}

备选方案:地方发展方案

  1. 克隆和安装依赖关系:
git clone 
cd better-rspec-mcp
npm install
  1. 构建项目:
npm run build
  1. 配置MCP客户端:
{
  "mcpServers": {
    "better-rspec": {
      "command": "node",
      "args": ["/path/to/better-rspec-mcp/dist/index.js"]
    }
  }
}

发展

项目结构

src/
├── index.ts              # Entry point
├── server.ts             # Main MCP server
├── types/                # TypeScript type definitions
├── tools/                # MCP tools implementation
│   ├── guidance.ts       # RSpec guidance tools
│   ├── examples.ts       # Example generation
│   ├── validation.ts     # Code validation
│   └── configuration.ts  # Configuration help
├── resources/            # MCP resources
├── prompts/              # MCP prompts
├── knowledge/            # Knowledge base system
└── utils/                # Utility functions

data/
├── guidelines/           # Better Specs guidelines (Markdown)
├── examples.json         # Code examples database
├── antipatterns.json     # Anti-patterns database
└── configurations.json   # Configuration templates

开发命令

# Development with hot reload
npm run dev

# Build for production
npm run build

# Run tests
npm test

# Lint code
npm run lint

# Type checking
npm run type-check

添加新指南

  1. 在中创建一个新的Markdown文件 data/guidelines/:
---
title: "Your Guideline Title"
category: "naming|organization|expectations|data-setup|mocking|shared-examples|performance|configuration"
tags: ["tag1", "tag2"]
priority: "high|medium|low"
relatedGuidelines: ["other-guideline-ids"]
---

# Your guideline content here
  1. 知识库将在服务器重新启动时自动加载。

添加新示例

将条目添加到 data/examples.json:

{
  "id": "unique-example-id",
  "title": "Example Title",
  "description": "What this example demonstrates",
  "specType": "model|request|system|service|job|controller|helper",
  "scenario": "What you're testing",
  "badCode": "Example of what not to do (optional)",
  "goodCode": "Example of the right way",
  "explanation": "Why this is better",
  "tags": ["relevant", "tags"],
  "complexity": "beginner|intermediate|advanced"
}

更好的规格原则

此MCP服务器是围绕核心Better Specs原则构建的:

  • 清楚地描述方法 -使用 .method 对于类方法, #method 例如方法
  • 使用上下文 -以“何时”、“有”或“无”开头
  • 保持描述简短 -40个字符以下,在较长的场景中使用上下文
  • 每次测试一个期望值 -单元内测试(集成测试的例外情况)
  • 测试所有案例 -快乐之路、边缘案例和失败
  • 使用expect语法 -现代 expect().to 而不是弃用 should
  • 适当使用主题 -对于主要测试对象
  • 使用let/let! -代替测试数据的实例变量
  • 谨慎地嘲笑 -更喜欢真实的行为,只模仿外部边界
  • 测试你所看到的 -专注于集成测试而非控制器单元测试

api参考

工具

get_rspec_guidance

获取特定主题的更好规格指南。

参数:

  • topic (字符串,必填)-RSpec主题以获取指导
  • category (字符串,可选)-要关注的特定类别
  • includeExamples (boolean,默认值:true)-是否包含示例
  • complexity (字符串,可选)-复杂性级别过滤器

generate_spec_example

按照更好的规范指南生成RSpec示例代码。

参数:

  • specType (字符串,必填)-规格类型(型号、请求、系统等)
  • scenario (string,必填)-要测试的内容
  • includeSetup (布尔值,默认值:true)-包括设置代码
  • style (字符串,默认值:“comprehensive”)-示例样式
  • complexity (字符串,默认值:“中级”)-复杂性级别

validate_spec_code

根据更好的规范指南验证RSpec代码。

参数:

  • code (字符串,必填)-要验证的RSpec代码
  • checkAll (boolean,默认值:true)-运行所有验证检查
  • specificChecks (数组,可选)-要检查的特定规则
  • returnSuggestions (布尔值,默认值:true)-包括建议

get_rspec_configuration

获取RSpec配置模板和设置指南。

参数:

  • type (字符串,必填)-配置类型(spec_helper、rails_helper等)
  • projectType (字符串,默认值:“rails”)-项目类型
  • includeComments (布尔值,默认值:true)-包括解释性注释
  • features (阵列,可选)-要包括的其他功能

资源

  • better-specs://guidelines -所有指南
  • better-specs://examples -所有示例
  • better-specs://antipatterns -所有反模式
  • better-specs://configurations -所有配置模板
  • better-specs://cheatsheet -快速参考指南

提示

  • review_rspec_code -全面的代码审查
  • plan_comprehensive_tests -测试计划指导
  • refactor_test_suite -重构建议
  • setup_rspec_project -项目设置指导

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 进行更改
  4. 如果适用,添加测试
  5. 运行linting和测试
  6. 提交拉取请求

致谢

目录标签

目录标签

TypeScriptClaude测试自动化RSpec测试本地部署代码验证测试规范Ruby开发

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

6

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP