规则管理服务器

一个用于存储和按需调用编码规则、提示等的MCP服务器,帮助开发者在不同项目和IDE中保持一致的编码规范。

  • by markacianfrani
  • TypeScript
  • 本地部署
  • 8 星标
  • 更新于
在 GitHub 查看 markacianfrani/mcp-pattern-language

使用说明

我的规则

一个MCP服务器,用于我的所有规则、提示等。允许代理按需调用规则。

如果你当前的会话不打算编写测试,那么填写4段关于如何编写测试的说明是没有意义的。

在精神上类似于Cursor的规则。

用法

克劳德代码

claude mcp add --transport http rules https://mcp.cianfrani.dev/mcp

光标

克劳德桌面

{
    "rules": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://mcp.cianfrani.dev/mcp"
      ]
    }
}

它是干什么的?

允许编码代理在其当前任务的上下文中按需查找规则。

> write a test for @calc.py
  ⎿  Read calc.py (26 lines)

⏺ rules:get_rules_for_writing_tests (MCP)(language: "python")
  ⎿  - Before testing a protected method, ask "Can this logic be adequately tested through the public interface?". If yes, don't test the protected method directly.
     If no, continue testing the protected method.
     - Remember to write tests using the Arrange, Act, Assert pattern.
     … +12 lines (ctrl+r to expand)

⏺ Write(test_calc.py)

为什么?

  • 在项目/IDE之间携带所有这些小笔记真的很烦人。
  • 我不想手动调用规则。

它是如何工作的?

明确定义的工具描述允许代理根据需要获取规则,前提是这些规则似乎是相关的。

什么不起作用?

  • 模式必须与特定操作相关联。例如,“编写测试”、“编写UI”、“审查PR”。
  • 代理最终决定是否调用该工具。有时确实如此。有时它不会。

工具

  1. get_rules_for_writing_tests
    • 使用时:编写任何类型的测试,
    • 输入:
      • language (字符串)
  2. get_rules_for_composing_ui
  • 使用时间:创建新的前端组件

鼓励

在Claude Code中,将提示作为斜线命令调用。

  1. pr-review
  • 在以下情况下使用:您希望对某个工作单位获得反馈
  • /公关审查
  • 看 resources/pr-review.md 对于完整模板。

资源

开发

  1. 启动服务器
npm run dev
  1. 打开MCP检查器
npm run inspect