MCP.so
Sign In

ContextualAgentRulesHub

@oshvartz

About ContextualAgentRulesHub

MCP (Model Context Protocol) server designed to manage and provide contextual rules for AI agents

Basic information

Category

Other

License

Apache-2.0

Runtime

python

Transports

stdio

Publisher

oshvartz

Config

No standard config provided

This server doesn't expose a parseable MCP config block in its README. See the repository for install instructions.

Repository

Tools

No tools detected

We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.

Overview

What is ContextualAgentRulesHub?

ContextualAgentRulesHub is an MCP (Model Context Protocol) server that provides a flexible system for storing and retrieving agent rules, enabling AI agents to follow context-specific guidelines. It exposes tools for efficient rule discovery and content retrieval, allowing agents to access only the rules relevant to their current task, minimizing context window usage. Designed for developers using MCP clients such as Claude Desktop or the Cline VSCode extension.

How to use ContextualAgentRulesHub?

Configure the MCP client by pointing its command and environment variables to the run_server.py script and a rules directory. Once running, agents follow a typical task flow: start by retrieving core rules via GetCoreRulesContent, then discover available contexts with GetAllContexts (optional), obtain non-core rule metadata via GetAllRulesMetadata with an optional context filter, and finally fetch individual rule content using GetRuleContentById. No separate installation step beyond pip install -r requirements.txt is needed.

Key features of ContextualAgentRulesHub

  • Context-based rule organization for project-specific guidelines
  • Multi-source support (File, Database, Git Repository, API)
  • YAML-based human-readable rule storage
  • Efficient indexing by language, tags, context, and content
  • Lazy loading of rule content for optimal performance
  • Flexible querying with AND/OR tag logic
  • Core rules with dedicated retrieval tool (GetCoreRulesContent)

Use cases of ContextualAgentRulesHub

  • General development: retrieve only universal coding standards without context filtering
  • Project-specific work: filter rules by a project name (e.g., "TheProject") to combine general and project guidelines
  • MCP server development: use context "mcp-server" to get MCP-specific standards alongside general rules
  • Cross-team rule sharing: load additional rule directories from a shared network path
  • Reducing agent context length by retrieving only rules relevant to the current task

FAQ from ContextualAgentRulesHub

What is the difference between core and non-core rules?

Core rules are marked with is_core: true and are retrieved via GetCoreRulesContent at task start to provide foundational guidelines. Non-core rules are context-specific and retrieved via GetAllRulesMetadata with an optional context filter; their content is fetched on demand using GetRuleContentById.

What dependencies are required to run the server?

The server requires Python 3 and the packages listed in mcp-server/requirements.txt (installed via pip install -r requirements.txt).

How does context filtering work?

When no context filter is provided, only rules without a context (general rules) are returned. When a context is specified, both general rules and rules matching that context are returned. This ensures project-specific guidelines are only retrieved when explicitly requested.

Can rules be loaded from multiple sources?

Yes. Use indexed environment variables (e.g., RulesLoaderOptions:0:SourceType, RulesLoaderOptions:0:Path for the first source, :1: for the second, etc.). Each source can be a local YAML directory or a network path.

Is rule validation supported?

Yes. Set the environment variable AGENT_RULES_VALIDATION to true (default) to enable validation of rule files during loading.

Comments

More Other MCP servers