NATS

by sinadarbouy

Not rated
GitHub

About

An MCP server for integrating with the NATS messaging system.

Details

Author
sinadarbouy
Categories
Communication, Infrastructure, Automation

Setup

Install NATS in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/sinadarbouy/mcp-nats

Follow the installation instructions in the repository README, then restart your MCP client.

AModel Context Protocol (MCP)server forNATSmessaging system integration

This MCP server is certified byMCP Review.

This project provides a Model Context Protocol (MCP) server for NATS, enabling AI models and applications to interact with NATS messaging systems through a standardized interface. It exposes a comprehensive set of tools for interacting with NATS servers, making it ideal for AI-powered applications that need to work with messaging systems.

The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). This server implements the MCP specification to provide NATS messaging capabilities to LLMs and AI applications, allowing them to:

- Interact with NATS messaging systems in a standardized way
- Safely inspect and monitor NATS servers and streams
- Perform read-only operations through a secure interface
- Integrate with other MCP-compatible clients and hosts

- Server Management (Read-only Operations)

- List and inspect NATS servers
- Server health monitoring and ping
- Server information retrieval
- Round-trip time (RTT) measurement

- View and inspect NATS streams
- Stream state and information queries
- Message viewing and retrieval
- Subject inspection

- Create and manage object store buckets
- Put and get files from object stores
- List buckets and their contents
- Delete objects and buckets
- Watch buckets for changes
- Seal buckets to prevent updates

- Create and manage KV buckets
- Store and retrieve key-value pairs
- Watch for KV updates
- Delete keys and buckets

- Publish messages to NATS subjects
- Support for different message formats
- Asynchronous message publishing

- View account information and metrics
- Generate account reports (connections and statistics)
- Create and restore account backups
- Inspect TLS chain for connected servers

- Handle multiple NATS accounts simultaneously
- Secure credential management

- Implements MCP server specification
- Compatible with MCP clients like Claude Desktop
- Standardized tool definitions for LLM interaction
- Safe, read-only operations for AI interaction with NATS

- Go 1.25 or later
- NATS server (accessible via URL)
- NATS credentials for authentication
- MCP-compatible client (e.g., Claude Desktop, or other MCP clients)

go install github.com/sinadarbouy/mcp-nats/cmd/mcp-nats@latest
git clone https://github.com/sinadarbouy/mcp-nats.git cd mcp-nats go build -o mcp-nats ./cmd/mcp-nats

The chart is indeploy/charts/mcp-nats. Install guides (includingOCI / GHCRand umbrella-chartdependencies), values overview, probes, and theHashiCorp Vault Agent Injectorexample are indeploy/charts/mcp-nats/README.md.

helm install mcp-nats ./deploy/charts/mcp-nats --namespace mcp-nats --create-namespace

Published releases are also installable from OCI, for example:

helm install mcp-nats oci://ghcr.io/sinadarbouy/charts/mcp-nats --version "0.1.4" --namespace mcp-nats --create-namespace

See the chart README forChart.yamldependency snippets and registry login.

Tilt Integration Test (Docker Desktop Kubernetes)

Use Tilt to deploy both official NATS and the localmcp-natschart for end-to-end auth testing.

- Tilt installed
- Helm installed
- Docker Desktop Kubernetes enabled
- Current kube context set todocker-desktop

- Tiltfile
- deploy/tilt/nats-values.yaml
- deploy/tilt/mcp-nats-values.yaml
- a local image build withdeploy/tilt/Dockerfile.tiltbefore Helm deploy

tilt down helm uninstall -n mcp-nats-tilt nats mcp-nats kubectl delete namespace mcp-nats-tilt --ignore-not-found
kubectl get pods,svc -n mcp-nats-tilt kubectl logs -n mcp-nats-tilt deploy/mcp-nats-mcp-nats kubectl logs -n mcp-nats-tilt statefulset/nats kubectl port-forward -n mcp-nats-tilt svc/mcp-nats-mcp-nats 8000:8000

- NATS is configured withmcpuser/mcppasswordindeploy/tilt/nats-values.yaml.
- mcp-natsuses the same credentials via chart-managed secret indeploy/tilt/mcp-nats-values.yaml.
- If credentials mismatch,mcp-natslogs will show connection/authentication failures.

- NATS_URL: The URL of your NATS server (e.g.,localhost:4222)
- NATS_<ACCOUNT>_CREDS: Base64 encoded NATS credentials for each account

- Example:NATS_SYS_CREDS,NATS_A_CREDS

- --transport: Transport type (stdio, sse, or streamable-http), default: streamable-http
- --address: Address for HTTP transport to listen on, default: 0.0.0.0:8000
- --endpoint-path: Endpoint path for streamable-http transport, default: /mcp
- --sse-address: Deprecated alias of--address
- --log-level: Log level (debug, info, warn, error), default: info
- --json-logs: Output logs in JSON format, default: false
- --no-authentication: Allow anonymous connections without credentials
- --user: NATS username or token (can also be set via NATS_USER env var)
- --password: NATS password (can also be set via NATS_PASSWORD env var)

