# Circadian REM Sleep Cycle Optimizer MCP

> The Circadian REM Sleep Cycle Optimizer calculates optimal wake-up and bedtime schedules based on deep chronobiology. It maps your sleep plan around natural 90-minute REM phases, factoring in how long it takes you to actually fall asleep. Stop guessing—get a precise schedule that aligns with your body's rhythm.

## Overview
- **Category:** productivity
- **Price:** Free
- **Tags:** circadian-rhythm, sleep-optimization, rem-cycle, wellness, time-management, chronobiology

## Description

Sleep planning is complicated. Most generic advice suggesting '8 hours of sleep' misses the point; those arbitrary times often cut through deep restorative cycles, leaving you groggy when you wake up. This MCP solves that by applying real chronobiology rules. It handles everything from mapping your energy peaks to adjusting for how long it takes you to fall asleep. Whether you need a rigid schedule for work or flexible timing for a weekend, this tool figures out the exact timestamps needed. You connect it through Vinkius and let your AI client handle the complex math instantly. Instead of getting generalized advice, you get a calculated timeline that respects your natural sleep architecture.

## Tools

### calculate_circadian_rhythm
Maps out energy peaks and troughs throughout the day based on wake time

### calculate_nap_times
Requires wake-up time in HH:mm.

Calculates the ideal window for power naps based on wake-up time

### calculate_sleep_cycles
Provide a targetTimeStr (HH:mm) and the mode (sleep_at or wake_up_at).

Calculates optimal wake-up or bedtimes aligned with 90-minute REM sleep phases, incorporating latency buffers for circadian rhythm optimization

### calculate_sleep_debt
Requires daily required hours and an array of actually slept hours.

Calculates accumulated sleep debt and provides an actionable recovery strategy

## Prompt Examples

**Prompt:** 
```
I need to wake up at 06:30 for work. What are the best times to go to sleep?
```

**Response:** 
```
Using the calculate_sleep_cycles tool (mode: wake_up_at): The optimal time to get into bed for 6 complete REM cycles is 21:15. For 5 cycles, aim for 22:45. Both times account for a 15-minute sleep latency buffer.
```

**Prompt:** 
```
I am going to sleep right now at 23:00. When should I set my alarm?
```

**Response:** 
```
Using the calculate_sleep_cycles tool (mode: sleep_at): To align with optimal REM phases, you should set your alarm for 06:45 (5 cycles) or 08:15 (6 cycles).
```

**Prompt:** 
```
Calculate a wake-up schedule for 05:00 assuming it takes me 30 minutes to fall asleep.
```

**Response:** 
```
Using the calculate_sleep_cycles tool: The circadian engine confirms that for a 05:00 wake-up with a 30-minute latency, you must get into bed exactly at 21:00 for 5 complete REM cycles.
```

## Capabilities

### Determine daily energy peaks
It maps out expected periods of high focus and low energy across an entire day based on when you plan to wake up.

### Calculate ideal power nap windows
It determines the best time for a quick rest, ensuring the nap falls within natural sleep cycles relative to your eventual wake-up time.

### Align bedtimes or alarms with REM phases
It calculates precise times you need to be asleep or woken up to complete a whole number of 90-minute sleep cycles.

### Assess accumulated sleep deficit
It figures out how much rest you're truly missing and gives you an actionable plan for recovery.

## Use Cases

### The high-intensity coder needs a sustainable schedule.
The developer works late nights and wants to maintain focus. They ask their agent to use calculate_sleep_cycles, setting the alarm for 07:00 AM. The MCP calculates that they must be asleep by 11:30 PM to complete five full cycles, giving them a realistic bedtime goal.

### The parent needs a power nap during a busy day.
A working parent has a hard wake time of 5:30 PM but needs a quick rest. They use calculate_nap_times, and the MCP tells them that a 20-minute window between 1:00 PM and 2:00 PM will be most restorative.

### The student prepping for exams needs to catch up.
A college student realizes they've been running on fumes. They use calculate_sleep_debt, which analyzes their required hours versus actual sleep and provides a multi-day recovery plan.

