Skip to main content
Glama
media-preview
by JustBipin

Playable local media inside chat, without burning context. Most AI coding environments render .mp4, .wav, and .png outputs as dead file pills—while base64-inlining media into HTML artifacts blows past token caps and iframe CSP rules. media-preview streams local files straight from 127.0.0.1 into an MCP App view, keeping raw bytes completely out of LLM history.

Highlights

  • 9:16 & 16:9 aware video players. Vertical Shorts and widescreen renders auto-fit inside inline chat height caps with a minimal overlay scrub bar, click-to-play, and fullscreen handoff that syncs playback timestamp on minimize.

  • 72-bar interactive audio waveforms. Samples normalized peak bars directly from RIFF PCM/float WAV files in < 1 ms with bounded memory, and decodes compressed formats (.mp3, .m4a, .ogg, .opus, .aac, .flac) via WebAudio in the client.

  • Three-tier image presentation. Automatically chooses a video-sized showcase card for 1 image, an 82px gallery strip for 2+ images, or right-aligned 30px micro-thumbnails (mode: "peek") when an agent silently inspects frames mid-task.

  • Session-resilient across restarts. Ships an app-only (0-token) resolve_media tool so reopening historical chats on a new ephemeral localhost port transparently re-hydrates every player.

  • Hardened localhost streaming. Binds strictly to 127.0.0.1:0 with a random 128-bit per-session token and serves only explicitly registered files.

  • Zero npm dependencies. Runs out of the box on Node.js >= 18 with no npm install or build step.

Related MCP server: snapWONDERS MCP

Native Desktop Lightbox

Clicking any image or video fullscreen button on Linux (Wayland/X11 with GTK4) launches a frameless translucent desktop overlay (src/modal.py) outside the narrow chat iframe—supporting scroll/pinch zoom up to 8×, drag pan, arrow-key gallery navigation, and live video timestamp sync. On macOS, Windows, or Linux setups without GTK4, media-preview detects availability via a startup handshake and falls back automatically to its built-in inline modal.

Installation

Google Antigravity

Clone directly into your Antigravity plugins directory:

git clone https://github.com/JustBipin/media-preview.git ~/.gemini/config/plugins/media-preview

Antigravity discovers plugin.json, mcp_config.json, and the bundled agent workflow rules (rules/AGENTS.md) automatically—no build or install step required. Toggle or manage it anytime at customization://media-preview.

Any MCP Apps Host (mcp_config.json)

Works with Claude Desktop and any client implementing MCP Apps (ext-apps):

{
  "mcpServers": {
    "media-preview": {
      "command": "node",
      "args": ["/absolute/path/to/media-preview/src/server.mjs"]
    }
  }
}

Optional: Linux GTK4 Overlay Packages

To enable the native desktop overlay outside the chat iframe on Linux:

# Ubuntu / Debian
sudo apt install python3-gi gir1.2-gtk-4.0 gstreamer1.0-gtk4

# Fedora
sudo dnf install python3-gobject gtk4 gstreamer1-plugin-gtk4

# Arch Linux
sudo pacman -S python-gobject gtk4 gst-plugin-gtk4

Tool Reference

preview_media

Parameter

Type

Default

Description

paths

string[]

required

Absolute paths or file:// URIs to .mp4, .m4v, .webm, .mov, .mkv, .wav, .mp3, .ogg, .opus, .m4a, .aac, .flac, .png, .jpg, .jpeg, .webp, .gif, .svg, or .avif files.

mode

"default" | "peek"

"default"

"default" renders full inline players, showcase cards, or gallery strips; "peek" renders tiny right-aligned micro-thumbnails for silent intermediate checks.

loop

boolean

false

Loop video or audio playback (useful for seamless Short loop checks).

autoplay

boolean

false

Autoplay on load (muted on video per browser policy).

Smoke Test

Verifies MCP stdio JSON-RPC framing, ui:// resource delivery, WAV RIFF peak extraction, open_modal path validation, and HTTP 206 Partial Content streaming:

npm test

License

MIT

Available Tools

3 tools
open_modalOpen Native Overlay ModalC

App-only helper to launch a frameless translucent desktop modal outside the chat iframe.

Inputs: mode (required), paths (required), loop, startTime, +1 more.

preview_mediaInline Media PreviewB

Render an inline video player (9:16 or 16:9), waveform audio player, or image filmstrip directly inside chat for local media files.

Inputs: paths (required), loop, mode, autoplay.

resolve_mediaRe-bind Media Stream URLsB

App-only helper to refresh localhost stream URLs when reopening historical chats.

Inputs: paths (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 3 tools

    Disambiguation4/5

    The three tools target distinct actions: launching a modal, rendering inline media, and refreshing stream URLs. However, open_modal and preview_media both involve displaying media, which could cause some confusion about when to use the external modal versus inline preview.

    Naming Consistency5/5

    All tool names follow a clear verb_noun snake_case pattern: open_modal, preview_media, resolve_media. The convention is consistent and predictable.

    Tool Count5/5

    Three tools is well-scoped for a focused media preview helper server. Each tool has a distinct purpose and no obvious redundancy.

    Completeness4/5

    The surface covers inline preview, modal launch, and URL resolution for historical chats. A minor gap exists around modal lifecycle (e.g., no close_modal) or media discovery/cleanup, but core workflows are supported.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      A locally-run server that lets an AI assistant hide files inside photos or videos, reveal concealed content, perform forensic analysis of images and videos, and convert media between formats. It reads input and writes output directly on the user's own machine, so files never need to be handed off through a separate client.
      4
      74 PyPI
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables users to open generated HTML pages, PDFs, Office documents, and images straight from chat cards or a side-pane file list using their OS default application, or to choose another installed app via an Open With dropdown. Also reveals files in Finder or File Explorer, tracks recent outputs across conversations, and blocks risky executable launches.
      1
      MIT