Skip to main content

NATS JetStream topic watcher

Project description

nats-view

A command line utility for watching NATS and NATS JetStream topics with support for filtering, pretty-printing JSON, and historical replay.

Features

  • Real-time Monitoring: Watch core NATS subjects with ease.
  • JetStream Support: Replay historical data using --since, --deliver-all, or --deliver-last.
  • Visualization: Pretty-printed JSON, colorized output, timestamps, and headers.
  • Filtering: Server-side subject filtering and client-side regex payload filtering.
  • Security: Support for User/Pass, Token, Credentials, and TLS/SSL.
  • MCP Compatible: Ready to be used as a tool for LLMs via the Model Context Protocol.

Installation

Via pipx (Recommended)

pipx install .

Via Poetry (Development)

poetry install
poetry run nats-view --help

Usage

Basic

Watch all subjects on localhost:

nats-view

Watch specific subjects:

nats-view "orders.>" "logs.*"

JetStream History

Replay messages from the last hour:

nats-view --js --since 1h "orders.>"

Get the last known value for a subject:

nats-view --js --deliver-last "status.system"

Filtering & formatting

Show only messages containing "error", pretty-print the JSON, and exit after 5 matches:

nats-view --filter "error" --pretty --count 5 ">"

MCP Tool Usage

This tool includes a definition for the Model Context Protocol (MCP), allowing AI assistants to inspect your NATS clusters.

Tool Definition

The tool definition is located in mcp-tool.json.

Configuration Example (Claude Desktop / Generic MCP Client)

To use this with an MCP server that runs CLI commands (like a generic "command-runner" MCP server), map the arguments as follows:

Executable: nats-view (ensure it is in your PATH)

Argument Mapping:

  • subjects -> Positional arguments
  • host -> -h
  • port -> -p
  • count -> -n
  • filter -> --filter
  • js -> --js
  • since -> --since
  • deliver_all -> --deliver-all
  • deliver_last -> --deliver-last
  • timestamp -> --timestamp
  • headers -> --headers

Note for LLMs: When using this tool, always specify a count (e.g., 10 or 50) to prevent the tool from running indefinitely when watching high-traffic subjects.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nats_view-0.2.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nats_view-0.2.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file nats_view-0.2.1.tar.gz.

File metadata

  • Download URL: nats_view-0.2.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.11 Windows/11

File hashes

Hashes for nats_view-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b497b7069d768f4ad8d28ca850d73f6324f5c67316181331e31da19d73e5d89a
MD5 1dfc9ccdbb4753e5f54fd45d8bfd2eab
BLAKE2b-256 e0767fa2f7e5c21c7159415124299bf5e524248ab5b79bb6ded3be5548bede73

See more details on using hashes here.

File details

Details for the file nats_view-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: nats_view-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.11 Windows/11

File hashes

Hashes for nats_view-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b97ef19662e6a92082d467cc5d1e158f77f21c255589aa8cb795b45db6c54648
MD5 13e14701f61cf3bab2d4799c05873093
BLAKE2b-256 bc315ad1c4034aa3000940c995cfc16ec197f9a2449ea8af197bb80baf3742d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page