Back to memory-api/README.md.
MCP server for rule-api.
rule-mcp runs on stdio and opens the rule store directly. Use it when an agent needs canonical rule CRUD, feedback capture, or generated markdown rendering without an HTTP backend.
Named tool groups:
- Authoring:
rule_create,rule_get,rule_import_file,rule_update,rule_record_feedback,rule_list,rule_search - Rendering:
rule_generate_file,rule_generate_target,rule_explain_target - Maintenance:
rule_scan,rule_add_root
rule_update accepts sparse request payloads. Omit untouched keys entirely; send only the fields, to_state, or body being changed. The response returns only directly relevant update metadata such as id, changed_fields, state_transition, and body_updated.
Store discovery:
- Set
RULE_INDEX_ROOTto point at a specific rule store. - Otherwise the server resolves the nearest
.ruleworkspace from the current checkout.
Feedback is rule-entry scoped. If the issue came from a specific spec entry or generated guidance section, locate the canonical rule entry first and include the spec ID, path, and section in the feedback note.
Run the server on stdio:
cargo run -p rule-mcpExample VS Code MCP configuration:
{
"servers": {
"rule-mcp": {
"type": "stdio",
"command": "cargo",
"args": ["run", "-p", "rule-mcp"]
}
}
}- Call
rule_searchto find existing entries for a README, instruction section, or generated guidance block. - Call
rule_record_feedbackto attach a rating and optional note to the exact rule entry you used. When feedback came from a specific spec entry, include the spec ID, path, and section innote. - Call
rule_listorrule_searchwithlow_rated_onlyorunresolved_onlywhen the client needs a review queue. - Call
rule_explain_targetbefore changingrule-targets.yamlso the client can inspect which canonical entries each node matches. - Call
rule_generate_targetwhen a client needs the rendered markdown for one configured output file. - For
rule_update, prefer sparse payloads such as{"id":"<id-or-slug>","to_state":"reviewed"}or{"id":"<id-or-slug>","field_map":{"order_key":10}}.