agent-rules
MCP server that enables your agents to use coding rules from any or your GitHub repository. Instead of workspace rules files, you can now prompt agents to access the your coding rules from any repository.
claude mcp add --transport stdio 4regab-agent-rules-mcp npx -y agent-rules-mcp@latest \ --env GITHUB_PATH="rules" \ --env GITHUB_REPO="agent-rules-mcp" \ --env GITHUB_OWNER="4regab" \ --env GITHUB_BRANCH="master"
How to use
Agent Rules MCP Server lets AI agents fetch coding rules from a GitHub repository on demand, instead of relying on local rule files. It supports multiple communities and rule formats, including Markdown-based rules with or without metadata, plus special extensions like .chatmode.md, .prompt.md and .instructions.md. You can point the MCP client at a GitHub repository, branch and path, and then use tools like get_rules to retrieve rules for specific domains or list_rules to see available options. This enables consistent, centralized rule access for AI coding agents across projects, without embedding the rule files locally.
To use it, configure an MCP client with the agent-rules server, typically via npx as shown in the default configuration. The tools provided by the server include get_rules, which fetches rule content for one or more domains from the configured GitHub path, and list_rules, which enumerates all available rule domains with descriptions. By supplying environment variables such as GITHUB_OWNER, GITHUB_REPO, GITHUB_PATH, and GITHUB_BRANCH, you can customize where the rules are sourced from (your own repo or community collections).
How to install
Prerequisites:
- Node.js (v14+ recommended) and npm installed on your system
- Internet access to fetch packages from npm
Step 1: Install Node.js and npm (if not already installed)
- On macOS: visit https://nodejs.org/ and install the LTS version
- On Windows: use the official installer from nodejs.org
- On Linux: follow your distribution's instructions, e.g., sudo apt-get install nodejs npm
Step 2: Verify npm/npx availability
- node -v
- npm -v
- npx -v
Step 3: Use the MCP server via npx (as intended by the repository)
- The default usage is to run:
npx -y agent-rules-mcp@latest
Step 4: Configure environment variables for your rules source
- Provide GITHUB_OWNER, GITHUB_REPO, GITHUB_PATH, and GITHUB_BRANCH to point to your rules
- Example environment block (adjust values as needed):
GITHUB_OWNER=your-username
GITHUB_REPO=your-rules-repo
GITHUB_PATH=your-rules-folder
GITHUB_BRANCH=main
Step 5: Run the MCP client with the configuration shown in the README to start serving rules to your AI agents.
Additional notes
Tips and notes:
- The server is designed to work with both community collections and your own rules repository. If you modify the rules, ensure the GITHUB_PATH points to the correct folder containing .md/.mdc/.chatmode.md/.prompt.md files.
- Supported file formats include .md, .mdc, .chatmode.md, .prompt.md, and .instructions.md. Missing metadata will be auto-extracted from headings and descriptions.
- For large rule sets, consider using list_rules first to understand available domains before fetching specific rules with get_rules.
- If you encounter GitHub access limitations, verify your repository permissions and network access. Creating a personal access token is typically unnecessary for public repos but may be required for private repos.
- The default environment example in the README uses GITHUB_OWNER=4regab, GITHUB_REPO=agent-rules-mcp, GITHUB_PATH=rules, GITHUB_BRANCH=master; adapt these to your setup when using your own repository.
- The MCP client can be extended with additional domains by adding new rule files following the recommended metadata and naming conventions.
Related MCP Servers
comet
MCP Server connecting to Perplexity Comet browser
conductor-tasks
A task management system designed for AI development
nutrient-document-engine
A Model Context Protocol (MCP) server implementation exposes document processing capabilities through natural language, supporting both direct human interaction and AI agent tool calling.
dataagents
Data Agents are intelligent assistants built by data engineers to help non-data professionals navigate the organization’s data infrastructu
mcp-browser-automation
Model Context Protocol based AI Agent that runs a browser from Claude desktop
ai
Official AI SDK by Ampersand