Get the FREE Ultimate OpenClaw Setup Guide →

mcp-nats

A Model Context Protocol (MCP) server for NATS messaging system integration

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio sinadarbouy-mcp-nats docker run -i --rm --init -e NATS_URL -e NATS_NO_AUTHENTICATION cnadb/mcp-nats --transport stdio \
  --env NATS_URL="nats://localhost:4222" \
  --env NATS_NO_AUTHENTICATION="true"

How to use

The mcp-nats MCP server implements the Model Context Protocol to expose a NATS messaging system and its resources (servers, streams, object stores, KV, and publishing) to LLM-based tooling. It provides read-only and safe interaction capabilities for AI agents, including viewing server health, inspecting streams and subjects, managing object stores and KV buckets, and publishing messages to NATS subjects. You can connect with MCP-compatible clients (e.g., Claude Desktop) or through an MCP-enabled UI to issue standardized tools against your NATS deployment. The server supports multiple authentication modes (credentials, user/password, or anonymous) and can be run via Docker, Go binary, or other supported runtimes depending on your deployment preferences. Example interactions include listing NATS streams, viewing stream state, publishing messages to a subject, and inspecting account metrics, all while ensuring read-only access where configured. The provided configuration examples show how to run the server with a container and how to wire environment variables for authentication and the NATS URL.

How to install

Prerequisites:

  • Docker installed on your system (for container-based deployment) or Go toolchain if building from source.
  • Access to a NATS server (URL and credentials as needed).

Using Docker (recommended as a quickstart):

  1. Ensure Docker is running.
  2. Run the MCP NATS container with appropriate environment variables: docker run -i --rm --init
    -e NATS_URL=nats://localhost:4222
    -e NATS_NO_AUTHENTICATION=true
    cnadb/mcp-nats
    --transport stdio

Building from source (Go):

  1. Install Go (1.20+ is typical; check README for exact version requirements).
  2. Clone the repository and build: git clone https://github.com/sinadarbouy/mcp-nats.git cd mcp-nats go build -o mcp-nats ./cmd/mcp-nats
  3. Run the binary with proper environment variables (example below): NATS_URL=nats://localhost:4222 ./mcp-nats --transport stdio

Configuration tips:

  • Set NATS_URL to the URL of your NATS server.
  • Configure authentication as needed (NATS_SYS_CREDS, NATS_USER/NATS_PASSWORD, or NATS_NO_AUTHENTICATION).
  • Adjust transport to sse if you want SSE-based communication instead of stdio.

For VSCode users, you can wire an MCP server entry with a container-based or binary-based setup as shown in the README examples.

Additional notes

Notes and tips:

  • The MCP NATS server supports three authentication modes: credentials-based, user/password, and anonymous. Choose the mode that matches your NATS setup and set the corresponding environment variables or flags.
  • If running in Docker, ensure the NATS_URL is reachable from the container and that any required credentials are provided via environment variables.
  • By default, the MCP server exposes read-only operations for safety. Review and customize access control if you need write capabilities.
  • When using VSCode MCP integration, you can supply environment blocks or URL endpoints (e.g., SSE at /sse) depending on how you deploy.
  • The npm_package field is not applicable for this Go-based MCP server; use the Docker or binary run commands shown in the README for deployment.

Related MCP Servers

Sponsor this space

Reach thousands of developers