SleepBlocker MCP
Enables AI assistants to control Mac sleep settings by preventing sleep for configurable durations and modes using natural language commands.
README
š«š¤ Sleep Blocker MCP Server
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.
⨠Features
- šÆ 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
š Quick Start
1-Minute Setup
# Clone this repository
git clone https://github.com/yourusername/SleepBlocker-MCP.git
cd SleepBlocker-MCP
# Run the installer
./install.sh
# Follow the setup instructions
Manual Setup
# Make server executable
chmod +x mcp_server.py
# Test the server
echo '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}' | python3 mcp_server.py
Configure Your AI Assistant
For Claude Code, add to your MCP settings:
{
"mcpServers": {
"sleep-blocker": {
"command": "python3",
"args": ["/path/to/SleepBlocker-MCP/mcp_server.py"]
}
}
}
š¬ Usage Examples
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"
š ļø Available Tools
| Tool | Description | Example |
|---|---|---|
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" |
šÆ Sleep Prevention Modes
- š„ļø 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)
š Requirements
- macOS (any version with
caffeinatecommand) - Python 3.7+
- MCP-compatible client (Claude Code, Cursor, etc.)
š Documentation
- š 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
šŖ Real-World Use Cases
šØāš¼ Professional
- 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
šµ Creative
- Music Production - Keep drives spinning for sample libraries
- Video Editing - Prevent interruptions during renders
- Live Streaming - Maintain system during broadcasts
š® Personal
- Gaming - Extended gaming sessions
- Movie Nights - Keep display on for movies
- File Organization - System stays awake during large operations
š Security & Privacy
- ā 100% Local - No network connections or data sharing
- ā
Standard Tools - Uses only macOS built-in
caffeinatecommand - ā Process Safety - Automatic cleanup and proper termination
- ā No Permissions - No special system permissions required
šÆ Quick Test
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"
š Need Help?
- Installation Issues: Run
./install.shand follow the colored output - Connection Problems: Check Troubleshooting Guide
- Usage Questions: See Examples for inspiration
- Technical Details: Review MCP Documentation
š Compatible AI Assistants
- Claude Code ā
- Cursor ā
- Claude Desktop ā
- Windsurf ā
- Any MCP-compatible client ā
š¦ What's Included
SleepBlocker-MCP/
āāā mcp_server.py # Main MCP server
āāā install.sh # Automated installer
āāā package.json # MCP configuration
āāā README.md # This file
āāā USER_GUIDE.md # Complete user guide
āāā EXAMPLES.md # Usage examples
āāā TROUBLESHOOTING.md # Problem solving
āāā README_MCP.md # Technical documentation
āāā DISTRIBUTION.md # Distribution guide
āāā LICENSE # MIT License
š Getting Started in 30 Seconds
# 1. Clone and setup
git clone https://github.com/yourusername/SleepBlocker-MCP.git
cd SleepBlocker-MCP
./install.sh
# 2. Add to your AI assistant's MCP config
# (Path shown by installer)
# 3. Restart your AI assistant
# 4. Try it out!
# Say: "Keep my Mac awake for 30 minutes"
š Why Sleep Blocker MCP?
- š£ļø 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
š¤ Contributing
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.
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š Acknowledgments
- Built with the Model Context Protocol
- Uses macOS built-in
caffeinatecommand - 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!
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.