Control your Mac's sleep settings through AI assistants using the Model Context Protocol (MCP)
Sleep Blocker MCP Server enables AI assistants like Claude Code to prevent your Mac from sleeping using natural language commands. Built on the Model Context Protocol, it provides seamless integration with various AI development tools.
- 🎯 Natural Language Control - "Keep my Mac awake for 2 hours"
- 🔧 Multiple Sleep Modes - Display, idle, disk, AC power, and all
- ⏰ Flexible Duration - Preset durations or custom times
- 📊 Status Monitoring - Check active prevention and remaining time
- 🛡️ Safe Operation - Automatic cleanup and error handling
- 🔌 Universal MCP Compatibility - Works with Claude Code, Cursor, and more
For Claude Code, add to your MCP settings:
Once configured, you can use natural language with your AI assistant:
- "Prevent my Mac from sleeping for the next hour"
- "Keep my screen on during this presentation"
- "Stop sleep prevention"
- "What's my current sleep status?"
- "Show me all available sleep modes"
| start_sleep_prevention | Start preventing sleep with mode and duration | "Keep system awake for 2 hours" |
| stop_sleep_prevention | Stop active sleep prevention | "Allow my Mac to sleep again" |
| get_sleep_status | Check current status and remaining time | "How much time is left?" |
| list_sleep_modes | Show all available prevention modes | "What sleep modes are available?" |
| set_duration_preset | Use preset durations (30min, 1hr, 2hr, 4hr) | "Set to 1 hour preset" |
- 🖥️ Display - Keep screen on, allow system sleep
- 💤 Idle - Keep system awake, allow display sleep (default)
- 💾 Disk - Keep hard drives spinning
- 🔌 AC Power - Only prevent sleep when plugged in
- 🚫 All - Prevent all sleep (display + system + disk)
- macOS (any version with caffeinate command)
- Python 3.7+
- MCP-compatible client (Claude Code, Cursor, etc.)
- 📖 User Guide - Complete setup and usage guide
- 💡 Examples - Real-world usage scenarios
- 🔧 Troubleshooting - Common issues and solutions
- ⚙️ Technical Details - MCP implementation details
- 📦 Distribution Guide - Packaging and distribution
- Presentations - Keep screen on during demos
- Long Downloads - Prevent sleep during file transfers
- Video Calls - Maintain display during meetings
- Development - Keep system active during builds
- Music Production - Keep drives spinning for sample libraries
- Video Editing - Prevent interruptions during renders
- Live Streaming - Maintain system during broadcasts
- Gaming - Extended gaming sessions
- Movie Nights - Keep display on for movies
- File Organization - System stays awake during large operations
- ✅ 100% Local - No network connections or data sharing
- ✅ Standard Tools - Uses only macOS built-in caffeinate command
- ✅ Process Safety - Automatic cleanup and proper termination
- ✅ No Permissions - No special system permissions required
After installation, test with your AI assistant:
- "What sleep prevention modes are available?"
- "Start sleep prevention for 5 minutes"
- "Check my sleep status"
- "Stop sleep prevention"
- Installation Issues: Run ./install.sh and follow the colored output
- Connection Problems: Check Troubleshooting Guide
- Usage Questions: See Examples for inspiration
- Technical Details: Review MCP Documentation
- Claude Code ✅
- Cursor ✅
- Claude Desktop ✅
- Windsurf ✅
- Any MCP-compatible client ✅
- 🗣️ Natural Language - No complex commands to remember
- 🔧 Flexible Control - Multiple modes for different needs
- ⚡ Instant Setup - Working in minutes, not hours
- 🛡️ Rock Solid - Proper error handling and cleanup
- 📖 Great Docs - Clear guides for every skill level
- 🔄 Universal - Works with any MCP-compatible AI assistant
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with the Model Context Protocol
- Uses macOS built-in caffeinate command
- Inspired by the need for AI-controlled system management
Ready to take control of your Mac's sleep settings with AI?
⭐ Start with the installation script →
Made with ❤️ for the MCP community. Questions? Check the User Guide or Troubleshooting docs!
.png)


