Skip to main content
Glama
time-machine-mcp

time-machine-mcp

by deeplook
README.md
# Time Machine MCP Server

This MCP (Model Context Protocol) server exposes Apple macOS Time Machine utilities (`tmutil`) to LLMs. It allows you to manage backups, check status, and inspect snapshots directly using natural language.

## Features

The server provides the following tools and resources:

* **Backup Management:** `start_backup`, `stop_backup`, `disable`, `enable`
* **Snapshot Inspection:** `list_backups`, `latest_backup`, `list_local_snapshots`, `unique_size`
* **Maintenance:** `delete_backups`, `thin_local_snapshots`, `verify_checksums`, `calculate_drift`
* **Configuration:** `add_exclusion`, `remove_exclusion`, `set_destination`, `set_quota`
* **Resources:** Access to the `tmutil` man page.

## Prerequisites

* **macOS**: This server relies on the `tmutil` system command, which is specific to macOS.
* **Python 3.12+** (lower versions might work, too)
* **uv**: Recommended for dependency management.

## Installation

This installs a `time-machine-mcp` executable:

```bash
❯ uv tool install "git+https://github.com/deeplook/time-machine-mcp-server.git"

❯ uv tool install .
```

Verify the tool has been installed:

```bash
❯ uv tool list | grep time-machine
time-machine-mcp-server v0.1.0
- time-machine-mcp
```

## Usage

### Gemini CLI

Add an entry for this server to your `~/.gemini/settings.json`:

```json
{
  "mcpServers": {
    "time-machine-mcp": {
      "command": "time-machine-mcp"
    }
  }
}
```

```bash
❯ gemini mcp list | grep time-machine
✓ time-machine-mcp: time-machine-mcp  (stdio) - Connected
```

### Claude Desktop (Anthropic)

Edit `~/Library/Application Support/Claude/claude_desktop_config.json` and add an entry under `mcpServers`:

```json
"time-machine-mcp": {
  "command": "time-machine-mcp"
}
```

### Example chat client (source-only)

`tm_chat.py` is an example client and is **not** shipped in the installed tool. Run it from a clone:

```bash
❯ git clone https://github.com/deeplook/time-machine-mcp-server
❯ cd time-machine-mcp-server
❯ uv sync --extra chat
❯ uv run --script tm_chat.py
```

### Claude Code CLI (Anthropic)

```bash
❯ claude mcp add time-machine -- time-machine-mcp

❯ claude mcp list | grep time-machine
time-machine: time-machine-mcp  - ✓ Connected
```

### Codex CLI (OpenAI)

```bash
❯ codex mcp add time-machine-mcp -- $(which time-machine-mcp)
❯ grep time ~/.codex/config.toml
❯ codex mcp list | grep time-machine
```

## Example Requests

Here are some natural language requests you can use with this server (please note that some might take a long time depending on the size of the backups):

1.  "Start a new backup immediately."
2.  "What is the current status of Time Machine?"
3.  "List all my completed backups."
4.  "Show me the path to the latest backup."
5.  "Exclude the '/Users/me/Downloads' directory from future backups."
6.  "Where are my backups currently being stored?"
7.  "Compare the '/Users/me/Projects' directory with the latest backup."
8.  "Stop the currently running backup."
9.  "Restore '/Users/me/important.doc' from the latest backup to the Desktop."
10. "List the 10 largest files in my latest time-machine backup."

### Transport

This server only supports **stdio** transport (the default for MCP). SSE/HTTP transport is intentionally not supported because:

- **Time Machine is local**: Backups are managed on the local machine; there's no need for network access.
- **Privileged operations**: Many commands require `sudo` and expose destructive actions (`delete_backups`, `restore`).
- **No authentication overhead**: stdio provides process-level isolation without requiring API keys or TLS.

If you need remote management of Time Machine across multiple Macs, see `SSE_IMPLEMENTATION.md` for the security controls that would be required.

### Limitations

- There is no `tmutil` command to list existing exclusions.
- Some `tmutil` operations can be slow and may time out in clients with short tool timeouts.
- Some operations may require additional permissions (e.g., Full Disk Access and/or `sudo`).

### Privileged Operations

Some Time Machine operations require root privileges. The MCP server uses `sudo -n` (non-interactive), which fails if a password is required—this is intentional since password prompts would break the stdio protocol.

**Operations requiring root:**

| Operation | Needs Root |
|-----------|------------|
| `delete_backups` | Yes |
| `associate_disk` | Yes |
| `enable` / `disable` | Yes |
| `restore` | Sometimes |
| `start_backup`, `status`, `list_backups` | No |

**Options for enabling privileged operations:**

1. **Pre-authenticate sudo** (recommended for casual use)

   Run `sudo -v` before starting your MCP client to cache credentials:
   ```bash
   sudo -v && claude  # or gemini, etc.
   ```
   Credentials typically last 5-15 minutes depending on your sudoers config.

2. **Passwordless sudo for tmutil** (persistent)

   Create `/etc/sudoers.d/tmutil` with:
   ```
   %admin ALL=(ALL) NOPASSWD: /usr/bin/tmutil
   ```
   This allows the `admin` group to run tmutil without a password.

3. **Handle manually**

   When privileged operations fail, the server returns helpful error messages suggesting the manual command to run.

### Token Usage

Several tools produce potentially large output (`list_backups`, `list_local_snapshots`, `compare_paths`, `calculate_drift`, `unique_size`). These always write results to a file (e.g., `/tmp/tm_listbackups_20260127_143052.txt`) and return only a summary:

```json
{"output_file": "/tmp/tm_listbackups_20260127_143052.txt", "line_count": 847, "size_bytes": 53248}
```

The LLM will report what was written and ask if you want to see the contents. You can:
- Post-process the file yourself
- Ask the LLM to read specific parts or the entire file

## License

MIT

TDQS

B3.1/5.0

Scored across 31 tools

Disambiguation4/5

Most tools map to clearly distinct tmutil actions, and descriptions do a good job distinguishing backup, restore, status, destination, and exclusion operations. Some overlap remains among deletion and listing variants, especially delete_backups, delete_local_snapshots, thin_local_snapshots, and the local snapshot listing tools.

Naming Consistency3/5

All names use snake_case and are readable, but the set mixes verb_noun names such as list_backups and set_destination with bare verbs like restore and enable, plus noun phrases such as status, version, and destination_info. The convention is mixed rather than consistently verb_noun.

Tool Count2/5

At 31 tools, the surface is large for an MCP server even given the breadth of tmutil. Many tools are thin wrappers around individual tmutil verbs, and the set could likely be consolidated without losing core backup-management capability.

Completeness5/5

The tool surface covers the Time Machine lifecycle comprehensively: backup start/stop/status, restore, local snapshots, deletion/thinning, destination management, quotas, exclusions, checksum verification, drift analysis, comparison, inheritance, association, and help/version queries.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues