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.1.0.tar.gz (5.2 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.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nats_view-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 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.1.0.tar.gz
Algorithm Hash digest
SHA256 73207706afd67cd06e1caf96244afd752af5bf45e56c8e2261a2bafd7e7cf278
MD5 7354fb23b7fa2798269c91a12c27b428
BLAKE2b-256 473379fe448a592c0fe4a543c44893350b2cc09577baff0592e18c5744d3a720

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nats_view-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7884839a7f97b532c46856883b242ca339f36aa21ab1190227b6bf2a54903667
MD5 e5cf005d41e6696e312b4596e115c948
BLAKE2b-256 7da09657ec628ba351a1dabac1f1130deefd37b66ba86fa7435dc7e9d9f495a3

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