
rule intelligence mcp
Rule Intelligence MCP-Tool (Node.js + TypeScript) to analyze, validate and manage rulebases with simple CLI handling
Repository Info
About This Server
Rule Intelligence MCP-Tool (Node.js + TypeScript) to analyze, validate and manage rulebases with simple CLI handling
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Rule Intelligence MCP – Universal Rulebase Analyzer
Author: Michael Tittmar
What is Rule Intelligence MCP?
Rule Intelligence MCP is a flexible open-source CLI & library to analyze, validate, and manage any kind of rulebase – for any language, team, or workflow. It supports multiple formats, custom checks (plugins), AI integration, and more.
Features
- Rulebase Analysis: Find missing categories, duplicate rules, empty content, and other issues in your rules. Example: Detect if a coding guideline is missing a category or if two rules have the same title.
- Schema Validation:
Check your rules against any JSON schema to ensure consistency and completeness. Example: Enforce that every rule has an
id,title, andcategory. - Flexible Filtering: Filter rules by status (e.g. active, deprecated), tags, or custom fields. Example: List only active security rules for a release checklist.
- Multiple Output Formats: Export results as JSON (for automation), Markdown (for docs), CSV (for Excel), or HTML (for reports). Example: Generate a Markdown summary for your team wiki.
- Interactive Editing: Edit rules directly from the CLI, e.g. update a title or category without opening a text editor.
- Memory Bank (Change History): All edits and suggestions are logged with timestamps. Example: Track who changed what and when.
- AI Integration (LLM): Get suggestions for new or improved rules from AI models like OpenAI GPT. Example: "Suggest 3 new security rules for my project."
- Live Watch Mode: Automatically re-analyze your rulebase when files change. Example: Get instant feedback while editing.
- Plugin System: Write your own checks/analysis in JavaScript. Example: Plugin that finds conflicting rules.
- Flexible Input: Supports JSON, YAML, TOML, and Markdown (frontmatter). Example: Use the tool for rules in code, docs, or config files.
- Tested & CI-ready: Includes unit and integration tests, ideal for CI pipelines to enforce rule quality before merging code.
Quickstart
Prerequisites
- Node.js ≥ 14
- npm or yarn
Installation
git clone https://github.com/micha-gh/rule-intelligence-mcp.git
cd rule-intelligence-mcp
npm install
Usage
CLI Usage
rule-intelligence-mcp <command> [options]
Common CLI Options
| Option | Description | Example |
|---|---|---|
-r, --rulebase | Path to rulebase file (JSON/YAML/TOML/MD) | -r rules.json |
-s, --schema | Path to JSON schema file | -s my-schema.json |
--format-in | Input format: json, yaml, toml, md (usually auto-detected) | --format-in yaml |
-o, --output | Output format: json, md, csv, html | --output csv |
--status | Filter rules by status | --status active |
--tag | Filter by tags (comma-separated) | --tag security,style |
--plugin | Path to JS plugin for custom checks | --plugin ./plugins/my-check.js |
--llm-provider | LLM provider (openai, azure, local, ...) | --llm-provider openai |
--llm-api-url | LLM API base URL (for custom providers) | --llm-api-url https://api.example.com |
--llm-model | LLM model name | --llm-model gpt-4 |
--memory | Path to memory bank file | --memory .data/mem.json |
Example Commands
# Analyze a rulebase (format usually auto-detected)
rule-intelligence-mcp analyze -r myrules.json --output md
rule-intelligence-mcp analyze -r myrules.yaml --format-in yaml --output csv
rule-intelligence-mcp analyze -r myrules.json --plugin ./plugins/example-plugin.js --output json
# Edit a rule
rule-intelligence-mcp edit rule-2 --title "Use parameterized queries"
# Show memory bank
rule-intelligence-mcp memory:list --memory .data/mem.json
# AI suggestions (optional, install openai first)
npm install openai
rule-intelligence-mcp suggest -r myrules.json --llm-provider openai --llm-model gpt-3.5-turbo
# Watch mode (optional, install chokidar first)
npm install chokidar
rule-intelligence-mcp watch -r myrules.json
Advanced Usage
Flexible Schema & Rulebase Format
- Use any JSON schema for validation (
--schema my-schema.json) - Rulebases can be JSON, YAML, TOML, or Markdown (with frontmatter)
- Format is usually auto-detected, but can be set with
--format-in - YAML example:
rule-intelligence-mcp analyze -r rules.yaml --format-in yaml - Markdown example:
rule-intelligence-mcp analyze -r rules.md --format-in md
Output Formats
--output json(default, for automation)--output md(Markdown, for docs)--output csv(Excel/tables)--output html(reports)
Plugins: Custom Checks & Analysis
- Write your own checks as a JS file:
--plugin ./my-check.js - The plugin receives the rulebase and the current analysis result as input and returns an object to merge into the output
- See
plugins/example-plugin.jsas a template - Example: Count deprecated rules and add the result
LLM Provider (AI) Configuration
- Use any LLM provider: OpenAI, Azure, local, etc.
- Flags:
--llm-provider,--llm-api-url,--llm-model - Example:
rule-intelligence-mcp suggest --llm-provider openai --llm-model gpt-4 - Install required packages first (see docs)
- Set API keys as environment variables (e.g.
OPENAI_API_KEY)
Memory Bank
- Stores all
editandsuggestinteractions with timestamps - Location and backend are configurable (
--memory memory.json,--memory .data/mem.json) - Manage with
memory:listandmemory:clear
Testing & Continuous Integration
- Run all tests:
npm test - Coverage:
npm test -- --coverage - GitHub Actions workflow in
.github/workflows/ci.yml
Examples & Test Data
- The
examples/folder contains various rulebases (minimal, complex, invalid, markdown) - The
plugins/folder contains example plugins - The
test/folder contains test scripts for positive and negative cases
Run automated tests:
bash test/examples.test.sh
bash test/examples.error.test.sh
Test matrix and notes can be found further down in the README.
Integration
Integration with Cursor AI
You can use Rule Intelligence MCP as a Custom Tool in Cursor AI. This allows you to analyze and validate rulebases directly from your IDE.
Step-by-step guide: docs/cursor-integration.md
Project Meta
How to contribute
Want to help? See CONTRIBUTING.md for how to open issues, submit PRs, and coding guidelines.
Code of Conduct
Please read and follow our Code of Conduct.
Changelog
See CHANGELOG.md for release notes and version history.
License
MIT © Michael Tittmar
Quick Start
Clone the repository
git clone https://github.com/micha-gh/rule-intelligence-mcpInstall dependencies
cd rule-intelligence-mcp
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.