retrace-mcp

retrace-mcp

Read-only MCP server for searching your local Retrace screen-history database, with tools for full-text search, segment listing, frame details, app usage, and tags.

Category
访问服务器

README

retrace-mcp

Read-only MCP server over the local Retrace screen-history database, so Claude can search what has been on your screen.

Six tools. No write path anywhere in the code — not a disabled one, none.

Read SECURITY.md before connecting this to anything. It exposes the OCR'd text of everything you have had on screen, and the prompt-injection section describes a risk the deny-list does not cover.

search_text("quarterly planning")
  2026-02-11T09:00:00-08:00  Google Chrome   Quarterly planning - Docs
    ...Quarterly <mark>planning</mark> document. Revenue targets for the...

Requirements

macOS with Retrace installed, uv, and the claude CLI. Python ≥3.11 (uv provisions its own, so a system Anaconda will not be picked up). Built and verified against Retrace 0.8.7.

Install

git clone https://github.com/calvingunther66/retracemcpclaude.git
cd retracemcpclaude
bash install.sh

Installs systemwide (claude mcp add --scope user) — available in every Claude session on the machine. The installer creates your config from the example, verifies your database schema matches what the server expects, runs the test suite, and only then registers the server.

Remove it at any time:

claude mcp remove retrace

Tools

Every tool takes an optional limit (default 20, maximum 100). Timestamps cross the boundary as ISO 8601 local time in both directions — pass 2026-02-11 or 2026-02-11T09:30:00, get back 2026-02-11T09:30:00-08:00. Raw epoch milliseconds never leak out. Every tool applies the deny-list inside its SQL.

Tool Returns
search_text(query, start?, end?, bundle_ids?, limit?) Full-text search over screen OCR. One hit per frame with a <mark>-highlighted snippet, app, window title, URL, and the video id / frame index.
list_segments(start?, end?, bundle_id?, limit?) Capture segments — one contiguous stretch in one app window — with start, end and duration.
get_frame(frame_id, limit?) One frame with its OCR text boxes and parent segment.
app_usage(start, end, limit?) Time per app across a window, ordered descending, with display names.
list_tags(limit?) / segments_by_tag(tag, limit?) Retrace's segment tags.

search_text accepts FTS5 syntax: invoice, "exact phrase", budget NEAR/5 forecast, sched*.

OCR box geometry is normalised 0.0–1.0, not pixels. Multiply by the video's width and height for pixel coordinates.

processing_queue is never queried — it is the hot live OCR queue.

Configuration

retrace_mcp.toml in the repo root, created from retrace_mcp.example.toml on install. Changes take effect on restart.

[database]
path = "~/Library/Application Support/Retrace/retrace.db"

[privacy]
exclude_bundles         = ["com.apple.Terminal", "com.1password.1password", ...]
exclude_url_patterns    = ["chase.com", "vanguard.com", ...]
exclude_window_patterns = ["1Password", "Online Banking", ...]
exclude_hidden_segments = true
skip_redacted           = true
Key Effect
exclude_bundles App bundle IDs hidden from every tool.
exclude_url_patterns Substrings matched against the segment's browser URL.
exclude_window_patterns Substrings matched against the window title.
exclude_hidden_segments Honour Retrace's own hidden tag.
skip_redacted Drop rows whose snippet is rtx1. redaction ciphertext.

Why URL and window patterns exist. Excluding applications is not enough on its own. Banking, webmail and health portals run inside a browser, under an allowed bundle ID — a bundle-only deny-list leaves every one of those pages fully searchable. The URL and window lists are what actually close that gap, and they are the ones worth maintaining.

Filters are applied inside each query, never as a post-filter. Post-filtering leaks through LIMIT: an excluded row would consume a result slot, and its text would have been read into the process regardless. % and _ in patterns are escaped and matched literally.

Defaults ship excluding terminals, which costs you the ability to ask "what was that command I ran earlier". Terminals show secrets in the clear — keys echoed by a command, tokens in an error message, anything pasted — and all of it is OCR'd into plaintext. Delete the terminal block if you want that capability back.

With no config file present, a built-in deny-list applies. git clone && run can never produce zero filtering.

Development

uv venv --python 3.12 && uv pip install -e . pytest
python -m pytest tests/test_tools.py -q

Tests build a synthetic database — you do not need Retrace, or a Mac, to work on this. The fixture deliberately contains a terminal session with a fake API key, a password-manager window, and a banking URL in a browser, so the deny-list tests assert real behaviour rather than passing against data that never had anything to hide.

tests/test_live.py is separate and runs against a real database while Retrace is capturing: concurrency under write load, torn reads, WAL growth, and write refusal. See CONTRIBUTING.md.

Useful scripts:

Script Purpose
tools/verify_schema.py Check your database against what the server expects. Run this before filing a bug.
tools/make_fixture.py Regenerate the synthetic test database.
tools/snapshot.sh Consistent read-only copy of a live database, via SQLite's backup API.
tools/exercise_tools.py Drive all six tools over real MCP stdio.

How it reads the database safely

Rule Why
file:<path>?mode=ro, never immutable=1 The capture daemon writes continuously. immutable lets SQLite skip locking, producing torn reads that fail silently.
PRAGMA query_only = ON Belt-and-braces alongside mode=ro.
busy_timeout 5000 ms, 2 retries FTS5 index writes hold locks during capture.
Fresh connection per call Nothing is held across calls.
isolation_level=None A long-lived read transaction blocks the WAL checkpointer and the WAL grows unbounded.
No write statement in the package Enforced by an AST-parsing test.

Verified against a live database under active capture: 200 concurrent calls across 8 threads with zero errors, WAL flat throughout, and CREATE, DELETE, UPDATE, INSERT and journal-mode changes all refused.

Notes on the schema

Observations from a Retrace 0.8.7 install that are not obvious from the outside, and cost time to discover:

  • PRAGMA user_version reads 0. Migration state lives in a schema_migrations table, not in user_version.
  • Timestamps are epoch milliseconds, not seconds.
  • OCR box coordinates are normalised 0–1, not pixels.
  • searchRanking is a content-ful FTS5 table (text, otherText, title). Were it contentless, snippet() would raise.
  • Roughly half of frames are not in the search index — they have no doc_segment row and are invisible to search_text by design.
  • The schema is much larger than the six tools use. audio, transcript_word, event, summary, segment_comment and in_page_url_text all exist. No tool here reads them. Some contain material more sensitive than screen OCR — audio transcripts and calendar participants — so think carefully before adding one that does.
  • Video segments live at chunks/YYYYMM/DD/<13-digit-epoch-ms>, extensionless but real MP4.

Other Retrace versions may differ. tools/verify_schema.py will tell you.

License

MIT — see LICENSE.

Not affiliated with Retrace.

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

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

官方
精选