Логотип nuxt-spyglass

nuxt-spyglass

Сообщество
Flo0806

Capture browser and server logs in one correlated place - and let your AI agent read them over MCP

ИздательFlo0806
Репозиторийnuxt-spyglass
ЯзыкTypeScript
Форки
0
Звёзды
14
Доступные инструменты
5
Тип транспортаstdio
Категории
ЛицензияMIT
Ссылки
  • Подключайте инструменты к рабочим процессам с ИИ

    nuxt-spyglass предоставляет возможности MCP, доступные совместимым ИИ-клиентам и агентам.

  • Доступные инструменты: 5

    Ниже представлены доступные для вызова действия с названиями и описаниями, если сервер их предоставляет.

  • Готовая конфигурация для копирования

    Используйте примеры конфигурации, чтобы настроить этот сервер в предпочитаемом MCP-клиенте.

  • Показатели интереса к открытому проекту

    Звёзды: 14, форки: 0 — в связанном репозитории.

npm version npm downloads License Nuxt

Capture browser and server logs in one correlated place - and let your AI agent read them over MCP.

Logs save the world - and with AI even more so: errors get understood faster, even when they're messily formatted. The only thing in the way is the server–browser divide. You end up gathering logs by hand, or your AI spins up its own Nuxt dev server just to see them - exactly what you don't want.

nuxt-spyglass listens to all logs - Nitro (server) and browser, plain debug logs as well as thrown errors - in one source.

And it goes further: related events are tied together by a shared id. So when an error happens during a route change, you can - at best - see the browser logs connected to the Nitro errors thrown at that very moment. That makes debugging dramatically easier.

To put those logs into your AI's hands, Spyglass ships a lightweight stdio MCP server. Stop copy-pasting logs between terminals and tabs, or trawling through separate sources - let Spyglass and your AI agent handle it.

nuxt-spyglass is a dev-only module and disables itself completely in production. Zero config: install, start your dev server, connect your AI - done.

Features

  • 🌐🖥️ Unified browser + server logs in a single NDJSON file
  • 🔗 Correlation across the boundary via pageLoadId (per page load) and requestId (per request)
  • 💥 Captures console.*, uncaught errors, unhandled rejections and server throws - with real stack traces
  • 🤖 Built-in stdio MCP server so AI agents can query your logs
  • 👀 Built-in terminal log viewer (npx nuxt-spyglass) for humans - live tail, colors, search
  • 🚫 Dev-only - a no-op in production, zero cost in your build

Quick Setup

Install it as a dev dependency:

bash
npx nuxt module add nuxt-spyglass
# or
pnpm add -D nuxt-spyglass

Add it to your Nuxt config:

ts
export default defineNuxtConfig({
  modules: ['nuxt-spyglass'],
})

Start your dev server - that's it. Logs are written to .data/spyglass/logs.ndjson (already covered by the default .gitignore).

Configuration

ts
export default defineNuxtConfig({
  modules: ['nuxt-spyglass'],

  spyglass: {
    // Master switch. Always off in production builds, regardless of this value.
    enabled: true,
    // NDJSON log file; relative paths resolve against the project root.
    logFile: '.data/spyglass/logs.ndjson',
    // Rotate once the active file reaches this size (keeps at most two files).
    maxFileSize: 5 * 1024 * 1024,
    // Print the MCP connection state and setup command on startup.
    mcpHint: true,
  },
})

How it works

  • Browser: a client plugin wraps console.* and listens for error / unhandledrejection, buffers entries and ships them to a Nitro endpoint.
  • Server: a consola reporter plus a Nitro error hook capture server logs and unhandled errors - with their original stack.
  • Everything lands in one NDJSON file through a single write queue.
  • Correlation: each page load carries a pageLoadId (injected during SSR, sent back to the server on same-origin requests); each server request gets its own requestId. Browser and server entries of the same page load therefore share one id.

👀 Live log viewer (CLI)

A built-in terminal viewer for you (the human) - run it in a second terminal next to your dev server:

bash
npx nuxt-spyglass                  # finds this project's log file by itself
npx nuxt-spyglass <path-to-logs>   # or point it at the file explicitly

The module prints this command on dev startup as well, next to the log file it writes to.

  • Live tail, newest at the bottom, auto-follows; scroll with ↑/↓, PageUp/Down, Home/End, or the mouse wheel
  • Browser + server logs interleaved, colored by level, framework noise dimmed
  • / to search - jump to a hit, which briefly highlights
  • q or Ctrl+C to quit

🔭 AI access (MCP)

Spyglass ships nuxt-spyglass-mcp, a lightweight stdio MCP server that reads your log file and exposes it to AI agents.

How it works - read this first:

  • Your AI agent launches the MCP server itself - you never run it manually or keep it running.
  • Keep your Nuxt dev server running (it produces the logs); the MCP server only reads the file on demand.
  • After registering the server, start a new agent session so the tools load.
  • No paths, no per-project setup. The server starts in the directory your AI client was opened in and finds that project's log file itself - including monorepo layouts like packages/app/.data/spyglass/logs.ndjson. Register it once and it serves every project you open, always the current one.