- GET /livez: process liveness check (does not validate NATS dependency)
- GET /readyz: readiness check (validates TCP connectivity toNATS_URL)
- GET /healthz: compatibility alias for liveness

These endpoints are available when running withsseorstreamable-httptransport.

Default probes andlifecycle.preStopare documented indeploy/charts/mcp-nats/README.md.

The MCP NATS server supports three authentication methods:
-

Credentials-based Authentication(default): Uses NATS credentials files

- SetNATS_<ACCOUNT>_CREDSenvironment variables
- Requiresaccount_nameparameter in all tools

User/Password Authentication: Uses username and password

- SetNATS_USERandNATS_PASSWORDenvironment variables or use--userand--passwordflags

Anonymous Authentication: No authentication required

- SetNATS_NO_AUTHENTICATION=trueenvironment variable or use--no-authenticationflag

# Run with Streamable HTTP transport (default) and debug logging ./mcp-nats --log-level debug # Run with custom Streamable HTTP endpoint path ./mcp-nats --transport streamable-http --address localhost:9000 --endpoint-path /mcp # Run with JSON logging ./mcp-nats --json-logs # Run with SSE transport ./mcp-nats --transport sse --address localhost:9000 # Run with anonymous authentication ./mcp-nats --no-authentication # Run with user/password authentication ./mcp-nats --user myuser --password mypass # Run with environment variables for authentication NATS_NO_AUTHENTICATION=true ./mcp-nats NATS_USER=myuser NATS_PASSWORD=mypass ./mcp-nats

Make sure your .vscode/settings.json includes:

"mcp": { "servers": { "nats": { "type": "streamable-http", "url": "http://localhost:8000/mcp" } } }
{ "mcpServers": { "nats": { "env": { "NATS_URL": "nats://localhost:4222", "NATS_SYS_CREDS": "<base64 of SYS account creds>", "NATS_A_CREDS": "<base64 of A account creds>" }, "url": "http://localhost:8000/mcp" } } }
{ "mcpServers": { "nats": { "env": { "NATS_URL": "nats://localhost:4222", "NATS_NO_AUTHENTICATION": "true" }, "url": "http://localhost:8000/mcp" } } }
{ "mcpServers": { "nats": { "env": { "NATS_URL": "nats://localhost:4222", "NATS_USER": "myuser", "NATS_PASSWORD": "mypass" }, "url": "http://localhost:8000/mcp" } } }
{ "mcpServers": { "nats": { "command": "mcp-nats", "args": [ "--transport", "stdio" ], "env": { "NATS_URL": "nats://localhost:4222", "NATS_SYS_CREDS": "<base64 of SYS account creds>", "NATS_A_CREDS": "<base64 of A account creds>" } } } }
{ "mcpServers": { "nats": { "command": "mcp-nats", "args": [ "--transport", "stdio", "--no-authentication" ], "env": { "NATS_URL": "nats://localhost:4222" } } } }

User/Password Authentication with Binary:

{ "mcpServers": { "nats": { "command": "mcp-nats", "args": [ "--transport", "stdio", "--user", "myuser" ], "env": { "NATS_URL": "nats://localhost:4222", "NATS_PASSWORD": "mypass" } } } }
{ "mcpServers": { "nats": { "command": "docker", "args": [ "run", "-i", "--rm", "--init", "-e", "NATS_URL", "-e", "NATS_SYS_CREDS", "ghcr.io/sinadarbouy/mcp-nats:0.1.4", "--transport", "stdio" ], "env": { "NATS_SYS_CREDS": "<base64 of SYS account creds>", "NATS_URL": "<nats url>" } } } }

- Go 1.25+
- Docker (optional)
- NATS CLI
- Understanding of MCP specification

make help # Print help message make build # Build the binary make run # Run in stdio mode make run-sse # Run with SSE transport make lint # Run linters

For detailed instructions on how to test the MCP server using stdio transport, please refer to ourStdio Example Guide.

- Model Context Protocol Documentation
-
MCP Specification
-
Example MCP Servers

MCP server for NATS — publish, request-reply, JetStream streams, KV store, and server diagnostics over stdio

A Go-based MCP server for integrating with the RabbitMQ message broker.

Provides tools to interact with the Ansible Automation Platform API for automation tasks.

An MCP server with built-in Feishu OAuth authentication, deployable on Cloudflare Workers.

Manages Infrastructure as Code (IaC) operations using Ansible and Terraform. Requires external tools and manual setup.

An MCP server for managing Ray clusters, jobs, and distributed computing workflows.

Interact with any other SaaS applications on behalf of your customers.

1001SMS MCP Server helps developers give AI agents access to temporary phone numbers for account registrations, OTP verifications, SMS code receiving, and automated signup workflows. Easy integration for MCP-compatible tools and custom agents.

An MCP server client for the Agent-to-Agent (A2A) protocol, enabling LLMs to interact with A2A agents.

A bridge server connecting Model Context Protocol (MCP) with Agent-to-Agent (A2A) protocol.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.