mcp-yeoman

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Enables running Yeoman generators with Node.js, providing tools to search for templates, get generator options, and create applications with specific configurations

  • Allows searching for Yeoman templates on npm registry

  • Supports creating React applications using Yeoman generators with customizable options like TypeScript and Sass integration

MCP Yeoman 服务器

模型上下文协议 (MCP) 服务器提供与 Yeoman 生成器的集成,允许 AI 代理以编程方式搜索和运行 Yeoman 模板。

工具

该服务器实现了以下 MCP 工具:

模板搜索方法

  1. yeoman_search_templates - 在 npm 上搜索 Yeoman 模板
    • 参数:
      • query (字符串):以逗号分隔的搜索关键字
      • pageSize (数字,可选):返回的结果数(默认值:20)

生成器方法

  1. yeoman_get_generator_options - 获取 Yeoman 生成器所需的选项和参数
    • 参数:
      • generatorName (字符串):生成器的名称(不带“generator-”前缀)
  2. yeoman_generate - 运行 Yeoman 生成器
    • 参数:
      • generatorName (字符串):生成器的名称(不带“generator-”前缀)
      • cwd (字符串):生成器应运行的工作目录
      • appName (字符串):要创建的应用程序的名称
      • version (字符串):要创建的应用程序的版本
      • options (对象,可选):传递给生成器的选项
      • args (数组,可选):传递给生成器的附加位置参数

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 mcp-yeoman:

npx @smithery/cli@latest install mcp-yeoman --client claude

先决条件

  • Node.js(v16 或更高版本)
  • npm 或 yarn

安装包

# Clone the repository git clone https://github.com/thirdstrandstudio/mcp-yeoman.git cd mcp-yeoman # Install dependencies npm install # Build the package npm run build

与 Claude Desktop 一起使用

将以下内容添加到您的claude_desktop_config.json中:

使用 npx

{ "mcpServers": { "yeoman": { "command": "npx", "args": ["@thirdstrandstudio/mcp-yeoman"] } } }

直接 Node.js

{ "mcpServers": { "yeoman": { "command": "node", "args": ["/path/to/mcp-yeoman/dist/index.js"] } } }

/path/to/mcp-yeoman替换为您的存储库的实际路径。

命令行参数

服务器支持以下命令行参数:

  • --generator-dir <path> :指定用于安装 Yeoman 生成器的永久目录。默认情况下,生成器安装在临时目录中,该目录会在操作完成后被删除。使用永久目录可以提高使用相同生成器进行重复操作的性能。

例子:

{ "mcpServers": { "yeoman": { "command": "node", "args": ["/path/to/mcp-yeoman/dist/index.js", "--generator-dir", "/path/to/generator-storage"] } } }

示例

搜索模板

// Search for React-related templates const templates = await callTool("yeoman_search_templates", { query: "react,typescript", pageSize: 10 });

获取生成器选项

// Get options for the React generator const options = await callTool("yeoman_get_generator_options", { generatorName: "react" });

运行生成器

// Run the React generator const result = await callTool("yeoman_generate", { generatorName: "react", cwd: "/path/to/project", appName: "my-react-app", version: "1.0.0", options: { typescript: true, sass: true } });

发展

# Install dependencies npm install # Start the server in development mode npm start # Build the server npm run build

错误处理

该服务器包括全面的错误处理:

  • 无效参数的验证错误
  • 交互式提示检测和引导所需选项
  • 用于调试的详细错误日志记录
  • 自动清理临时目录(除非使用--generator-dir)
  • 通过 MCP 协议安全传播错误

执照

此 MCP 服务器采用 MIT 许可证。这意味着您可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。更多详情,请参阅项目仓库中的 LICENSE 文件。

贡献

欢迎贡献代码!请随时提交 Pull 请求。贡献代码时,请注意以下几点:

  1. 分叉存储库
  2. 创建功能分支
  3. 提交拉取请求,并清晰描述变更
  4. 确保所有测试通过并且代码风格得到维护
ID: 5xi1qh51zy