nuxt-spyglass-mcp is a binary inside the nuxt-spyglass package, so launch it with npx -p nuxt-spyglass nuxt-spyglass-mcp (or node …/node_modules/nuxt-spyglass/dist/mcp.mjs). Pass a log file path as the first argument only if your client starts the server somewhere other than your project, or if you set a custom logFile - the SPYGLASS_LOG_FILE environment variable does the same.

💡 Not sure whether it is connected? The module prints the state on every dev start - and spyglass_status answers it from inside the chat.

Tools

ToolWhat it returns
recent_errorsThe most recent errors, browser and server
recent_logsRecent logs, optionally filtered by level, source or start time
logs_for_pageEvery log of one page load by pageLoadId - the full correlated tree (capped at 200 entries by default)
searchCase-insensitive substring search across messages
logs_since_last_checkOnly what arrived since the previous call - to see what changed after an action (e.g. after editing code)
spyglass_statusWhich project's logs are being read, how many entries there are, and whether the dev server is still running

Framework noise (Vue warnings, devtools, build lifecycle) is excluded by default; pass includeNoise: true to any tool to see everything.

Claude Code

Run this once - --scope user makes it available in every project you ever open:

bash
claude mcp add --scope user spyglass -- npx -y -p nuxt-spyglass nuxt-spyglass-mcp

Then run /mcp in a new session to confirm spyglass is connected. There is nothing to repeat for the next project.

Codex

In ~/.codex/config.toml:

toml
[mcp_servers.spyglass]
command = "npx"
args = ["-y", "-p", "nuxt-spyglass", "nuxt-spyglass-mcp"]

GitHub Copilot (VS Code)

In .vscode/mcp.json:

json
{
  "servers": {
    "spyglass": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "-p", "nuxt-spyglass", "nuxt-spyglass-mcp"]
    }
  }
}

Once connected, just ask your agent things like "use spyglass to show the recent errors" or "get the logs for pageLoadId …". The server also tells the agent what it is for, so a plain "why is the page broken?" is usually enough.

🧩 evlog integration

Using evlog for structured logging? Spyglass captures it automatically - no extra setup. evlog emits one structured wide event per request through its evlog:drain Nitro hook; Spyglass listens on that hook and reads the structured event directly, so it works even with evlog's default (console-less) setup.

  • Each per-request log.info/warn(...) becomes its own entry.
  • The wide event becomes a request summary ([evlog] GET /api/x -> 200) carrying evlog's fields and the error stack.
  • Entries are correlated into the same pageLoadId/requestId as the rest of the page load.

Browser-side evlog logs are captured too, once you enable evlog's transport so they reach the server:

ts
export default defineNuxtConfig({
  modules: ['nuxt-spyglass', 'evlog/nuxt'],
  evlog: { transport: { enabled: true } },
})

Spyglass never imports evlog - if evlog isn't installed, the hook simply never fires.

Contribution

bash
# Install dependencies
pnpm install

# Generate type stubs
pnpm dev:prepare

# Develop with the playground
pnpm dev

# Build the module (including the MCP bin)
pnpm prepack

# Run ESLint
pnpm lint

# Run Vitest
pnpm test

Установка

TypingMind
{
  "mcpServers": {
    "nuxt-spyglass": {
      "command": "npx",
      "args": [
        "-p",
        "nuxt-spyglass",
        "nuxt-spyglass-mcp",
        "/abs/path/to/your-app/.data/spyglass/logs.ndjson"
      ]
    }
  }
}

Доступные инструменты

  • recent_errors

    Most recent error logs from both browser and server. Framework noise is excluded by default; set includeNoise to see everything.

  • recent_logs

    Most recent logs, with optional filters by level, source and start time. Framework noise is excluded by default; set includeNoise to see everything.

  • logs_for_page

    Every log of one page load (browser + server) by pageLoadId - the full correlated tree, including framework noise.

  • search

    Case-insensitive substring search across log messages. Framework noise is excluded by default; set includeNoise to see everything.

  • logs_since_last_check

    Logs that arrived since your previous call to this tool (this session). The first call returns the recent tail as a baseline. Use it to see what changed after an action - e.g. after editing code, call it to check which new errors appeared. Framework noise excluded by default.

Используйте MCP nuxt-spyglass с разными ИИ-моделями

TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому после подключения nuxt-spyglass вы можете использовать их с разными моделями ИИ в TypingMind, не настраивая подключение отдельно для каждой модели. Эта интеграция MCP работает локально на вашем устройстве через коннектор MCP TypingMind.

Руководство по настройке локального коннектора

Выберите этот способ, если серверу MCP нужен доступ к локальным файлам, приложениям или закрытым ресурсам на вашем компьютере.

1

Откройте настройки MCP

