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
Metadata
Release files for rules-mcp-server 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| rules_mcp_server-1.0.0.tar.gz | 16.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rules_mcp_server-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.4 kB
Release files / rules_mcp_server-1.0.0.tar.gz
| Download URL | rules_mcp_server-1.0.0.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ede93ba59ce05698390cc422b655d574c933fdc25155787aa7c222185a1176b2
|
|
BLAKE2b-256 checksum How to use checksums |
28899f8892dca5121e9f0118d730e3b5debff036a097fcc0d5b9ebd5a7b931c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / rules_mcp_server-1.0.0-py3-none-any.whl
| Download URL | rules_mcp_server-1.0.0-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d325b65de921e9e07935e056fcac2211d1adf62d7275d5149431b29ff9b97b7a
|
|
BLAKE2b-256 checksum How to use checksums |
bfcae3132b97d06bce1607d847b99dd5c1b6c8cc2fa33f21c62a0c1bdd849e75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for rules-mcp-server 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.