home / mcp / agent rules mcp server

Agent Rules MCP Server

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.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "4regab-agent-rules-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "agent-rules-mcp@latest"
      ],
      "env": {
        "GITHUB_PATH": "your-rules-folder",
        "GITHUB_REPO": "your-rules-repo",
        "GITHUB_OWNER": "your-username",
        "GITHUB_BRANCH": "main"
      }
    }
  }
}

You can run Agent Rules MCP Server to fetch coding rules from GitHub repositories on demand, so your AI agents can access up-to-date standards without storing local rule files in every project. This approach simplifies sharing rules across teams and enables seamless integration with community rule collections or your own rule folders.

How to use

In your coding workflow, configure your MCP-enabled client to use Agent Rules MCP Server. The server fetches rules from GitHub based on your environment settings and serves them to AI agents that request guidance, checks, or prompts.

How to install

Prerequisites: Node.js and npm or npx installed on your machine.

Install and run the MCP server via npx. Use the following configuration in your MCP client to invoke the server.

{
  "mcpServers": {
    "agent_rules": {
      "command": "npx",
      "args": ["-y","agent-rules-mcp@latest"],
      "env": {
        "GITHUB_OWNER": "your-username",
        "GITHUB_REPO": "your-rules-repo",
        "GITHUB_PATH": "your-rules-folder",
        "GITHUB_BRANCH": "main"
      },
      "disabled": false
    }
  }
}

Additional configuration and formats

You can fetch rules from a variety of markdown files and formats. The server supports .md, .mdc, .chatmode.md, .prompt.md, and .instructions.md. If metadata is not present, the server can extract a title from the first heading and a description from the first paragraph, or generate a fallback description from the filename.

Examples of using community rule collections to enrich your AI agents include standard collections like awesome-copilot or awesome-cursorrules. To point the MCP server at a community collection, adjust the environment variables to specify the repository, path, and branch you want to pull from.

Available tools

get_rules

Retrieves rule content for one or multiple domains from the GitHub repository rules folder.

list_rules

Lists all available rule domains with descriptions.