MCP.so
Sign In
Servers

Nats Mcp

@sinadarbouy

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-po

Installation

Using Go

go install github.com/sinadarbouy/mcp-nats/cmd/mcp-nats@latest

Building from Source

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

Configuration

Environment Variables

  • NATS_URL: The URL of your NATS server (e.g., nats://localhost:4222)
  • NATS_<ACCOUNT>_CREDS: Base64 encoded NATS credentials for each account
    • Example: NATS_SYS_CREDS, NATS_A_CREDS

Command Line Flags

  • --transport: Transport type (stdio or sse), default: stdio
  • --sse-address: Address for SSE server to listen on, default: 0.0.0.0:8000
  • --log-level: Log level (debug, info, warn, error), default: info
  • --json-logs: Output logs in JSON format, default: false

Example Usage

# Run with SSE transport and debug logging
./mcp-nats --transport sse --log-level debug

# Run with JSON logging
./mcp-nats --json-logs

# Run with custom SSE address
./mcp-nats --transport sse --sse-address localhost:9000

Using VSCode with remote MCP server

Make sure your .vscode/settings.json includes:

"mcp": {
  "servers": {
    "nats": {
      "type": "sse",
      "url": "http://localhost:8000/sse"
    }
  }
}

or cursor

{
  "mcpServers": {
    "nats": {
      "env": {
        "NATS_URL": "localhost:42222",
        "NATS_SYS_CREDS": "<base64 of SYS account creds>"
        "NATS_A_CREDS": "<base64 of A account creds>"
      },
      "url": "http://localhost:8000/sse"
    }
  }
}

If using the binary:

{
  "mcpServers": {
    "nats": {
      "command": "mcp-nats",
      "args": [
        "--transport",
        "stdio"
      ],
      "env": {
        "NATS_URL": "localhost:42222",
        "NATS_SYS_CREDS": "<base64 of SYS account creds>"
        "NATS_A_CREDS": "<base64 of A account creds>"
      }
    }
  }
}

if using docker:

{
  "mcpServers": {
    "nats": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--init",
        "-e",
        "NATS_URL",
        "-e",
        "NATS_SYS_CREDS",
        "cnadb/mcp-nats",
        "--transport",
        "stdio"
      ],
      "env": {
        "NATS_SYS_CREDS": "<base64 of SYS account creds>",
        "NATS_URL": "<nats url>"
      }
    }
  }
}

More from Other