### The team lead needs to structure an all-hands meeting schedule.
A manager uses the MCP with calculate_circadian_rhythm to avoid scheduling critical meetings during the afternoon energy trough, ensuring peak participation times are respected.

## Benefits

- Stop waking up groggy. The calculate_sleep_cycles tool guarantees your alarm aligns with light sleep phases, not the middle of a deep REM cycle.
- Move beyond vague advice. Instead of guessing, use calculate_nap_times to pinpoint exactly when you need a rest window relative to your wake-up time.
- Know your true deficit. The calculate_sleep_debt tool quantifies how much sleep you actually owe yourself and builds a recovery plan for it.
- Plan the whole day's energy flow, not just bedtime. Use calculate_circadian_rhythm to see when your focus peaks throughout an entire work cycle.
- It accounts for reality. The MCP includes latency buffers in its calculations, knowing that you don't fall asleep instantly.

## How It Works

The bottom line is you feed it a time constraint, and it spits out the scientifically backed window you need to hit that target.

1. First, specify your goal: Are you setting a wake-up alarm or calculating bedtime? What time is that?
2. The MCP runs the data through chronobiology rules, accounting for sleep latency and mapping out full 90-minute REM cycles.
3. You get back specific optimal timestamps (e.g., 'Bed by 10:45 PM') that maximize your natural energy flow.

## Frequently Asked Questions

**How does calculate_sleep_cycles account for falling asleep?**
It incorporates an adjustable 'fall asleep' buffer (latency). This means the calculated bedtime isn't just a raw number; it's buffered to give you realistic time to drift off.

**Can calculate_circadian_rhythm help with my workday timing?**
Yes. It maps out energy peaks and troughs across the day, letting you schedule your most complex tasks during naturally high-focus periods.

**What does calculate_sleep_debt really show me?**
It calculates the difference between what your body needs and what you actually got. Crucially, it doesn't just give a number; it provides an actionable strategy to recover that deficit.

**Is calculate_nap_times better than just taking a short nap?**
Yes, because calculate_nap_times finds the ideal window. It makes sure your power nap doesn't cut off a critical sleep cycle, maximizing the restorative benefit.

**What specific time format does the `calculate_sleep_cycles` tool require for input?**
It requires standard HH:mm strings. The system handles 24-hour clock times consistently, so you don't need to worry about AM or PM when calculating optimal sleep windows.

**If I use `calculate_sleep_debt` and my input hours are impossible, how does the MCP handle the error?**
The MCP validates all time inputs. If your provided array of actual sleep hours falls outside realistic human parameters (like negative or >24 hours), the tool returns a specific validation error detailing which value needs correction.

**Can `calculate_circadian_rhythm` account for other lifestyle factors, like diet or intense exercise?**
No. This MCP focuses strictly on chronobiology and time metrics. While general wellness data is useful context, you must provide only time-based parameters to get accurate results from the rhythm calculation.

**Are there any performance limitations when running `calculate_nap_times` repeatedly?**
No. The calculations are highly optimized. Since it only performs mathematical projections based on simple time inputs, results appear instantly, even if you make several nap window requests in a row.

**What is the 90-minute REM rule?**
Human sleep cycles last approximately 90 minutes. Waking up in the middle of a deep REM phase causes 'sleep inertia' (grogginess). This algorithm targets wake-up times strictly at the end of a cycle, meaning sleeping 7.5 hours (5 cycles) often feels more refreshing than sleeping 8 hours.

**Why use an MCP for sleep math?**
Because calculating multiple backward chronobiological subtraction paths in base-60 time causes frequent LLM errors. By offloading it to this deterministic timeline engine, the calculations are mathematically flawless.

**Does it account for the time it takes to fall asleep?**
Yes. The algorithm incorporates a 'fallAsleepBufferMinutes' parameter (which defaults to 15 minutes). If you need to wake up at 07:00, the 5-cycle target recommends getting into bed at 23:15, allowing exactly 15 minutes to fall asleep before the cycles commence.