A Model Context Protocol (MCP) server finds and reads Markdown files in configured directories. This server guarantees READ-ONLY access to ONLY MARKDOWN documents, i.e. files ending with .md extension.
Quick Start:
- Build:
go build - Configure: Create
~/.config/markdown-reader-mcp/markdown-reader-mcp.jsonwith your directories you'd like to be discovered through this server. - Add to your MCP-compatible AI agent (see Integration section below)
- Use: Ask to "find markdown files" or "read README"
A use case of this is the provisioning of a controlled collection of
prompts and context that can be applied for all agents running locally. For
example, this can be achieved by providing a master prompt in a file called
precepts.md and then referencing this by prompting.
Apply precepts.md from MCP ReaderThe MCP-compatible agent will discover your master prompt and use it going forward. This
precepts.md prompt can reference other prompts to be loaded for specific
tasks by including a guidance table:
## Guidance for specific tasks
| Task | Markdown to read |
| ----------------------------- | ----------------------- |
| Writing a README file | `readme-guidance.md` |
| Writing API documentation | `api-docs-guidance.md` |
| Code review and refactoring | `code-review-guide.md` |This approach allows you to maintain specialised guidance for different development tasks while keeping your master prompt organised. The referenced markdown files are only loaded when actually needed for a specific task, keeping the current context focused and preventing unnecessary pollution of the conversation.
Set up project command:
echo "Apply precepts.md from MCP Reader" > .claude/commands/precepts.mdSet up personal command:
mkdir -p ~/.claude/commands
echo "Apply precepts.md from MCP Reader" > ~/.claude/commands/precepts.mdThen apply in a Claude Code session with:
/preceptsgit clone <this-repo>
cd markdown-reader-mcp
go buildInstall locally:
go installOption A: Configuration File (Recommended)
Create ~/.config/markdown-reader-mcp/markdown-reader-mcp.json:
{
"directories": ["~/my/notes", "~/projects/docs", "/absolute/path"],
"max_page_size": 100,
"debug_logging": false,
"ignore_dirs": ["\\.git$", "node_modules$", "vendor$"],
"sse_port": 8080,
"log_file": "~/local/logs/markdown-reader-mcp.log"
}Option B: Command-line Arguments
./markdown-reader-mcp ~/documents/notes ~/projects/docs# Add for current project
claude mcp add markdown-reader -- markdown-reader-mcp
# Add globally for all projects
claude mcp add markdown-reader -s user -- markdown-reader-mcp
# Verify installation
claude mcp list
# Remove MCP
claude mcp remove markdownThe server can be started with SSE transport (useful when running agents in containers or remote environments):
./markdown-reader-mcp -sseand registered with
claude mcp add -s user --transport sse markdown-reader http://localhost:8080/sseThe server can be loaded with Launchd on Mac OS
go install
cp com.adaptivekind.markdown-reader-mcp.plist ~/Library/LaunchAgents
defaults write ~/Library/LaunchAgents/com.adaptivekind.markdown-reader-mcp.plist \
ProgramArguments -array $HOME/go/bin/markdown-reader-mcp -sse
launchctl load ~/Library/LaunchAgents/com.adaptivekind.markdown-reader-mcp.plistAdd to your Claude Desktop MCP settings file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/claude-desktop/claude_desktop_config.json
{
"mcpServers": {
"markdown-reader": {
"command": "/path/to/markdown-reader-mcp",
"args": []
}
}
}Or with command-line arguments:
{
"mcpServers": {
"markdown-reader": {
"command": "/path/to/markdown-reader-mcp",
"args": ["/path/to/your/docs", "/another/path"]
}
}
}Note: Use absolute paths in Claude Desktop configuration.
Once configured, you can ask your MCP-compatible agent:
- "Show me all markdown files in the project" → Uses
find_markdown_files - "Find files containing 'api' in the name" → Uses
find_markdown_fileswith query - "Show me the first 10 markdown files" → Uses
find_markdown_fileswith pagination - "Read the content of README" → Uses
read_markdown_file - "What's in the api.md file?" → Uses
read_markdown_file
directories: Array of directory paths to scan for markdown filesmax_page_size(optional): Maximum results per page. Default: 500debug_logging(optional): Enable detailed debug logging. Default: falseignore_dirs(optional): Regex patterns for directories to ignore. Default:["\\.git$", "node_modules$"]sse_port(optional): Port for SSE server. Default: 8080log_file(optional): Path to log file. Default: stderr. Supports tilde expansion.
The server automatically ignores common directories that shouldn't contain user documentation:
Default ignored:
.git- Version control directoriesnode_modules- Node.js dependencies
Custom regex patterns example:
{
"ignore_dirs": [
"\\.git$", // Git directories
"node_modules$", // Node.js dependencies
"target$", // Rust/Java build output
"dist$" // Build output
]
}Find markdown files with optional filtering and pagination.
Parameters:
query(optional): Filter files by name containing this stringpage_size(optional): Limit results (default: 50, max: configurable)
Returns: JSON with file list, metadata, and count.
Read content of a specific markdown file by filename.
Parameters:
filename(required): File name with or without.mdextension
Returns: File content as text.
Security: Only accepts filenames (no paths). Searches configured directories automatically.
Enable with "debug_logging": true in config file.
# Check MCP server status
claude mcp list
# Test MCP tools in Claude Code
/mcpLook for the server in the MCP section of Claude Desktop settings, or check the logs for startup messages.
Refer to your specific MCP client's documentation for verification steps.
# Start server (will show startup logs)
./markdown-reader-mcp ~/your/docs
# Look for:
# "Scanning directories: [...]"
# "Ignoring directories matching patterns: [...]"
# "Starting Markdown Reader MCP server..."- Clone repository
- Install pre-commit (optional):
pip install pre-commit pre-commit install
- Run tests:
go test -v - Build:
go build