В TypingMind откройте «Настройки», затем «Расширенные настройки», перейдите в раздел «Протокол контекста модели» и выберите «Настроить коннектор».

  1. Откройте TypingMind в браузере.
  2. Нажмите значок настроек.
  3. Перейдите в «Расширенные настройки».
  4. Откройте раздел «Протокол контекста модели».
  5. Нажмите «Настроить коннектор» и выберите «Это устройство».
Экран настройки коннектора MCP в TypingMind с выбранным вариантом «Это устройство»
2

Выполните команду коннектора

Выберите «Это устройство», скопируйте команду из TypingMind и выполните её в терминале. Не останавливайте процесс, пока используете MCP.

  1. Скопируйте команду настройки, показанную в TypingMind.
  2. Откройте «Терминал» в macOS или Windows Terminal в Windows.
  3. Вставьте и выполните команду.
  4. Подтвердите установку пакета, если терминал запросит разрешение продолжить.
  5. Не закрывайте окно терминала и не останавливайте процесс, пока используете инструменты MCP.
3

Добавьте nuxt-spyglass как сервер

Когда статус коннектора сменится на «Готов», нажмите «Изменить серверы» и вставьте конфигурацию сервера MCP.

  1. Дождитесь, пока статус коннектора сменится на «Готов».
  2. Нажмите «Изменить серверы».
  3. Вставьте конфигурацию сервера MCP для nuxt-spyglass.
  4. Сохраните список серверов.
  5. Обновите статус, если хотите убедиться, что коннектор по-прежнему готов к работе.
Настройки MCP в TypingMind с активным сервером и кнопкой «Изменить серверы»
{
  "mcpServers": {
    "nuxt-spyglass": {
      "command": "npx",
      "args": [
        "-y",
        "nuxt-spyglass"
      ]
    }
  }
}
4

Используйте подключение с разными моделями

Сохраните список серверов, откройте раздел «Плагины», включите инструменты MCP для nuxt-spyglass, затем выберите любую поддерживаемую модель ИИ в TypingMind и используйте инструменты в чате или назначьте их ИИ-агенту.

  1. Откройте страницу «Плагины» в TypingMind.
  2. Включите инструменты MCP для nuxt-spyglass.
  3. Начните чат и выберите модель ИИ, которую хотите использовать.
  4. Используйте инструменты MCP в чате или назначьте их ИИ-агенту.
  5. При необходимости переключайтесь на другую модель ИИ без повторного подключения MCP.
Чат TypingMind с включёнными инструментами MCP и выбранной ИИ-моделью
Можете помочь мне с этой задачей с помощью nuxt-spyglass?
nuxt-spyglass
Конечно. Я всё прочитал.
Вот что я нашёл с помощью nuxt-spyglass.

Часто задаваемые вопросы

Для чего используется сервер MCP nuxt-spyglass?

nuxt-spyglass — это сервер MCP, который позволяет совместимым ИИ-клиентам подключаться к внешним инструментам и получать контекст. В TypingMind достаточно один раз добавить этот сервер MCP, чтобы его инструменты стали доступны в вашем рабочем пространстве с ИИ.

Можно ли использовать сервер MCP nuxt-spyglass с несколькими ИИ-моделями в TypingMind?

Да. TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому вы можете использовать nuxt-spyglass с разными ИИ-моделями, например Claude, ChatGPT, Gemini или другими моделями, настроенными в TypingMind, без отдельной настройки сервера MCP для каждой модели.

Зачем использовать MCP nuxt-spyglass с TypingMind?

TypingMind — один из лучших интерфейсов для чата с LLM: он объединяет разные ИИ-модели, промпты, плагины, ИИ-агентов, ключи API и инструменты MCP в одном рабочем пространстве. Подключив nuxt-spyglass, вы сможете использовать его инструменты MCP с предпочитаемыми моделями, сохраняя удобную организацию работы с чатами в TypingMind.

Как подключить сервер MCP nuxt-spyglass к TypingMind?

nuxt-spyglass работает через локальный коннектор MCP TypingMind. Этот вариант лучше всего подходит, когда серверу MCP нужен доступ к локальным файлам, настольным приложениям, инструментам командной строки или закрытым ресурсам на вашем компьютере.

Какие инструменты предоставляет сервер MCP nuxt-spyglass в TypingMind?

nuxt-spyglass предоставляет инструменты MCP (5), которые можно включить на странице «Плагины» в TypingMind и использовать в чате или назначить ИИ-агентам.

Нужно ли передавать TypingMind свои ключи API для использования сервера MCP nuxt-spyglass?

Нет. TypingMind ориентирован прежде всего на локальную работу и позволяет вам контролировать выбор провайдеров моделей, ключи API, промпты и конфигурацию MCP. Если nuxt-spyglass требует аутентификации, при создании подключения добавьте необходимые заголовки, настройки OAuth или локальную конфигурацию для этого сервера MCP.

Похожие серверы MCP

Все

Создайте свою рабочую ИИ-среду сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