Context Lens
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Context Lens
English · Русский
Official MCP App (ui://) context window & prompt-cache monitor — Zero-RPC, Zero-OAuth, Zero-CDP, Zero-Python.
Context Lens is a local, read-only MCP App for the Antigravity App. It shows how full your context window really is, where the prompt tokens go, and how well the prompt cache is working — without a sidecar server, browser automation, OAuth proxying, or any Python dependency.
It ships as one MCP server (stdio) plus one HTML bundle:
ui://context-lens/app.html → dist/app.html (single file, inlined CSS/JS)
tools: show_context_lens, refresh_context_lens, save_lens_settingsThe default show_context_lens tool is app-only (visibility: ["app"]): the model
never sees it, so the monitor costs 0 prompt tokens.
Screenshots
Synthetic captures with sample English data (no real conversation text). The auxiliary pane in Light (10×10 grid) and Dark (stacked bar), followed by the full-width global dashboard.
Light — 10×10 grid | Dark — stacked bar |
|
|
Global dashboard (Dark, two-column layout):

Related MCP server: Cache Hit Monitor for Antigravity
Features
Dual Cap readout
Antigravity enforces two different limits, and Context Lens shows both:
Compaction budget — the effective
request_budget_tokens/ checkpointer limit at which history is compacted (CHECKPOINT).Native window — the model's full context window (e.g.
1M), with a200Klong-context tier mark.
The header shows usage and percentage (e.g. 284.5K / 512K (55.6%)) alongside a
Native window badge and lets you switch between the two scales; a tick marks where
compaction begins.
Hybrid data engine (exact DB → transcript fallback)
exact_db— reads the locally storedconversations/<id>.dbread-only through the built-innode:sqlitemodule (no npm runtime dependencies, no Python). The nativeTopLevelTokenGroupbreakdown,request_budget_tokens, checkpointer limit, usage counters and the model name come straight from the database.Transcript fallback — if
node:sqliteis unavailable, the file is missing, or the schema changes, Context Lens falls back totranscript.jsonl, supporting all three known generations (Gen 1 without tokens, Gen 2 without a model field, Gen 3 with tokens + model).Handles
CHECKPOINTwith and without embedded tokens, compaction savings (before → after),post_compactionstate (updates on the next turn), empty chats (0%), andpartialdata for logs over 4 MiB without a checkpoint.
Two honest cache metrics
Last turn cache hit — the hit rate of the most recent request.
Active window average — the cache share across the active window after the last
CHECKPOINT.
Five categories, two visualisations, Top-5 heavy steps
Categories: messages, MCP tools, skills, meta context, system base — always summing to 100%, with an Exact (DB) vs Estimated badge.
Segmented bar ↔ 10×10 dot grid toggle; both describe the same numbers.
Top-5 heaviest steps with redacted metadata only (step index, kind, redacted label, token count).
Three surfaces from one bundle
Surface | Default | Prompt tokens | Notes |
| on | 0 | Supports Attach context summary |
| on | 0 | Full-width dashboard; no chat actions |
| off | adds one tool description | Enable in settings, then restart the MCP server and start a new chat |
Native MCP App capabilities
Copy
/context— a compact, redacted report for the clipboard.Attach context summary — uses
app.updateModelContext()(strictly gated behindgetHostCapabilities(), therefore only inaux_pane) to attach the remaining tokens before compaction, the breakdown, cache metrics and Top-5 heavy steps to the next message. Ideal for handoff workflows before a compaction.Strict
last_user_view_timeauto-follow — the monitor follows the chat you actually opened, not a background generation; subagents are isolated.Pin a chat — lock the monitor to one conversation; unpinning resumes auto-follow immediately.
Idle-backoff polling — 3 s while data changes, backing off to 15 s on
unchangedreplies, paused while the view is hidden, at most one request in flight.
Localisation and accessibility
EN / RU UI, switchable in the settings drawer and persisted server-side.
Light / Dark host theming via
applyDocumentThemeandapplyHostStyleVariables.WCAG AA contrast targets, keyboard navigation,
role="progressbar"with an accessible name,aria-pressedtoggles and alangattribute kept in sync.
Architecture and security comparison
The table describes the common architecture of publicly documented monitor tools. Individual projects differ; the wording is factual and not a recommendation against any particular tool.
Context Lens (MCP App | Sidecar + LS RPC monitors | CDP / OAuth / proxy monitors | |
Integration standard | Documented MCP App resource + app-only tools | Internal, undocumented Language Server RPC | Browser DevTools Protocol / injected scripts |
Local HTTP port | None (MCP over stdio) | Usually a localhost HTTP endpoint | Usually a localhost proxy |
Internal LS RPC | No | Yes | Sometimes |
CDP / DOM injection | No | No | Yes |
OAuth / proxy | No | No | Typically yes |
Python required | No | Often | Sometimes |
Exact DB breakdown + transcript fallback | Yes ( | Varies by implementation | No (UI scraping) |
Prompt token overhead (default) | 0 | Varies | Varies |
Requirements
Antigravity App with MCP Apps support (
v2.34.0+).Node.js
^20.19.0 || >=22.12.0for building. At runtime, any Node the app can launch works:node:sqliteis used when available (Node ≥ 22.5) and the transcript fallback otherwise.No Python. No browser automation. No network access.
Installation (no curl | sh, no irm | iex)
1. Download
Grab both files from the Releases page of this repository:
context-lens-vX.Y.Z.zipSHA256SUMS.txt
2. Verify the checksum
macOS / Linux:
sha256sum -c SHA256SUMS.txt
# macOS builds without GNU coreutils:
shasum -a 256 -c SHA256SUMS.txtWindows PowerShell:
$expected = (Get-Content .\SHA256SUMS.txt).Split(" ")[0]
$actual = (Get-FileHash .\context-lens-vX.Y.Z.zip -Algorithm SHA256).Hash.ToLower()
if ($actual -eq $expected) { "checksum OK" } else { "CHECKSUM MISMATCH" }3. Pre-audit without executing anything (optional)
agy plugin validate --strict reads the manifest and bundle without installing or
running code:
agy plugin validate --strict ./context-lens-vX.Y.Z.zipOn Windows the CLI usually lives at %USERPROFILE%\.gemini\bin\agy.exe.
4. Install
Extract the archive into the plugins directory:
Platform | Path |
macOS / Linux |
|
Windows |
|
Or let the CLI install the extracted folder:
agy plugin install ./context-lens5. Enable and open
Open Customizations → Installed, find Context Lens and enable it.
Open the side pane from
+(theaux_panesurface) or the Plugins tab (global). Both work with an empty{}tool input.To use the
inlinesurface, enable it in the settings drawer inside the widget, then restart the MCP server (Customizations → Installed → Context Lens → MCP → Restart) and start a new chat.
Build from source
npm ci
npm run build # dist/server.mjs + dist/app.html
npm run package # release/context-lens-vX.Y.Z.zip + release/SHA256SUMS.txt
npm testnpm run package writes a deterministic archive and its sha256sum-compatible
SHA256SUMS.txt (two spaces between hash and name, LF line ending).
Privacy and disclaimer
Context Lens reads only what is already stored on your machine, in read-only mode:
~/.gemini/antigravity/brain/**—transcript.jsonlandtranscript_full.jsonl;~/.gemini/antigravity/annotations/*.pbtxt— conversation titles andlast_user_view_time;~/.gemini/antigravity/conversations/<id>.db— opened withreadOnly: true;~/.gemini/config/**—GEMINI.md, config, skills and MCP server settings (to estimate tool/skill weight).
It makes zero network calls, has no telemetry, never touches OAuth tokens or
cookies, and never switches accounts. Secret-like patterns (SECRET_PATTERNS) are
redacted before any text leaves the server process. The widget iframe receives counts,
shares and redacted labels only — never raw message text. The clipboard report and the
attached model-context summary are built from the same redacted metadata.
This is an independent MIT project. It is not affiliated with, endorsed by, or supported by Google. Antigravity is a product of Google LLC; the name is used only to describe compatibility. The plugin name and assets intentionally avoid Google or Antigravity branding.
Data pipeline (short version)
discovery.tsparsesannotations/*.pbtxtfor titles andlast_user_view_time, filters subagents, and sorts chats with a strictlast_user_view_timepriority.transcript.tsincrementally parsestranscript.jsonl(Gen 1/2/3), honoursCHECKPOINTboundaries and compaction savings, and resolvesmediaattachments.db_reader.tsoptionally enriches the snapshot from SQLite (model, budget, native token groups);config_reader.tsestimates skills and MCP tool weight (Lazy by default, Eager only for configured servers).breakdown.tsmerges both sources into aschemaVersion: 1payload: five categories summing to 100%, Dual Cap limits, cache metrics, compaction stats, Top-5 heavy steps and a revision hash forunchangedpolling.
License
MIT — see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Read-only analytics for Convex apps, queryable via MCP from Claude, Cursor, and other clients.
Hosted Apple Health MCP: daily brief, records, sleep, HRV in ChatGPT, Claude, Grok. Free, no export.
Share one project context across ChatGPT, Claude, Telegram and any MCP client.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables users to inspect real-time prompt cache hit rate, task throughput, and per-model token usage for Antigravity sessions and 5h/1d/7d windows through an interactive local dashboard. It combines lifecycle hook timing with local transcript data, with zero outbound network telemetry.MIT
- AlicenseNot gradedqualityCmaintenanceEnables users to inspect real prompt-cache hit rates, context-window usage, and compaction events in a side pane using local transcript data.2MIT
- AlicenseNot gradedqualityCmaintenanceAn Antigravity MCP App plugin that surfaces real-time context window occupancy, remaining tokens, prompt cache hit rate, output speed, rolling 5-hour/7-day quota usage, and a 28-day activity heatmap by read-only parsing of local transcript logs. It presents these metrics in a theme-aware sidebar dashboard without patching or injecting into the host client.MIT
- AlicenseNot gradedqualityBmaintenanceEnables live monitoring of Antigravity context-window token usage, CHECKPOINT compaction events, and collapsible chat/subchat trees grouped by project, context size, or date.MIT

