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
访问服务器

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!

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选