A Model Context Protocol server for development rules and best practices
Project description
Rules MCP Server
A Model Context Protocol (MCP) server that provides development rules and best practices from markdown files. Similar to Context7's approach, this server dynamically loads rules from markdown files in the rules/ directory.
Features
- Simple API: Only two tools -
get_rulesandlist_rules - Dynamic Loading: Automatically loads any
.mdfiles from therules/directory - File Watching: Automatically reloads rules when files change (optional)
- Metadata Support: Extracts metadata from markdown files for better organization
Installation
From PyPI (Recommended)
pip install rules-mcp-server
From Source
git clone https://github.com/yourusername/rules-mcp-server.git
cd rules-mcp-server
pip install -e .
Prerequisites
- Python 3.8+
- pip
Usage
With Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"rules": {
"command": "rules-mcp-server"
}
}
}
With Cursor
Add to your ~/.cursor/mcp.json:
{
"mcpServers": {
"rules": {
"command": "rules-mcp-server"
}
}
}
Alternative: Using Python Module
{
"mcpServers": {
"rules": {
"command": "python",
"args": ["-m", "rules_mcp_server"]
}
}
}
Local Development
# After installation
rules-mcp-server
# Or run directly
python server.py
Available Tools
get_rules(domain: str)
Get rules and best practices for a specific domain.
Example:
get_rules("react") - Get React development rules
get_rules("security") - Get security best practices
list_rules()
List all available rule domains with descriptions.
Example:
list_rules() - Shows all available rule domains
Adding Rules
Simply add markdown files to the rules/ directory. The filename (without .md) becomes the domain name.
Rule File Format
# Domain Name Rules
## Metadata
- Version: 1.0
- Last Updated: 2025-01-26
- Description: Brief description of the rules
## Your Rules Content
Add your rules, best practices, examples, etc. here.
The server will automatically load this file and make it available
via get_rules("filename").
Example Rule File (rules/typescript.md)
# TypeScript Rules
## Metadata
- Version: 1.0
- Last Updated: 2025-01-26
- Description: TypeScript development best practices
## Type Safety
### Strict Mode
- Always enable strict mode in tsconfig.json
- Use explicit types for function parameters
- Avoid using `any` type
### Interfaces vs Types
- Use interfaces for object shapes
- Use type aliases for unions and primitives
Configuration
Environment variables:
RULES_DIRECTORY: Path to rules directory (default:./rules)WATCH_FILES: Enable file watching (default:true)LOG_LEVEL: Logging level (default:INFO)
File Structure
rules-mcp-server/
├── rules/ # Your rule markdown files
│ ├── react.md
│ ├── security.md
│ ├── typescript.md
│ └── ...
├── src/ # Server source code
├── server.py # Main server entry point
├── requirements.txt # Python dependencies
└── README.md # This file
Contributing
- Add your rule files to the
rules/directory - Follow the markdown format with metadata section
- Test with your MCP client
- Commit and push to your repository
The server will automatically detect and load new rule files!
Publishing to PyPI
Build the Package
python build.py
Test Installation
python test_install.py
Upload to PyPI
# Test PyPI first
twine upload --repository testpypi dist/*
# Then real PyPI
twine upload dist/*
Development
Setup Development Environment
git clone https://github.com/yourusername/rules-mcp-server.git
cd rules-mcp-server
pip install -e .
Run Tests
python test_install.py
Build Package
python build.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rules_mcp_server-1.0.0.tar.gz.
File metadata
- Download URL: rules_mcp_server-1.0.0.tar.gz
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ede93ba59ce05698390cc422b655d574c933fdc25155787aa7c222185a1176b2
|
|
| MD5 |
3fbdbe157fbc8d8de91a8e2f39991bb3
|
|
| BLAKE2b-256 |
28899f8892dca5121e9f0118d730e3b5debff036a097fcc0d5b9ebd5a7b931c3
|
File details
Details for the file rules_mcp_server-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rules_mcp_server-1.0.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d325b65de921e9e07935e056fcac2211d1adf62d7275d5149431b29ff9b97b7a
|
|
| MD5 |
01681c50ec09bff72e08192eb5273b7a
|
|
| BLAKE2b-256 |
bfcae3132b97d06bce1607d847b99dd5c1b6c8cc2fa33f21c62a0c1bdd849e75
|