A minimal, production-ready Model Context Protocol (MCP) server in Python that provides canonical instructions to any MCP-capable AI application.
Ensure you have Python 3.10+ installed. Then install the package:
pip install -e .Or using pip directly:
pip install .python -m mcp_instructions_server.serverOr using the dev script (after installation):
devstartdev- Run the server in development modestart- Start the server in production modelint- Run linting checks using ruffformat- Format code using ruff formatter
The server provides three prompts:
- security - Security instruction for enforcing least privilege and security best practices
- rai_guidance - Responsible AI (RAI) guidance for ethical AI practices
- all_instructions - Combined security and RAI guidance instructions
Example using an MCP client:
# Example: Fetching the security prompt
# The client would call the MCP prompt API to get:
# {
# "role": "system",
# "content": "Enforce least privilege, redact secrets, refuse exploit/abuse content, validate untrusted inputs, prefer most restrictive rule on conflict."
# }The server exposes one resource:
- instructions://canonical - Complete canonical instructions in Markdown format
Example:
# The client would call the MCP resource API to fetch:
# URI: instructions://canonical
# MIME Type: text/markdown
# Content: Markdown with version header and both Security and RAI Guidance sectionsThe server provides a health_check tool that returns server status:
# Example response:
{
"status": "ok",
"serverTime": "2024-01-01T12:00:00.000000Z"
}To integrate the mcp-instructions-server with Cursor, add the following to your Cursor configuration:
{
"mcpServers": {
"instructions": {
"command": "python",
"args": ["-m", "mcp_instructions_server.server"]
}
}
}Note: Adjust the path to Python as needed. If you've installed the package in a virtual environment, you may need to use the full path to the Python executable.
Verify that the prompts panel displays:
securityrai_guidanceall_instructions
Ensure that fetching the instructions://canonical resource returns:
- Markdown content with both Security and RAI Guidance sections
- Version header:
# Instructions Version v1.0.0
Confirm that calling health_check returns:
{"status": "ok", "serverTime": "<ISO8601>"}
mcp_instructions_server/
├── __init__.py # Package initialization
├── server.py # Main entrypoint; registers prompts, resources, tools
├── instructions.py # Stores versioned instruction text
├── prompts.py # Wires MCP prompts
├── resources.py # Wires MCP resources
└── tools.py # Defines health_check tool
- Code Quality: Clean, well-documented code with no TODOs
- Type Hints: Full type annotations throughout
- Logging: Structured logging with graceful shutdown handling
- Linting: Run
lintto check code quality - Formatting: Run
formatto format code
To update the instruction content, edit mcp_instructions_server/instructions.py:
- Update
INSTRUCTIONS_VERSIONas needed - Modify
SECURITY_INSTRUCTIONfor security guidelines - Modify
RAI_GUIDANCEfor RAI guidance - The
ALL_INSTRUCTIONS_MDwill automatically include both sections
MIT