RulesetMCP

RulesetMCP

Provides AI agents with queryable, version-controlled project rules and coding standards. Enables validation, rule-based guidance, and task summaries to keep AI work aligned with your project's conventions without repeating context.

Category
访问服务器

README

RulesetMCP

Weight-On-Wheels for AI: Keep every agent grounded in your project's rules.

RulesetMCP is a Model Context Protocol (MCP) server that gives AI agents a project-aware rulebook. Instead of explaining your coding standards, SQL conventions, or process guidelines every time you open a new AI session, you define them once in version-controlled files. RulesetMCP reads those files and exposes tools for listing, summarizing, and applying rules to specific tasks and snippets.

The Problem

Right now you probably:

  • ✋ Repeat the same context to AI every session ("Use UPPER-CASE for SQL keywords")
  • 📝 Maintain scattered documentation that AI can't easily query
  • 🔄 Re-explain architecture decisions across different AI tools
  • ⚠️ Hope the AI remembers your project's conventions

The Solution

RulesetMCP acts like a "Weight-On-Wheels" switch for AI assistants: once your rules are loaded, every action is grounded in them. This keeps your rewrites, refactors, and new features aligned with the architecture and process decisions you've already made.

Features

  • 🔍 Project discovery via list_projects
  • 📋 Structured rules from Markdown and YAML
  • 🎯 Contextual queries with get_rules (filter by area, tags, severity)
  • 📊 Task-oriented summaries with summarize_rules_for_task
  • Snippet validation with validate_snippet
  • 🔄 Hot-reload rules with reload_rules
  • 🌐 Universal compatibility via MCP protocol (works with Claude Code, Claude Desktop, and any MCP-compatible client)

Quick Start

1. Install

npm install -g rulesetmcp

Or clone and build locally:

git clone https://github.com/n8daniels/RulesetMCP.git
cd RulesetMCP
npm install
npm run build

2. Create Config

Create rulesetmcp.config.json in your workspace:

{
  "projects": [
    {
      "id": "my-api",
      "name": "My API Project",
      "paths": ["/path/to/my-api"],
      "rulesPaths": ["rules/", "docs/rules/"]
    }
  ],
  "defaultProjectId": "my-api"
}

3. Add Rules

Create rules/RULES.md in your project:

# My API - Coding Standards

## [api-naming-001] RESTful endpoint naming

**Area:** api
**Severity:** warn
**Tags:** api, rest, naming

**Description:**
All REST endpoints must use plural nouns and follow `/api/v1/{resource}` pattern.

**Good Example:**

GET /api/v1/users POST /api/v1/orders


**Bad Example:**

GET /api/getUser POST /api/create-order

4. Configure Your MCP Client

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "rulesetmcp": {
      "command": "rulesetmcp",
      "args": ["--config", "/path/to/rulesetmcp.config.json"]
    }
  }
}

Claude Code (.claude/settings.json):

{
  "mcp": {
    "rulesetmcp": {
      "command": "rulesetmcp",
      "args": ["--config", "/path/to/rulesetmcp.config.json"]
    }
  }
}

5. Use It!

Now when you work with AI:

You: "Refactor this SQL stored procedure to pull more data from the users table"

AI: [Calls get_rules for project="my-api", area="sql"]
AI: "Based on your project's SQL rules, I'll ensure:
     - All keywords are UPPER-CASE
     - Identifiers use lower_case
     - Proper indexing hints are included

     Here's the refactored procedure..."

Rule Formats

RulesetMCP supports multiple formats:

Markdown (RULES.md)

## [rule-id] Rule Title

**Area:** sql
**Severity:** error
**Tags:** formatting, style

**Description:** What the rule requires

**Rationale:** Why this matters

**Good Example:**
```sql
SELECT * FROM users;

Bad Example:

select * from Users;

### YAML (rules/*.yaml)

```yaml
- id: sql-format-001
  project: my-api
  area: sql
  title: SQL casing convention
  description: All SQL must use UPPER-CASE keywords and lower_case identifiers
  severity: warn
  tags: [sql, style, formatting]
  examples:
    good: |
      SELECT u.user_id FROM users u;
    bad: |
      select UserID from Users;
  appliesTo:
    - "*.sql"
    - "procedures/*"

MCP Tools

list_projects

Discover available projects and their rule sets.

get_rules

Query rules by project, area, tags, or severity.

validate_snippet

Validate code/SQL/config against project rules and get fix suggestions.

summarize_rules_for_task

Get a task-oriented summary of relevant rules before starting work.

reload_rules

Hot-reload rules after editing files on disk.

Philosophy

RulesetMCP embodies the "Weight-On-Wheels" principle: just like an aircraft can't ignore physics once grounded, AI agents shouldn't ignore your project's rules once RulesetMCP is enabled.

This is not just documentation - it's:

  • ✅ Machine-readable and queryable
  • ✅ Version-controlled with your code
  • ✅ Enforceable via validation tools
  • ✅ Universal across all MCP-compatible AI tools

Examples

See the examples/ directory for complete sample projects:

  • nodejs-api/ - REST API with TypeScript standards
  • python-django/ - Django project with security rules
  • dotnet-webapi/ - .NET API with architecture patterns

Use Cases

SQL Standardization

- id: sql-format-001
  area: sql
  title: SQL keyword casing
  description: All SQL keywords UPPER-CASE, identifiers lower_case
  severity: warn

Security Guardrails

- id: security-001
  area: security
  title: No hardcoded secrets
  description: Use environment variables or secure vaults
  severity: blocker

Architecture Patterns

- id: arch-http-001
  area: architecture
  title: Use HttpClientFactory
  description: Never instantiate HttpClient directly
  severity: error

Migration Rules

- id: migration-001
  area: migration
  title: Preserve backward compatibility
  description: When refactoring API endpoints, maintain old routes with redirects
  severity: blocker

Roadmap

  • [x] Phase 1: Core MCP server with basic tools
  • [x] Phase 2: Multi-format rule loading (Markdown, YAML)
  • [ ] Phase 3: Advanced validation with pattern matching
  • [ ] Phase 4: LLM-assisted rule violation detection
  • [ ] Phase 5: VSCode extension for inline hints
  • [ ] Phase 6: Pre-commit hooks and CI/CD integration
  • [ ] Community rule packs (OWASP, Google Style Guide, etc.)

Contributing

Contributions welcome! Please see CONTRIBUTING.md for guidelines.

Building From Source

npm install
npm run build
npm start

License

MIT License - see LICENSE

Support

  • Issues: https://github.com/n8daniels/RulesetMCP/issues
  • Discussions: https://github.com/n8daniels/RulesetMCP/discussions
  • MCP Community: https://discord.gg/anthropic

Built with ❤️ for developers tired of repeating themselves to AI

"Stop explaining. Start enforcing."

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选