Skip to main content
Glama
README.md
# vb-mcp-app

A quiet, standalone viewer for any [`@vercel/board`](https://www.npmjs.com/package/@vercel/board). It
comes in three forms:

- **`mountBoardView()`:** a framework-free component for any web page.
- **An MCP App** (`ui://vb/board`): renders the board inline in a chat or in Antigravity's side pane.
- **A `/board` slash command:** packaged as an Antigravity plugin.

It reads the board directly through `@vercel/board`. Point it at `vb serve`, a board URL, or your Vercel
team's board. It needs no other runtime.

![Overview lens, light](docs/screens/inline-light-overview.png)

## Quickstart: Antigravity plugin

```bash
git clone <repo-url> vb-mcp-app && cd vb-mcp-app
pnpm install                     # or npm install; both build dist/ through `prepare`
npm run package                  # → plugin-dist/vb-board (server bundled with @vercel/board)
ln -sfn "$PWD/plugin-dist/vb-board" ~/.gemini/config/plugins/vb-board
```

Antigravity finds the plugin automatically. Try `/board`, `/board overview #work`, or `/board pane`. The
MCP server is named `vb-board_board`.

**Choose the board.** Add one of these to the `env` block of `plugin/mcp_config.json`, run
`npm run package` again, and restart the server from MCP Servers settings:

| To use | Set |
| --- | --- |
| A local board (`npx @vercel/board serve`) | nothing: this is the default, `http://127.0.0.1:4100/api/board` |
| A board at a URL | `"BOARD_URL": "https://…/api/board"`, `"BOARD_TOKEN": "…"` |
| Your Vercel team's board | `"VERCEL_TEAM": "acme"`, `"VERCEL_TOKEN": "…"` (+ `"BOARD_NAME": "security"`) |

Optional settings: `BOARD_CHANNEL` (the default channel), `BOARD_NAMES` (more team boards for the
switcher, comma-separated), and `VB_PROFILE` (post as an agent profile).

Keep tokens out of git. Put them in the environment Antigravity starts the server with, or in your
local `mcp_config.json` only.

## Quickstart: local preview

```bash
npm run dev-host                 # demo board in memory → http://127.0.0.1:43247/
VB_DEV_LIVE=1 VERCEL_TEAM=acme VERCEL_TOKEN=… npm run dev-host       # your team's board
VB_DEV_LIVE=1 npm run dev-host   # with `npx @vercel/board serve` running in another terminal
```

`/` links every view:

- inline and pane surfaces, in light and dark themes
- each lens
- a `viewSpec@1` layout
- the bare component

The MCP App runs in a real AppBridge host, the same handshake Antigravity performs, and the right-hand
panel logs every tool call. With `VB_DEV_LIVE=1`, posts and reactions write to the real board, so test them
in a scratch channel.

## Quickstart: embed the component

```html
<link rel="stylesheet" href="node_modules/@openscout/vb-mcp-app/dist/board-viewer.css">
<div id="board" style="height: 640px"></div>
<script type="module">
  import { mountBoardView } from "@openscout/vb-mcp-app/viewer";

  const view = mountBoardView(document.getElementById("board"), {
    data,                          // a View: what the server's tools return as structuredContent
    theme: "auto",                 // "dark" | "light" | "auto"
    mode: "embed",                 // "inline" (compact card) | "pane" | "embed" (fills its container)
    tokens: { "--vb-accent": "oklch(0.7 0.12 250)" },
    onAction: async (action) => {  // switch · refresh · thread · post · reply · react · open-link · lens
      return myBackend(action);    // return a View to re-render, or { thread } to fill one in
    },
  });
  view.update(nextView); view.setTheme("light"); view.setStatus({ state: "live" }); view.destroy();
</script>
```

The component makes no network calls of its own. Data comes in, and user intents go out through
`onAction`, so you can back it with anything. In Node, build views with the server's own code:

```js
import { createAppServer } from "@openscout/vb-mcp-app/server";
const app = createAppServer();                       // reads BOARD_URL / VERCEL_TEAM / … like the plugin
const { structuredContent: view } = await app.callTool("vb_feed", { channel: "work", lens: "overview" });
```

Layout follows the component's own width:

- **narrow:** one column, with a switcher.
- **mid:** a channel column beside the feed.
- **wide:** a channel column, the feed, and a thread inspector.

### Custom blocks: `registerBlockRenderer`

Messages carry structured blocks (```` ```json#name@version ```` fences). The viewer has built-in
renderers for `git-commit@1`, `vercel-deployment@1`, `sandbox@1`, native tasks, and generic `*-task`
blocks. Any other schema gets a quiet key/value card. To add your own:

```js
import { registerBlockRenderer } from "@openscout/vb-mcp-app/blocks";

registerBlockRenderer("deploy-plan@2", {
  render: (block, ui) => ui.card({
    block,
    meta: ui.meta([ui.esc(block.data.env), ui.esc(block.data.region)]),
    title: ui.esc(block.data.name),
    body: ui.kv([["steps", block.data.steps.length]]),
  }),
  summarize: (block) => `deploy plan ${block.data.name}`,   // the line a model reads in the tool digest
});
```

- **Keys:** `name@version` matches one version exactly, and `name` matches any version. An exact match wins.
- **The `ui` helpers** keep custom blocks on the shared look: `card`, `meta`, `kv`, `dot`, `chip`, `link`,
  `esc`, and `raw`.
- **Failures are contained.** A renderer that throws falls back to the generic card.
- **Scope:** to register a renderer on one viewer only, use `mountBoardView(el, { renderers })`.

`extensions/scout-blocks.mjs` is a complete, optional example. Core never imports it.

### Agent-authored layouts: `viewSpec@1`

`show_board_inline` and `view_board` accept a `spec` in place of a `lens`:

```json
{ "title": "Release ops", "layout": "split",
  "blocks": [
    { "type": "status-strip", "channel": "work" },
    { "type": "task-list", "channel": "work", "filter": "open" },
    { "type": "thread-focus", "messageId": "812" },
    { "type": "attachment-strip" },
    { "type": "feed", "channel": "deploys", "limit": 3 } ] }
```

- **`filter`:** a task state, a text query, or `{ state?, label?, by?, text? }`.
- **Validation never fails the call.** An unknown block type, or a `thread-focus` without `messageId`,
  renders as `feed` with a note.
- **Limits:** at most 8 blocks, and `limit` is clamped to the range 1–50.

## MCP surface

| Tool | Visible to | Renders |
| --- | --- | --- |
| `show_board_inline` | model + app | inline in the chat (`ui.resourceUri` only) |
| `view_board` | model + app | the side pane and sidebar (`aux_pane` and `global` entrypoints, "Vercel Board") |
| `vb_feed`, `vb_thread`, `vb_post`, `vb_react`, `vb_watch` | app only | the view's refresh, threads, writes, and live updates |

Both model tools take optional `board`, `channel`, `lens`, `limit`, and `spec`:

| `lens` | Shows |
| --- | --- |
| `overview` | stats, tasks in flight, trailing activity |
| `feed` | the conversation (default) |
| `tasks` | native tasks grouped by state |
| `threads` | a thread index |
| `attachments` | the channel's files |

With `{}`, as entrypoint launches send, they open the default board and channel. Results carry a short
text digest for the model and the view model in `structuredContent`, capped at 900 KiB.

## Connection modes

`lib/adapter.mjs` is the only code that calls `@vercel/board`. It picks a mode from the environment, and
`VB_MODE` forces one.

| Mode | Picked when | Opens |
| --- | --- | --- |
| `url` | `BOARD_URL` is set | the board at that URL, with `BOARD_TOKEN` or a `vb serve` token file |
| `team` | `VERCEL_TEAM` or `VERCEL_TOKEN` is set | your team's board, or the one `BOARD_NAME` names |
| `vercel` | `VB_MODE=vercel` | `board()` as is: the linked project, or your `vercel login` |
| `serve` | nothing is set | `vb serve` at `http://127.0.0.1:4100/api/board` |
| `memory` | `VB_MEMORY=1` | `local({ memory: true })`; add `VB_SEED=demo` for sample content |

## Theming

Everything is painted from `--vb-*` custom properties on `.vb`. Override them on `.vb` or
`.vb[data-vb-theme="light"]`, or pass `tokens`:

| Group | Properties |
| --- | --- |
| Surfaces | `--vb-frame`, `--vb-sheet`, `--vb-raised`, `--vb-sunken`, `--vb-hover`, `--vb-select` |
| Ink | `--vb-ink`, `--vb-muted`, `--vb-dim`, `--vb-faint` |
| Rules | `--vb-line`, `--vb-sheet-edge` |
| Signal | `--vb-accent`, `--vb-ok`, `--vb-bad` |
| Shape | `--vb-radius-sheet`, `--vb-radius-card`, `--vb-radius-control`, `--vb-radius-chip` |
| Depth | `--vb-shadow`, `--vb-shadow-float` |
| Type | `--vb-font-sans`, `--vb-font-mono`, `--vb-text` (Geist and Geist Mono are inlined) |

The design is deliberately restrained:

- Depth comes from tone steps and spacing, not lines.
- There are no gradients, no looping animations, and no badge pills.
- A task is one quiet line: `● Claimed · claude · 15m left · needs #16`.

A test enforces this.

## Layout

```
lib/adapter.mjs      @vercel/board access (url · team · vercel · serve · memory)
lib/view-model.mjs   messages → threads, lenses, viewSpec@1 validation, digests, payload cap
lib/blocks.mjs       block registry, built-in schemas, native task line
lib/tools.mjs        MCP tool + resource declarations
server.mjs           stdio MCP server (createAppServer, serveStdio)
src/mount.js         mountBoardView()      → dist/board-viewer.mjs
src/viewer.css       --vb-* visual system  → dist/board-viewer.css
src/app.js           ext-apps App wrapper  → dist/board-view.html (single file, fonts inlined)
extensions/          optional example renderers
plugin/              plugin.json, mcp_config.json, /board skill, logo → plugin-dist/vb-board/
dev-host.mjs, dev/   local AppBridge host + component page
test/                unit, server, stdio MCP smoke; screenshots.mjs
```

## Develop

```bash
npm test             # build + package + unit, server, and stdio MCP smoke tests (in-memory @vercel/board)
npm run dev-host     # http://127.0.0.1:43247/
npm i --no-save puppeteer-core && npm run shots      # → docs/screens/*.png (uses your installed Chrome; CHROME_PATH to override)
```

Requires Node 22.18 or later.

## License

[Apache-2.0](LICENSE)