Skip to main content
Glama
README.md
<!-- mcp-name: io.github.RIAEvangelist/roshi-signal-mcp -->

[![Roshi's Signal MCP — local Signal export, privacy redaction, watch triggers, and sending](./assets/roshi-signal-mcp-header.png)](https://riaevangelist.github.io/roshi-signal-mcp/)

# Roshi's Signal MCP

<p align="center">
  <strong>Read, search, export, redact, watch, and send Signal Desktop messages from any MCP-compatible AI.</strong><br>
  Live read-only access to encrypted Signal Desktop databases and media, enforced by a lockable local privacy policy and declarative trigger engine.
</p>

<p align="center">
  <a href="https://riaevangelist.github.io/roshi-signal-mcp/"><strong>Visit the documentation site</strong></a>
  &nbsp;&middot;&nbsp;
  <a href="https://github.com/RIAEvangelist/roshi-signal-mcp"><strong>GitHub repository</strong></a>
  &nbsp;&middot;&nbsp;
  <a href="https://glama.ai/mcp/servers/RIAEvangelist/roshi-signal-mcp"><strong>Glama directory</strong></a>
</p>

<p align="center">
  <a href="#install-in-seconds">Install</a>
  &nbsp;&middot;&nbsp;
  <a href="#works-with-every-major-ai">Supported AIs</a>
  &nbsp;&middot;&nbsp;
  <a href="#capabilities-at-a-glance">Capabilities</a>
  &nbsp;&middot;&nbsp;
  <a href="#direct-search-and-date-ranges">Search &amp; dates</a>
  &nbsp;&middot;&nbsp;
  <a href="#crash-safe-resumable-exports">Resumable exports</a>
  &nbsp;&middot;&nbsp;
  <a href="#privacy-ignore-list-and-redaction">Privacy &amp; redaction</a>
  &nbsp;&middot;&nbsp;
  <a href="#watch-and-trigger-automation">Watch &amp; triggers</a>
  &nbsp;&middot;&nbsp;
  <a href="#mcp-tool-surface">MCP tools</a>
  &nbsp;&middot;&nbsp;
  <a href="#cli-reference">CLI</a>
  &nbsp;&middot;&nbsp;
  <a href="#storage-security-and-trust-boundary">Security</a>
  &nbsp;&middot;&nbsp;
  <a href="#verification">Verification</a>
</p>

[![Version 0.2.0](https://img.shields.io/badge/version-0.2.0-3A76F0)](#mcp-tool-surface)
[![Python 3.10+](https://img.shields.io/badge/python-%3E%3D3.10-12d9c4?logo=python&logoColor=white)](#install-in-seconds)
[![MCP 2.x](https://img.shields.io/badge/MCP-2.x%20stdio-12d9c4)](#works-with-every-major-ai)
[![Antigravity Plugin](https://img.shields.io/badge/Antigravity-plugin-12d9c4)](#install-in-seconds)
[![Platforms: Windows, macOS, Linux](https://img.shields.io/badge/platforms-Windows%20%7C%20macOS%20%7C%20Linux-3A76F0)](#install-in-seconds)
[![Unit tests](https://img.shields.io/badge/tests-6%20passing-12d9c4)](#verification)
[![License: MIT](https://img.shields.io/badge/license-MIT-F5A623)](./LICENSE)
[![Glama MCP Server](https://glama.ai/mcp/servers/RIAEvangelist/roshi-signal-mcp/badges/score.svg)](https://glama.ai/mcp/servers/RIAEvangelist/roshi-signal-mcp)

---

## Install in seconds

### Antigravity (one command)

```bash
agy plugin install RIAEvangelist/roshi-signal-mcp
```

Installs the full bundle automatically—**all 21 MCP tools**, the **`roshi-signal-mcp` skill**, and the **bundled safety rules**—and bootstraps an isolated Python environment on first run via [`bootstrap_mcp.py`](./bootstrap_mcp.py).

On Windows, if you cloned the repo locally (or want to also install native `signal-cli` in WSL2 for sending messages):

```powershell
git clone https://github.com/RIAEvangelist/roshi-signal-mcp.git
cd roshi-signal-mcp
.\setup.ps1 -InstallPlugin -InstallSignalCli
```

*(Omit `-InstallSignalCli` if you only need read, search, export, redaction, and watching.)*

---

## Works with every major AI

Because **Roshi's Signal MCP** speaks the open **Model Context Protocol (MCP 2.x over stdio)**, the exact same 21 tools, ignore lists, redaction rules, and watch triggers work across every major AI coding and desktop assistant—plus standalone from your terminal with no AI at all.

| AI Client / Environment | Integration Type | Setup |
| --- | --- | --- |
| **Google Antigravity** (App, CLI, IDE) | Native Plugin (MCP + Skill + Rules) | `agy plugin install RIAEvangelist/roshi-signal-mcp` |
| **Claude Code** | Native Plugin Marketplace (`.claude-plugin/`) | `/plugin marketplace add RIAEvangelist/roshi-signal-mcp` then `/plugin install roshi-signal-mcp` |
| **OpenAI Codex** (CLI & App) | Native Plugin (`.codex-plugin/`) or MCP stdio | `codex plugin marketplace add RIAEvangelist/roshi-signal-mcp --sparse .agents/plugins` or `~/.codex/config.toml` |
| **Claude Desktop / Cursor / Windsurf / Cline / Zed / Gemini CLI** | Standard MCP stdio server | `uvx --from git+https://github.com/RIAEvangelist/roshi-signal-mcp.git roshi-signal-mcp` or `python bootstrap_mcp.py` |
| **Standalone CLI (No AI required)** | PowerShell / Python CLI | `.\signal-cli-tool.ps1 <cmd>` or `python -m signal_mcp.cli <cmd>` |

### Copy-paste MCP & plugin installs

<details>
<summary><strong>Claude Code</strong> (native plugin marketplace or CLI one-liner)</summary>

```bash
# Native plugin (bundles MCP server + skill)
/plugin marketplace add RIAEvangelist/roshi-signal-mcp
/plugin install roshi-signal-mcp

# Or register the MCP server directly via uvx (no git clone needed)
claude mcp add roshi-signal-mcp -- uvx --from git+https://github.com/RIAEvangelist/roshi-signal-mcp.git roshi-signal-mcp
```

</details>

<details>
<summary><strong>OpenAI Codex</strong> (native plugin or <code>~/.codex/config.toml</code>)</summary>

```bash
# Native plugin marketplace
codex plugin marketplace add RIAEvangelist/roshi-signal-mcp --sparse .agents/plugins
codex plugin install roshi-signal-mcp@roshi-signal-mcp-marketplace
```

Or add directly to `~/.codex/config.toml`:

```toml
[mcp_servers.roshi-signal-mcp]
command = "uvx"
args = ["--from", "git+https://github.com/RIAEvangelist/roshi-signal-mcp.git", "roshi-signal-mcp"]
```

</details>

<details>
<summary><strong>Claude Desktop / Cursor / Windsurf / Gemini CLI</strong> (JSON MCP config)</summary>

Zero-clone (`uvx`):

```json
{
  "mcpServers": {
    "roshi-signal-mcp": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/RIAEvangelist/roshi-signal-mcp.git",
        "roshi-signal-mcp"
      ]
    }
  }
}
```

Or from a local clone (no `uv` required):

```json
{
  "mcpServers": {
    "roshi-signal-mcp": {
      "command": "python",
      "args": ["/path/to/roshi-signal-mcp/bootstrap_mcp.py"]
    }
  }
}
```

</details>

<details>
<summary><strong>Manual Antigravity plugin install</strong> (macOS / Linux / Windows)</summary>

Copy the cloned `roshi-signal-mcp` directory into:
- **Windows**: `%USERPROFILE%\.gemini\config\plugins\roshi-signal-mcp`
- **macOS / Linux**: `~/.gemini/config/plugins/roshi-signal-mcp`

On first launch, [`bootstrap_mcp.py`](./bootstrap_mcp.py) creates an isolated venv at `~/.cache/roshi-signal-mcp/venv` and installs `sqlcipher3`, `cryptography`, `mcp`, and `qrcode[pil]` automatically (logging setup output to `stderr` so `stdout` stays clean MCP JSON-RPC).

</details>

---

**Roshi's Signal MCP** (`roshi-signal-mcp`) reads your local **Signal Desktop 7.x / 8.x** database live in read-only WAL mode (while Signal Desktop stays open), decrypts `version = 2` media attachments (`attachments.noindex/`), enforces strict per-user **ignore lists** and **text/metadata redaction rules** before any tool or export sees data, evaluates declarative **watch/trigger rules** for Antigravity or Codex, and optionally sends messages and files through a linked **`signal-cli`** device.

## Capabilities at a glance

| Do this | Start here |
| --- | --- |
| Search Signal chats directly with date ranges, regex, media filters, and `±N` surrounding messages | [`search_messages`](#direct-search-and-date-ranges), [`get_messages`](#mcp-tool-surface) |
| Export a chat and all decrypted images/PDFs/videos into JSON, Markdown, and a searchable HTML gallery | [`export_conversation`](#crash-safe-resumable-exports) |
| Resume an interrupted export, restore deleted/corrupt files, or backfill newly downloaded media | [`resume_export`](#crash-safe-resumable-exports) |
| Block sensitive chats, people, keywords, or regexes from ever being read, exported, watched, or messaged | [`manage_ignore_list`](#privacy-ignore-list-and-redaction), `policy lock` |
| Redact SSNs, cards, emails, phones, API keys, and custom terms across reads, exports, and filenames | [`manage_redaction_rules`](#privacy-ignore-list-and-redaction), [`test_redaction`](#mcp-tool-surface) |
| Trigger auto-replies, incremental exports, Antigravity tasks, or Codex/CLI commands on incoming Signal messages | [`add_watch_rule`](#watch-and-trigger-automation), [`manage_signal_watcher`](#mcp-tool-surface) |
| Link `signal-cli` via browser QR code and send text or local file attachments by conversation name | [`link_signal_device`](#sending-messages-optional), [`send_signal_message`](#mcp-tool-surface) |

---

## Direct search and date ranges

Exporting an entire chat just to find a few messages is slow and creates unnecessary plaintext copies on disk. `search_messages` queries the live Signal Desktop SQLCipher database directly while still passing every hit through the privacy ignore list and redaction engine:

- **Filters**: `query` (substring or `regex=True`), `conversation`, `sender`, `has_media=True`, `since`, `until`, `offset`, and `limit`.
- **Surrounding context**: pass `context_messages=2` (0–10) to include the non-ignored, redacted messages immediately before and after each match—useful when a receipt image and its description arrive in separate messages.
- **Inclusive date ranges**: date-only `until` filters (`YYYY-MM-DD`) automatically resolve to `23:59:59.999` local time so `since="2026-06-01", until="2026-06-30"` includes all of June 1 through all of June 30 across `get_messages`, `search_messages`, and `export_conversation`.
- **Anti-oracle protection**: search queries are re-verified post-redaction so searching for a redacted secret cannot be used to discover whether that secret exists in a chat.

---

## Crash-safe, resumable exports

`export_conversation` decrypts local attachments from `attachments.noindex/` into `<output_dir>/media/` with chronological, collision-free filenames (`YYYY-MM-DD_HHMMSS_<sender>_<id>_<idx>.<ext>`) and original message timestamps (`mtime`), alongside `messages.json`, `chat.md`, a self-contained searchable `index.html` gallery, and `manifest.json`.

- **Atomic writes**: each decrypted media file is written to `<name>.part` first and atomically renamed on completion, so interruptions never leave half-written corrupt images.
- **Interrupted & partial recovery**: `manifest.json` records `inProgress`, saved export options (`since`, `until`, `formats`, `mediaOnly`), exported file keys, and previously missing/undownloaded attachment keys.
- **One-call resume & backfill**: call `resume_export(output_dir)` (or `.\signal-cli-tool.ps1 resume-export <dir>`) to:
  1. Remove any leftover `.part` files from an interrupted run.
  2. Restore any exported media file that was deleted or corrupted on disk.
  3. Backfill attachments that were previously unavailable locally once Signal Desktop downloads them.
  4. Pick up newly arrived messages (pass `expand_until_to_now=True` to extend a previously date-bounded export).

---

## Privacy, ignore list, and redaction

All privacy rules live privately outside the repository at `~/.roshi-signal-mcp/privacy_policy.json` (override with `ROSHI_SIGNAL_STATE_DIR`) and are enforced at the lowest data-access layer (`desktop_db.py`, `exporter.py`, `watcher.py`, `sender.py`).

### Strict ignore list

Block anything you cannot or do not want read, searched, exported, extracted, watched, or messaged:

| Category | What it blocks |
| --- | --- |
| `conversations` | Exact name, glob (`Attorney*`), UUID, group ID, or phone — completely hidden from `list_conversations` and raises `PermissionError` on read, export, extract, watch, or send. |
| `senders` | Person's name, phone, or ACI — hides their private DM **and** strips their messages and reactions from shared group chats. |
| `keywords` | Any message whose body, quote, caption, or attachment filename contains the term is omitted entirely. |
| `regexes` | Any message matching the pattern is omitted entirely. |

### Text and metadata redaction

- **Built-in presets**: `ssn` (SSN/ITIN), `credit_card` (Luhn-validated to avoid false positives on order/tracking numbers), `email`, `phone`, `secrets` (API keys, Bearer tokens, private key blocks), `bank_account`, and `ipv4`.
- **Custom rules**: literal terms (`add_term`, optional `whole_word` and `case_sensitive`) and custom regexes (`add_regex`) with custom replacement labels such as `[REDACTED:CLIENT]`.
- **Text-only scope**: redaction applies to message bodies, expanded long messages, quotes, attachment captions, attachment filenames, sender/conversation labels, exported transcripts (`messages.json`, `chat.md`, `index.html`), exported media filenames, and watch payloads. **Binary images and PDFs are not OCR-redacted.** If you need to exclude media whenever a message triggers redaction, enable `set_block_media_on_redacted(True)` or place the chat/sender on the ignore list.

### Tamper-resistant CLI lock

```powershell
.\signal-cli-tool.ps1 policy lock
```

While locked, AI agents calling MCP tools can inspect the policy and **add** new ignore entries or redaction rules, but **cannot** remove ignore entries, disable redaction, or weaken presets (`PolicyLockedError`). Unlocking requires running `.\signal-cli-tool.ps1 policy unlock` directly from your shell (or editing `~/.roshi-signal-mcp/privacy_policy.json`).

---

## Watch and trigger automation

Store declarative rules in `~/.roshi-signal-mcp/watch_rules.json` so Antigravity or Codex can react to incoming Signal messages automatically:

- **Matchers**: `conversation`, `sender`, `contains`, `regex`, `has_media`, `include_outgoing` (`false` by default to prevent reply loops), and `cooldown_seconds`.
- **Actions** (one or more per rule; all template variables `{sender}`, `{conversation}`, `{body}`, `{timestamp}`, `{attachment_paths}` and `SIGNAL_*` env vars are redacted first):
  - `reply` — auto-reply on Signal via `signal-cli`
  - `export` — incrementally export the chat and decrypted media
  - `antigravity_task` — start a new Antigravity conversation via the local `ConversationService` API with your prompt template and extracted attachment paths
  - `command` — run any local CLI or script (e.g. `codex exec`, Python script, or webhook)
- **Two ways to run**:
  - **Live background watcher**: `manage_signal_watcher(action="start", poll_interval_seconds=3)` or `.\signal-cli-tool.ps1 watch run`
  - **Scheduled / cursor-based check**: `check_new_messages()` or `run_watch_rules_once(dry_run=...)` (pairs cleanly with Antigravity `/schedule` or Task Scheduler/cron)

---

## Sending messages (optional)

Reading, searching, exporting, privacy filtering, and watching require **only Signal Desktop**. Sending messages and attachments uses **`signal-cli`** linked to your account as a secondary device:

1. Ensure `signal-cli` is installed (`.\setup.ps1 -InstallSignalCli` on Windows WSL2, `brew install signal-cli` on macOS, or `~/.local/bin/signal-cli` on Linux).
2. Start pairing and scan the browser QR code in **Signal (Phone) → Settings → Linked Devices → Link New Device**:
   ```powershell
   .\signal-cli-tool.ps1 link --open --wait
   ```
   *(Or ask Antigravity to call `link_signal_device(open_browser=True)`.)*
3. Sync your contacts and groups:
   ```powershell
   .\signal-cli-tool.ps1 sync
   ```
4. Preview target resolution safely with `--dry-run` (or `dry_run=True` in MCP) before sending.

---

## MCP tool surface

All **21 tools** are exposed over standard MCP stdio (`server.py`):

| Category | Tool | Purpose |
| --- | --- | --- |
| **Read & Search** | `list_conversations` | List/filter non-ignored Signal Desktop chats & groups with message and local media counts |
| | `get_messages` | Read messages from a chat with inclusive date range (`since`/`until`), `has_media`, and search |
| | `search_messages` | Search directly in SQLite with date range, sender, media, regex, pagination, and `±N` context |
| | `extract_attachment` | Decrypt a single attachment by `message_id` to disk for direct inspection |
| **Export & Resume** | `export_conversation` | Export messages + decrypted media to JSON, Markdown, and a searchable HTML gallery |
| | `resume_export` | Recover interrupted exports, repair missing/corrupt files, and backfill newly downloaded media |
| **Privacy Policy** | `get_privacy_policy` | Inspect active ignore lists, redaction presets/rules, lock status, and policy path |
| | `manage_ignore_list` | Add/remove ignored conversations, senders, keywords, or regexes (respects CLI lock) |
| | `manage_redaction_rules` | Toggle presets, literal terms, regexes, and `block_media_on_redacted` (respects CLI lock) |
| | `test_redaction` | Preview redaction and ignore matching on sample text without touching Signal |
| **Watch & Triggers** | `list_watch_rules` | List configured Signal watch/trigger rules |
| | `add_watch_rule` | Create a rule matching conversation/sender/text/media -> reply/export/task/command |
| | `toggle_watch_rule` | Enable or disable a watch rule by ID or name |
| | `delete_watch_rule` | Delete a watch rule by ID or name |
| | `check_new_messages` | Return only brand-new messages since the saved cursor |
| | `run_watch_rules_once` | Evaluate enabled rules once against new messages (supports `dry_run=True`) |
| | `manage_signal_watcher` | Start, stop, inspect, or reset the cursor of the live background watcher |
| **Sending** | `signal_send_status` | Check `signal-cli` backend availability and linked account(s) |
| | `link_signal_device` | Start Signal linked-device pairing and generate QR PNG + browser HTML page |
| | `sync_signal_account` | Sync contacts and groups from your primary phone into `signal-cli` |
| | `send_signal_message` | Send text and/or local file attachments by chat name, phone, UUID, or group ID |

---

## CLI reference

Run commands on Windows with `.\signal-cli-tool.ps1 <command>` (or cross-platform with `python -m signal_mcp.cli <command>`):

```powershell
# List chats
.\signal-cli-tool.ps1 list --search "Family"

# Search directly with date range, sender filter, and ±2 context messages
.\signal-cli-tool.ps1 search "invoice" --conversation "Family Chat" --since 2026-06-01 --until 2026-06-30 --context 2

# Export a date range and later resume/backfill newly downloaded media
.\signal-cli-tool.ps1 export "Family Chat" --since 2026-01-01 --until 2026-06-30 --output "C:\Exports\Family_H1"
.\signal-cli-tool.ps1 resume-export "C:\Exports\Family_H1" --expand-until-to-now

# Configure ignore list & redaction, then lock policy from AI tampering
.\signal-cli-tool.ps1 ignore add conversations "Attorney*"
.\signal-cli-tool.ps1 ignore add senders "+15551234567"
.\signal-cli-tool.ps1 redact preset-on ssn
.\signal-cli-tool.ps1 redact preset-on secrets
.\signal-cli-tool.ps1 redact add-term "ClientName" --replacement "[REDACTED:CLIENT]" --whole-word
.\signal-cli-tool.ps1 policy lock

# Add a watch rule and run the live daemon
.\signal-cli-tool.ps1 watch add --name "Urgent Ack" --contains "urgent" --reply "Got it, {sender}!"
.\signal-cli-tool.ps1 watch run --interval 3

# Link signal-cli via browser QR and preview a send
.\signal-cli-tool.ps1 link --open --wait
.\signal-cli-tool.ps1 sync
.\signal-cli-tool.ps1 send "Family Chat" "Hello!" --dry-run
```

---

## Storage, security, and trust boundary

- **100% local execution**: Signal Desktop reading, SQLCipher decryption, attachment decryption, ignore-list filtering, and redaction run locally under your OS user session. Database keys (`encryptedKey` / SQLCipher hex key) and attachment `localKey` values stay in memory only and are never written to logs, exports, or config files.
- **External state paths**: user exports default to `~/SignalExports/` (override via `SIGNAL_EXPORT_DIR`), privacy policies and watch state live in `~/.roshi-signal-mcp/` (override via `ROSHI_SIGNAL_STATE_DIR`), and `signal-cli` keys remain in `signal-cli`'s own data directory—keeping the plugin repository free of personal data.
- **Unencrypted exports**: exported `messages.json`, `chat.md`, `index.html`, and `media/` files are plaintext on disk once exported; store them in an appropriately protected folder.
- **Revocable sending**: `signal-cli` operates as a standard Signal linked device and can be unlinked at any time from **Signal → Settings → Linked Devices**. The bundled plugin safety rules ([`rules/AGENTS.md`](./rules/AGENTS.md)) instruct agents to confirm recipient, text, and attachments before sending and never attempt to bypass ignore-list errors.

---

## Verification

The test suite uses an isolated temporary SQLCipher profile and never touches your real Signal Desktop data or `~/.roshi-signal-mcp/` configuration:

```powershell
python -m unittest discover -s tests -v
```

Current automated suite (`6` tests in [`tests/test_privacy_and_watch.py`](./tests/test_privacy_and_watch.py)) verifies:

1. Ignore-list enforcement across `list_conversations`, `get_messages`, `search_messages`, `extract_attachment`, `send_message`, and `add_watch_rule`.
2. Text/metadata redaction presets (including Luhn card validation and SSN/ITIN), custom terms/regexes, export leak checks (JSON, Markdown, HTML, media filenames), anti-oracle search behavior, and optional `blockMediaOnRedactedMessage`.
3. CLI policy lock enforcement preventing MCP-level weakening while still allowing stricter additions.
4. Watch rule matching, loop protection (`includeOutgoing=False`), deduplication, and redacted command payloads.
5. Direct search filters (`since`/`until` inclusive end-of-day, `sender`, `has_media`, `regex`, `context_messages`).
6. Crash-safe `resume_export` recovery of `.part` leftovers, deleted media files, and backfilled newly downloaded attachments.

---

## License

MIT — see [`LICENSE`](./LICENSE).

TDQS

A3.5/5.0

Scored across 21 tools

Disambiguation4/5

Most tools target a distinct resource+action (list_conversations vs get_messages vs search_messages vs check_new_messages are separated by scope: enumerate chats, fetch a thread, filtered search, cursor-based new-only). A few pairs blur slightly: sync_signal_account vs link_signal_device (both setup), and run_watch_rules_once vs manage_signal_watcher (evaluate once vs control background loop), but the descriptions resolve them.

Naming Consistency4/5

Nearly all tools follow a verb_noun snake_case pattern (list_conversations, get_messages, add_watch_rule, delete_watch_rule, manage_ignore_list). The main deviation is signal_send_status, which is noun-first instead of something like check_send_status, plus the adverbial suffix in run_watch_rules_once. Still highly predictable overall.

Tool Count4/5

21 tools is on the heavy side, but the surface splits cleanly into justified sub-domains: messaging, conversation reads, export/attachments, privacy policy, watch-rule CRUD, and account linking. Each tool maps to a real operation rather than a duplicate, though a couple (resume_export vs export_conversation, test_redaction) could arguably be folded in.

Completeness4/5

Strong lifecycle coverage: read (get/search/check), write (send with attachments), export/resume/extract, privacy configuration, watch-rule CRUD plus one-shot and background execution, and device linking. Gaps are group administration (create group, add/remove members) and message-level operations (delete/edit/mark read), which are workarounds rather than core blockers.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues