Sponsored by Deepsite.site

Markdown Rules

Created By
Danny Vaughton @ Valstro7 months ago
The portable alternative to Cursor Rules and IDE-specific rules. Transform your project documentation into intelligent AI context using standard Markdown files that work across any MCP-compatible AI tool. Escape vendor lock-in and scattered documentation forever.
Content

Prerequisites 📋

  • Node.js (v18 or higher)
  • Cursor or other MCP supported AI coding tools

Installation 🛠️

Manual Installation

  1. Install the MCP server
npm install -g @valstro/markdown-rules-mcp
  1. Configure the MCP server
{
  "mcpServers": {
    "markdown-rules-mcp": {
      "command": "npx",
      "args": ["-y", "@valstro/markdown-rules-mcp"],
      "env": {
        "PROJECT_ROOT": "/absolute/path/to/project/root",
        "MARKDOWN_INCLUDE": "./docs/**/*.md",
        "HOIST_CONTEXT": true
      }
    }
  }
}

Configuring Usage Instructions (Optional)

To change the default usage instructions, create a markdown-rules.md file in your project root. The file should contain the usage instructions for the get_relevant_docs tool.

The default usage instructions are:

# Usage Instructions

*   You **must** call the `get_relevant_docs` MCP tool before providing your first response in any new chat session.
*   After the initial call in a chat, you should **only** call `get_relevant_docs` again if one of these specific situations occurs:
    *   The user explicitly requests it.
    *   The user attaches new files.
    *   The user's query introduces a completely new topic unrelated to the previous discussion.

Note: You can change the default usage instructions file path by adding the USAGE_INSTRUCTIONS_PATH environment variable to the MCP server configuration.

Tools

  • get_relevant_docs - Get relevant docs based on the user's query. Is called based on the usage instructions.
  • list_indexed_docs - Count and preview indexed docs & usage instructions. Useful for debugging.
  • reindex_docs - Reindex the docs. Useful if docs in the index have changed or new docs have been added.

How To Use 📝

Create .md files in your project with YAML frontmatter to define how they should be included in AI context.

Document Types

TypeFrontmatterDescriptionWhen Included
GlobalalwaysApply: trueAlways included in every AI conversationAutomatically, every time
Auto-Attachedglobs: ["**/*.ts", "src/**"]Included when attached files match the glob patternsWhen you attach matching files
Agent-Requesteddescription: "Brief summary"Available for AI to select based on relevanceWhen AI determines it's relevant to your query
No FrontmatterNoneMust be included in the prompt manually with @ symbolWhen AI determines it's relevant to your query

Frontmatter Examples

Global (always included):

---
description: Project Guidelines
alwaysApply: true
---
# Project Guidelines

This doc will always be included.

Auto-attached (included when TypeScript files are attached):

---
description: TypeScript Coding Standards
globs: ["**/*.ts", "**/*.tsx"]
---
# TypeScript Coding Standards

This doc will be included when TypeScript files are attached.

Agent-requested (available for AI to select based on relevance):

---
description: Database Schema and Migration Guide
---
# Database Schema and Migration Guide

This doc will be included when AI selects it based on relevance.

No frontmatter (must be included in the prompt manually with @ symbol):

# Testing Guidelines

This doc needs manual inclusion with @ symbol

Linking Files

Link other files: Add ?md-link=true to include linked files in context

See [utilities](./src/utils.ts?md-link=true) for helper functions.

Embed specific lines: Add ?md-embed=START-END to include only specific lines inline

Configuration: [API Settings](./config.json?md-embed=1-10)

Configuration

  • PROJECT_ROOT - Default: process.cwd() - The absolute path to the project root.
  • MARKDOWN_INCLUDE - Default: **/*.md - Pattern to find markdown doc files
  • HOIST_CONTEXT - Default: true - Whether to show linked files before the docs that reference them
  • MARKDOWN_EXCLUDE - Default: **/node_modules/**,**/build/**,**/dist/**,**/.git/**,**/coverage/**,**/.next/**,**/.nuxt/**,**/out/**,**/.cache/**,**/tmp/**,**/temp/** - Patterns to ignore when finding markdown files

Example 📝

Imagine you have the following files in your project:

project-overview.md:

---
description: Project Overview and Setup
alwaysApply: true
---
# Project Overview

This document covers the main goals and setup instructions.

See the [Core Utilities](./src/utils.ts?md-link=true) for essential functions.

For configuration details, refer to this section: [Config Example](./config.json?md-embed=1-3)

src/utils.ts:

// src/utils.ts
export function helperA() {
  console.log("Helper A");
}

export function helperB() {
  console.log("Helper B");
}

config.json:

{
  "timeout": 5000,
  "repeats": 3,
  "retries": 3,
  "featureFlags": {
    "newUI": true
  }
}

Generated Context Output (if HOIST_CONTEXT is true):

When the get_relevant_docs tool runs, because project-overview.md has alwaysApply: true, the server would generate context like this:

<file description="Core Utilities" type="related" file="src/utils.ts">
// src/utils.ts
export function helperA() {
  console.log("Helper A");
}

export function helperB() {
  console.log("Helper B");
}
</file>

<doc description="Project Overview and Setup" type="always" file="project-overview.md">
# Project Overview

This document covers the main goals and setup instructions.

See the [Core Utilities](./src/utils.ts?md-link=true) for essential functions.

For configuration details, refer to this section: [Config Example](./config.json?md-embed=1-3)
<inline_doc description="Config Example" file="config.json" lines="2-4">
  "timeout": 5000,
  "repeats": "YOUR_API_KEY",
  "retries": 3,
</inline_doc>
</doc>

Generated Context Output (if HOIST_CONTEXT is false):

<doc description="Project Overview and Setup" type="always" file="project-overview.md">
# Project Overview

This document covers the main goals and setup instructions.

See the [Core Utilities](./src/utils.ts?md-link=true) for essential functions.

For configuration details, refer to this section: [Config Example](./config.json?md-embed=1-3)
<inline_doc description="Config Example" file="config.json" lines="2-4">
  "timeout": 5000,
  "repeats": "YOUR_API_KEY",
  "retries": 3,
</inline_doc>
</doc>

<file description="Core Utilities" type="related" file="src/utils.ts">
// src/utils.ts
export function helperA() {
  console.log("Helper A");
}

export function helperB() {
  console.log("Helper B");
}
</file>

Server Config

{
  "mcpServers": {
    "markdown-rules-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@valstro/markdown-rules-mcp"
      ],
      "env": {
        "PROJECT_ROOT": "/absolute/path/to/project/root",
        "MARKDOWN_INCLUDE": "./docs/**/*.md",
        "HOIST_CONTEXT": true
      }
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Tavily Mcp
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
CursorThe AI Code Editor
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
WindsurfThe new purpose-built IDE to harness magic
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Playwright McpPlaywright MCP server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
ChatWiseThe second fastest AI chatbot™
Amap Maps高德地图官方 MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
DeepChatYour AI Partner on Desktop
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Serper MCP ServerA Serper MCP Server