PubNub

Provides an MCP server to access PubNub SDK docs, app/keyset management, real-time messaging, presence, and app context via MCP clients.
  • typescript

8

GitHub Stars

typescript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "pubnub-pubnub-mcp-server": {
      "command": "claude",
      "args": [
        "mcp",
        "add",
        "PubNub",
        "--env",
        "PUBNUB_API_KEY=<your-api-key>",
        "--scope",
        "user",
        "--transport",
        "stdio",
        "--",
        "npx",
        "-y",
        "@pubnub/mcp@latest"
      ],
      "env": {
        "PUBNUB_EMAIL": "user@example.com",
        "PUBNUB_API_KEY": "<your-api-key>",
        "PUBNUB_USER_ID": "user-1234",
        "PUBNUB_PASSWORD": "password123",
        "PUBNUB_PUBLISH_KEY": "pub-c-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "PUBNUB_SUBSCRIBE_KEY": "sub-c-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      }
    }
  }
}

You can run a PubNub MCP Server to expose PubNub SDK documentation and API resources to your MCP-powered tools, enabling real-time messaging, presence, and app context operations across your development workflow.

How to use

You will interact with the MCP server through your MCP client (such as Claude Code, Codex, Gemini CLI, Cursor, or Visual Studio Code). The server provides tools and prompts to access PubNub SDK docs, manage apps and keysets, send and receive real-time messages, query presence data, and work with PubNub App Context. Use the client’s MCP integration commands to add or reference PubNub as an MCP server, supplying your API key when prompted or configured.

How to install

Prerequisites: ensure you have Node.js (which includes npm) installed on your machine.

Choose one of the supported MCP clients and follow the installation or configuration steps shown in the client’s MCP integration flow. The following concrete commands illustrate common ways to add PubNub MCP support in your environment.

# Claude Code example
claude mcp add PubNub --env PUBNUB_API_KEY=<your-api-key> --scope user --transport stdio -- npx -y @pubnub/mcp@latest

# Codex example
codex mcp add PubNub --env PUBNUB_API_KEY=<your-api-key> -- npx -y @pubnub/mcp@latest

# Gemini CLI example (configuration snippet shown in the settings.json file)
"mcpServers": {
  "pubnub": {
    "command": "npx",
    "args": [
      "-y",
      "@pubnub/mcp@latest"
    ],
    "env": {
      "PUBNUB_API_KEY": "<your-api-key>"
    }
  }
}

# Docker-based usage (alternative runtime)
{
  "mcpServers": {
    "PubNub": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "PUBNUB_API_KEY",
        "pubnub/pubnub-mcp-server"
      ],
      "env": {
        "PUBNUB_API_KEY": "<your-api-key>"
      }
    }
  }
}
"}

Additional configuration and usage notes

The MCP server supports different configurations for PubNub keys and keys handling. You can run in dynamic mode (no env keys set) or fixed mode (env keys provided). In dynamic mode, tools will request keys as parameters for each call and you can operate across multiple keysets within a single session. In fixed mode, the server operates with a single keyset and Pub/Sub keys are hidden from tool schemas for streamlined, focused workflows.

If you prefer a Docker-based setup, you can configure your editor or client with a Docker command that runs the MCP server container and exposes the required environment variables, including PUBNUB_API_KEY.

Environment variables you may configure include PUBNUB_API_KEY (required for all account/keyset operations), PUBNUB_PUBLISH_KEY, PUBNUB_SUBSCRIBE_KEY, PUBNUB_USER_ID, PUBNUB_EMAIL (deprecated in favor of API Key), and PUBNUB_PASSWORD (deprecated in favor of API Key). Use placeholder values in examples until you supply real credentials.

Troubleshooting and tips

If you encounter issues connecting, verify that your API Key is valid and that you are using the correct mode (dynamic vs fixed). Check that the MCP client is correctly configured with the appropriate command, arguments, and environment variables. Ensure the MCP server process is reachable from your MCP client and that any required network access or permissions are in place.

Security and best practices

Treat your PubNub API key as a sensitive credential. Use the dynamic mode to minimize exposure when managing multiple keysets, and favor fixed mode when workflows require a single, stable keyset. Store environment variables securely in your editor or CI/CD environment and rotate keys according to your security policies.

Examples of what you can do with the MCP server

  • Retrieve and view PubNub SDK docs for multiple languages to accelerate integration work.

  • Create and configure PubNub apps and keysets, enabling message persistence, file sharing, and presence features.

  • Send real-time messages and lightweight signals to channels, and observe presence and activity across users and channels.

  • Access App Context data and perform full CRUD on user, channel, and membership objects to build social features.

Tool and endpoint overview

This MCP server exposes a variety of tools and endpoints to help you build and manage PubNub-powered applications, including documentation access, app and keyset management, real-time messaging, presence, and app context operations.

Available tools

get_sdk_documentation

Retrieve PubNub Core SDK documentation for a specified language and feature set.

get_chat_sdk_documentation

Retrieve PubNub Chat SDK documentation for a specified language and feature set.

how_to

Obtain conceptual guides for PubNub use cases and integrations.

write_pubnub_app

Get best practices for PubNub architecture, security, channel modeling, and optimization.

manage_apps

List, create, and update PubNub applications (requires API key authentication).

manage_keysets

Get, list, create, and update PubNub keysets (requires API key authentication).

get_usage_metrics

Fetch usage metrics for an account, app, or keyset (requires API key authentication).

send_pubnub_message

Send messages or lightweight signals to PubNub channels in real time.

subscribe_and_receive_pubnub_messages

Subscribe to channels and receive real-time messages with configurable timeout and limits.

get_pubnub_messages

Fetch historical messages from one or more PubNub channels.

get_pubnub_presence

Get presence data using HereNow or WhereNow.

manage_app_context

CRUD operations for PubNub App Context (Objects API) for users, channels, and memberships.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational