mcp-rule-engine
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-rule-engineAnalyze workspace changes from main to my branch for JS files."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Rule Engine
An MCP server that captures code modifications, generates reusable rules, and injects them into AI agent context. Provides audit trail for every rule change.
Features
Rule capture: Analyze code diffs via AST (Tree-sitter) and extract repeatable patterns as structured rules
Deterministic matching: Language + file extension + tags + project ID retrieval, with weighted scoring (type/time decay/path match)
Version audit: Every rule edit auto-creates a snapshot in
RuleVersiontable — query full history withgetRuleVersionsBatch workspace analysis:
analyze_workspacetool diffs a git range or acceptsfileContentsdirectly (no git required)Session-level token budget:
taskId-scoped <=2000 token tracking across multi-roundquery_rulescalls
Related MCP server: standards-mcp
API
analyze_workspace
Analyze workspace changes and generate rule candidates. Accepts either a git commit range or direct file contents.
Inputs:
baseCommit(string, required): Git base commit to diff againstheadCommit(string, optional): Git head commit (defaults to HEAD)paths(string[], optional): Filter to specific file pathsfileContents(object[], optional): Direct content analysis — bypasses gitpath(string): File pathoriginalContent(string, optional): Original content (omit if new file)modifiedContent(string): Modified content
taskId(string, optional): Session tracking ID for token budget isolation
query_rules
Query the most relevant rules for a given context.
Inputs:
language(string, required): Programming languagefilePath(string, required): Current file pathprojectId(string, optional): Project scope filtertags(string[], optional): Tag-based filteringtaskId(string, optional): Session tracking ID
Returns Top-K scored rules (<=2000 tokens total), with match reasons (language_match, path_match, content_match).
capture_diff
Analyze a single file diff and generate rule candidates.
Inputs:
filePath(string, required)originalContent(string, required)modifiedContent(string, required)language(string, required)projectId(string, optional)
confirm_rule
Confirm, reject, edit, or skip a rule candidate.
Inputs:
ruleId(string, required)action(enum:accept|reject|edit|skip, required)editedPattern(string, optional): New pattern when action=editeditedSuggestion(string, optional): New suggestion when action=edit
On edit, the server automatically snapshots the old content into RuleVersion before applying the update.
resolve_conflict
Resolve a conflict between two rules covering the same pattern.
Inputs:
conflictId(string, required)resolution(enum:keep_a|keep_b|merge|skip, required)batchAllSession(boolean, optional): Apply same resolution to all conflicts this session
getRuleVersions
Query rule version history.
Inputs:
ruleId(string, required)
Returns array of version snapshots, newest first.
list_rules
List rules with optional filters.
Inputs: All optional — language, scope (project|user|global), status (active|pending|archived), projectId, limit, offset.
Configuration
Codex CLI
codex mcp add mcp-rule-engine -- node D:/Desktop/mcp/dist/index.jsOr add to ~/.codex/config.toml:
[mcp_servers."mcp-rule-engine"]
command = "node"
args = ["D:/Desktop/mcp/dist/index.js"]
[mcp_servers."mcp-rule-engine".env]
DATABASE_URL = "file:D:/Desktop/mcp/prisma/data/rules.db"VS Code
{
"servers": {
"mcp-rule-engine": {
"command": "node",
"args": ["D:/Desktop/mcp/dist/index.js"]
}
}
}Cursor
{
"mcpServers": {
"mcp-rule-engine": {
"command": "node",
"args": ["D:/Desktop/mcp/dist/index.js"],
"env": {
"DATABASE_URL": "file:D:/Desktop/mcp/prisma/data/rules.db"
}
}
}
}Windows
When using node directly (as with this server), no cmd /c wrapping is needed. Ensure DATABASE_URL is an absolute path:
DATABASE_URL="file:D:/Desktop/mcp/prisma/data/rules.db"Build
npm install
npx prisma db push # Initialize SQLite database
npm run build # Compile TypeScript
node dist/index.js # Start server (stdio transport)Tests
npm test # 45 unit tests
npm run test:e2e # E2E integration test
npm run test:e2e -- --db ./tmp/test-rules.db # Use file DB to avoid :memory: EPERMKnown Issues
Prisma EPERM on Windows: Windows Defender may block
schema-engine-windows.exe. Run:Add-MpPreference -ExclusionPath "...\\@prisma\\engines\\schema-engine-windows.exe"Codex
--db :memory:EPERM: Sandboxed environments can't spawncmd.exe. Use a file path instead.Codex 0.139.0 state DB: Abnormal exit may corrupt
state_5.sqlite. Backup and remove to auto-rebuild.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sole03/mcp-rule-engine'
If you have feedback or need assistance with the MCP directory API, please join our Discord server