Get the FREE Ultimate OpenClaw Setup Guide →

mcp-policy

MCP server for dynamically injecting agents and prompts with policy documentation.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio rcrsr-mcp-policy-server npx -y @rcrsr/mcp-policy-server \
  --env MCP_POLICY_CONFIG="./policies/*.md"

How to use

This MCP server provides policy content for Claude Code subagents by serving policy sections from Markdown files. Policies are defined with the § notation (for example, §DESIGN.1) and can reference other sections. Subagents can fetch policies on demand or have them injected into prompts so that agents only receive the exact rules they need, without loading entire documents into memory. When using this server, you typically interact with the fetch_policies tool exposed by the MCP server, or you rely on the plugin/hook integrations to automatically pull in relevant policies before a task runs. The server is designed to work with multiple projects by pointing to per-project policy files, ensuring consistency while keeping content up to date.

To utilize it, start an MCP client that can call the fetch_policies tool explicitly (or use a Claude Code hook/plugin that does this under the hood). You can also validate or extract policy references with dedicated tools like fetch_policies, validate_references, and extract_references to ensure correct policy usage. Point your MCP client at the policy configuration (MCP_POLICY_CONFIG) that references your policy Markdown files, and then request the needed § sections by prefix or full reference. This setup enables per-project policy sets while centralizing policy maintenance in Markdown files.

How to install

Prerequisites:

  • Node.js (version 14 or newer) and npm installed
  • Access to run npx and install npm packages
  • A policies directory containing Markdown files using the § notation (e.g., policies/*.md)

Option A: Install and run via npx (no global install required)

  1. Ensure your policies are in ./policies/ and contain Markdown policy files, for example policies/policy-example.md
  2. Start using the MCP server client workflow by configuring your MCP client to call the server via npx with the appropriate environment variable:
    • MCP_POLICY_CONFIG should point to your policy files, e.g. ./policies/*.md
  3. Example command to verify installation: npx -y @rcrsr/mcp-policy-server

Option B: Attach via Claude MCP workflow (as shown in the README)

  1. Install the MCP server JSON configuration in your Claude environment as shown in the README (the add-json command).
  2. Ensure MCP_POLICY_CONFIG is set to ./policies/*.md for policy loading.
  3. Use the fetch_policies tool in your subagents to dynamically request policies as needed.

Additional notes

Notes and tips:

  • The MCP_POLICY_CONFIG environment variable should point to your policy Markdown files. Use wildcards (e.g., ./policies/*.md) to include multiple files.
  • Policy references inside code blocks are ignored by fetchers, so you can document examples without triggering policy extraction.
  • Use Method 3 (MCP Server) to fetch policies explicitly when subagents require dynamic policy selection based on prompt content.
  • If you maintain multiple projects, you can have separate policy sets by placing different Markdown files in project-specific policy directories and configuring MCP_POLICY_CONFIG accordingly.
  • For Windows users, follow the Windows-specific instructions in the README to set up the JSON policy server integration.

Related MCP Servers

Sponsor this space

Reach thousands of developers