npm package: @glance-mcp/server
Description: MCP server for Glance — capture what a web page looks like and does
Latest version: 1.3.0

# @glance-mcp/server

MCP server for [Glance](https://glance.tools) — web perception for AI agents. Capture what a web page looks like and does, or render HTML/CSS to an image or PDF.

Zero dependencies. Node 18+ builtins only. No build step.

## Setup

### Claude Desktop

Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "glance": {
      "command": "node",
      "args": ["/path/to/node_modules/@glance-mcp/server/src/index.mjs"],
      "env": { "GLANCE_API_KEY": "gt_..." }
    }
  }
}
```

### Cursor

Add to Cursor's MCP settings (Settings > MCP Servers):

```json
{
  "glance": {
    "command": "node",
    "args": ["/path/to/node_modules/@glance-mcp/server/src/index.mjs"],
    "env": { "GLANCE_API_KEY": "gt_..." }
  }
}
```

### Claude Code

```bash
claude mcp add glance node /path/to/node_modules/@glance-mcp/server/src/index.mjs
```

Set `GLANCE_API_KEY` in your environment.

### npx (any MCP host)

```json
{
  "command": "npx",
  "args": ["-y", "@glance-mcp/server"],
  "env": { "GLANCE_API_KEY": "gt_..." }
}
```

## Getting an API key

No key? The `signup` tool provisions one from inside the MCP session — no dashboard, no credit card. 100 free calls/month.

Or, from a terminal:

```bash
curl -s https://api.glance.tools/v1 -d '{
  "jsonrpc": "2.0", "method": "signup",
  "params": {"email": "you@example.com"}, "id": 1
}'
```

## Tools

### `capture`

Capture a web page. Submits the job, polls for completion, and returns screenshots, network traffic, console output, DOM, text, and metadata in a single call.

| Param | Type | Description |
|---|---|---|
| `url` | string | Absolute URL to capture. Required. |
| `waitMs` | integer | Max ms to wait for network idle. Default: 2000. |
| `settleMs` | integer | Extra ms to wait after idle. Default: 0. |
| `dom` | boolean | Include rendered DOM. Default: true. |
| `text` | boolean | Include visible text. Default: true. |
| `meta` | boolean | Extract JSON-LD, Open Graph, title. Default: true. |
| `only` | string[] | Restrict artifacts: `screenshots`, `network`, `console`, `dom`, `text`, `meta`. |
| `burst` | integer | Capture N frames for transition analysis. |
| `click` | string | CSS selector to click at burst midpoint. |
| `interactions` | object[] | Scripted interaction sequence (see below). |

### `render`

Render HTML/CSS to a PNG, JPEG, or PDF. Pass markup and get back a pixel-perfect image or document.

| Param | Type | Description |
|---|---|---|
| `html` | string | HTML content to render. Required. |
| `css` | string | Additional CSS to inject into the page. |
| `format` | string | Output format: `png`, `jpeg`, or `pdf`. Default: `png`. |
| `width` | integer | Viewport width in pixels. Default: 1280. |
| `height` | integer | Viewport height in pixels. If omitted, captures full content height. |
| `scale` | number | Device scale factor (e.g., 2 for retina). Default: 2. |

### `usage`

Check remaining API quota for the current billing period.

### `feedback`

Send feedback to the Glance team. Supports threading: include a `thread_id` to continue an existing conversation, or omit it to start a new one. Returns a `thread_id` for follow-ups and any operator replies.

| Param | Type | Description |
|---|---|---|
| `message` | string | Feedback message. Max 2000 characters. Required. |
| `thread_id` | string | Thread ID from a previous feedback call. Omit to start a new thread. |

### `signup`

Provision an API key from an email address. The key is active for the current session; the response includes ready-to-run commands to persist it in your MCP config.

## Interactions

The `interactions` param on `capture` accepts an array of sequential actions:

```json
[
  {"type": "type", "selector": "#search", "value": "query"},
  {"type": "click", "selector": "#submit"},
  {"type": "wait", "ms": 2000},
  {"type": "screenshot", "name": "results"}
]
```

| Action | Fields | Description |
|---|---|---|
| `wait` | `ms` | Pause (default 1000ms). |
| `click` | `selector` | Click an element. |
| `type` | `selector`, `value` | Set an input's value. |
| `keypress` | `key` | Dispatch a key event. |
| `eval` | `script` | Run JavaScript in the page. |
| `screenshot` | `name` | Capture the viewport at this point. |

## Environment variables

| Variable | Description |
|---|---|
| `GLANCE_API_KEY` | API key for authenticated methods. |
| `GLANCE_API_URL` | Override the API endpoint (default: `https://api.glance.tools/v1`). |

## How it works

The server speaks [MCP](https://modelcontextprotocol.io) (Model Context Protocol) over stdio — JSON-RPC 2.0 with newline framing. It's a thin client of the [Glance hosted API](https://glance.tools). No engine, no Chrome, no local browser needed.

## License

MIT