Skip to main content
Glama
mcp-macos-popup

mcp-macos-popup

by vakandi
README.md
# mcp-macos-popup

MCP server for native macOS popup notifications, with multi-screen support.

It shows dark glassy popup cards on macOS and lets an AI agent target a specific display. On multi-monitor setups, it can list every screen and return the screen that currently has focus.

## Tools

- `show_popup` — quick notification popup
- `show_docs` — larger Markdown popup
- `show_html` — same card, sanitized HTML body (dashboards, KPI tiles, badges, SVG)
- `dismiss_all_popups` — close all popups
- `list_screens` — list connected displays
- `get_focused_screen` — return the focused display

All card tools accept an optional `screen` argument: display id, index, label, `primary`, or `focused`.

## Markdown surface (`show_docs`)

The docs card renders more than a notification has any right to:

- headings (ATX and setext), horizontal rules, hard breaks, escapes
- nested / ordered / task lists
- tables with per-column alignment, inline code and bold inside cells
- blockquotes, nested — `>`, `>>`, `>>>` render as indented rails
- fenced code with a language label and token highlighting for
  js/ts/py/rs/go/sh/sql/java/swift/c/cpp/csharp/php/rb/json/yaml/toml/ini/html/css/md,
  plus `diff` colouring
- inline code spans with one, two or three backticks
- **mermaid diagrams**: a ` ```mermaid ` fence is rendered to SVG (flowchart, sequence,
  state, ER, gantt, pie, class). Mermaid is lazy-loaded, dark-themed and sandboxed with
  `securityLevel: strict`; invalid syntax keeps the source visible in a red-bordered block
- a ` ```buttons ` fence renders real action buttons, one per line: `Label | target | style`
  where `target` is an `https://` URL or `copy:value`

Raw HTML is escaped in Markdown mode, not rendered.

## HTML mode (`show_html`, or `show_docs` with `format:"html"`)

Same 480 px card, but the body is a sanitized HTML fragment — the mode for KPI tiles,
status badges, event lists, dossier boards and anything that has to be *seen* rather than
read. A 480 px card holds a four-tile row, a dated list, coloured state pills and an alert
row, legible at a glance with no scrolling.

Sanitized, never injected as-is: `DOMParser` parses into an inert document, then a
whitelist rebuilds the tree.

- dropped with subtree: `script`, `style`, `iframe`, `object`, `embed`, `form`, `input`,
  `button`, `textarea`, `select`, `video`, `canvas`, `link`, `meta`, `foreignObject`
- unknown tags are unwrapped; `on*` handlers never survive
- `id` and `data-*` are dropped; `class` survives
- `href` only `http(s)`/`mailto`; `img` only `https:` or `data:image/(png|jpeg|gif|webp)`
- `style` keeps a property whitelist and rejects `url()`, `@import`, `expression()`
- SVG primitives (`path`, `rect`, `circle`, `polyline`, `text`…) are allowed, no scriptable
  SVG element

Utility classes shipped by the renderer: `.row` `.between` `.grid` `.grid-2` `.grid-3`
`.card` `.kpi` `.kpi-label` `.pill` (`.ok` `.warn` `.bad`) `.bar>i` `.muted` `.mono`
`.small` `.right` `.center`.

```bash
mcp-cli call macos-popup show_html '{"title":"RMA","html":"<div class=\"row between\"><span class=\"kpi\">16</span><span class=\"pill ok\">5 mails</span></div>"}'
```

## Card layout

Cards fill the right edge top to bottom; a card that would cross the bottom of the work
area opens a second column on its left. Two columns maximum, and closing a card re-packs
the stack so the left column slides back into the freed place.


## Install

```bash
npm install -g mcp-macos-popup
```

Or run directly:

```bash
npx mcp-macos-popup
```

Electron is installed automatically as a dependency.

## MCP configuration

```json
{
  "mcpServers": {
    "macos-popup": {
      "command": "mcp-macos-popup"
    }
  }
}
```

## Usage

```bash
mcp-cli call macos-popup show_popup '{"title":"Elia","message":"the answer","level":"info","duration":10}'
mcp-cli call macos-popup list_screens '{}'
mcp-cli call macos-popup get_focused_screen '{}'
```

## Multi-screen

If four displays are connected, call `list_screens` or `get_focused_screen` first, then pass the chosen display id as `screen`:

```bash
mcp-cli call macos-popup show_popup '{"title":"Elia","message":"hello","screen":"focused"}'
```

## Development

```bash
npm install
npm run daemon
```

## Bundled skill

`skill/macos-popup/` is the agent-facing skill that ships with this package: when to fire a
card, how to choose Markdown vs HTML, the 480 px layout budget, the utility classes, and
four copy-paste recipes. `skill/macos-popup/references/html-cookbook.md` is the HTML
cookbook; `references/markdown-cookbook.md` covers the Markdown cards.

```bash
cp -R skill/macos-popup ~/.config/opencode/skills/macos-popup
```

`scripts/notify.py` takes the text as a file or on stdin, so apostrophes and newlines never
reach a shell, and it falls back to the daemon's HTTP endpoint when `mcp-cli` is absent —
which makes it usable from cron and from subworker shells.

TDQS

A4/5.0

Scored across 6 tools

Disambiguation4/5

The three show_* tools are explicitly delineated by guidance (quick notification vs markdown docs vs HTML layout), but show_html is essentially show_docs with format="html", creating a deliberate redundancy that relies on prose instructions to resolve. get_focused_screen and list_screens also overlap, since the latter already reports which display is focused.

Naming Consistency5/5

All six tools are snake_case verb_noun constructions (show_popup, show_docs, dismiss_all_popups, get_focused_screen, list_screens). The only deviation is singular/plural in show_popup vs show_docs, which is semantically justified.

Tool Count5/5

Six tools is well-scoped for a popup-display server; each maps to a distinct capability (render, dismiss, screen discovery). No bloat and nothing trivially redundant beyond the intentional docs/html split.

Completeness3/5

Core lifecycle is covered — render, bulk dismiss, and screen targeting — but there is no per-popup dismiss by id, no way to list active popups, and no mechanism for button clicks or user responses to be reported back to the agent, which undercuts the advertised actionable cards.

Maintenance

ActivityNo data
ResponsivenessOutdated data