SleepBlocker MCP

SleepBlocker MCP

Enables AI assistants to control Mac sleep settings by preventing sleep for configurable durations and modes using natural language commands.

Category
Visit Server

README

šŸš«šŸ’¤ Sleep Blocker MCP Server

Control your Mac's sleep settings through AI assistants using the Model Context Protocol (MCP)

macOS Python MCP License

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 caffeinate command)
  • Python 3.7+
  • MCP-compatible client (Claude Code, Cursor, etc.)

šŸ“š Documentation

šŸŽŖ 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 caffeinate command
  • āœ… Process Safety - Automatic cleanup and proper termination
  • āœ… No Permissions - No special system permissions required

šŸŽÆ Quick Test

After installation, test with your AI assistant:

  1. "What sleep prevention modes are available?"
  2. "Start sleep prevention for 5 minutes"
  3. "Check my sleep status"
  4. "Stop sleep prevention"

šŸ†˜ Need Help?

  1. Installation Issues: Run ./install.sh and follow the colored output
  2. Connection Problems: Check Troubleshooting Guide
  3. Usage Questions: See Examples for inspiration
  4. 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 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!

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured