PubNub MCP Server

io.github.pubnub由 GitHub 帳號 pubnub 發布v2.3.2更新於 Oct 24, 2026

PubNub Model Context Protocol MCP Server for Cursor and Claude

概覽

AI 產生的概覽

讓助理查詢 PubNub SDK 文件,並管理 PubNub 應用程式、金鑰集、頻道、訊息與分析資料。

可以做什麼
提供 PubNub SDK 與 Chat SDK 文件、概念指南、遷移指南,以及多種語言的最佳實務提示。提供工具用來建立與更新應用程式和金鑰集、傳送與接收即時訊息或訊號、取得歷史訊息、查看上線狀態,以及管理使用者、頻道與成員關係。也提供用量指標、Illuminate 分析與自動化管理,以及 Insights 彙總分析查詢。
適用情境
適合在 PubNub 上建置或維護即時應用程式時,希望助理直接取得最新 SDK 文件、產生程式碼或操作 PubNub 資源。也適合在同一個工作階段中查看用量、上線狀態與分析資料。
執行需求
本機使用透過 npx 執行 npm 套件 @pubnub/mcp,需要 Node.js 20.0.0 或以上版本。帳戶層級操作需要以 PUBNUB_API_KEY 提供 PubNub API 金鑰;即時操作可選用 PUBNUB_PUBLISH_KEY、PUBNUB_SUBSCRIBE_KEY 與 PUBNUB_USER_ID。部分分析功能需要具備 Insights Read 權限的 Service Integration 金鑰及進階方案。
安裝前請注意
此伺服器涉及機密:PUBNUB_API_KEY、PUBNUB_PASSWORD、PUBNUB_PUBLISH_KEY 與 PUBNUB_SUBSCRIBE_KEY 應視為憑證,切勿外洩。工具可以建立與更新應用程式和金鑰集、傳送訊息,並變更使用者、頻道與成員關係,因此寫入操作會影響線上的 PubNub 資料。分析與用量資料會傳送至 PubNub,部分功能需要付費方案。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 PubNub MCP Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

PubNub MCP Server

A hosted Model Context Protocol (MCP) server that exposes PubNub SDK documentation and PubNub API resources to LLM-powered tools. This improves the LLM AI Agent's ability to understand and interact with PubNub's SDKs and APIs. Uses HTTP transport with OAuth authentication.

[PubNub MCP Server]

Features

  • 📚 Comprehensive SDK Documentation - Access detailed documentation, code examples, and implementation guides for 20+ programming languages including JavaScript, Python, Java, Swift, Kotlin, C#, Ruby, Go, and more
  • 🏗️ Application & Keyset Management - Create, configure, and manage PubNub applications and keysets with features like message persistence, file sharing, presence tracking, and app context
  • 💬 Real-time Communication - Send and receive messages across channels, implement live chat, notifications, and real-time updates with support for both messages and lightweight signals
  • 👥 User & Channel Management - Manage user profiles, channel metadata, and membership relationships with full CRUD operations for building community and social features. In addition, there is an option to view & manage user profiles, channels and memberships in PubNub Admin Portal (this requires Manage Premium).
  • 📍 Presence & Activity Tracking - Monitor real-time user presence, see who's online in channels, and track user activity across your application
  • 📊 Real-time Decisioning & Analytics - Trigger the right action when it matters, measure its impact, and adjust as conditions change -- all in real-time. Requires Illuminate.
  • 📈 Channel, User & Message Analytics - Spot patterns in aggregated app activity, from top channels and country breakdowns to new vs. recurring users and device distribution, to understand engagement, usage, and performance. In addition, limited metrics are available for viewing in PubNub Admin Portal without Manage Premium; full analytics require Manage Premium.
  • 🔍 Usage & Monitoring — Track billable usage across apps and keysets, review current and historical consumption, and export reports to understand cost drivers.
  • 🔧 Multi-Platform Integration - Works with Cursor, Visual Studio Code, Claude Code, and other MCP-compatible AI assistants
  • ⚡ Developer Experience - Built with TypeScript for type safety, includes testing infrastructure

Quick Start

The hosted server is managed by PubNub and provides the easiest way to get started — no installation required, and authentication is handled automatically via OAuth. If your AI tool doesn't support remote MCP servers, use the locally installed version (npx @pubnub/mcp@latest) instead.

Note: To switch to the hosted server (https://mcp.pubnub.com), remove the old local configuration from your AI client first, then follow the setup steps below.

Hosted PubNub MCP Server

Connect your AI assistant to https://mcp.pubnub.com — no installation required. Authentication is handled automatically via OAuth.

VS Code

[Open in VS Code]

Click the button above, then select Open in Visual Studio Code. Back in VS Code, click Install, then select the organization you want to authorize and click Allow access.

Alternatively, add the following to your VS Code settings.json manually:

json
{  "mcp": {    "servers": {      "pubnub": {        "url": "https://mcp.pubnub.com"      }    }  }}

Learn more in VS Code documentation

Cursor

[Add to Cursor]

Click the button above, then select Open Cursor. In Cursor, click Install, select the organization you want to authorize, and click Allow access. Navigate to Cursor Settings → Tools & MCP to verify PubNub is enabled.

Alternatively, add the following to .cursor/mcp.json (or ~/.cursor/mcp.json for global configuration) manually:

json
{  "mcpServers": {    "pubnub": {      "url": "https://mcp.pubnub.com"    }  }}

When you save the file, a notification is displayed. Click Enable to activate the MCP server. Learn more in Cursor documentation

Claude Code

In the terminal, run:

bash
claude mcp add --scope user --transport http pubnub https://mcp.pubnub.com

Then run claude to open Claude Code and enter /mcp. Select pubnub, then authenticate, and click Allow access to complete authorization. Learn more in Claude Code documentation

Claude Desktop

Note: The following instructions apply to Pro and Max plans. For Enterprise plans, the setup is configured by your organization administrator. Refer to Anthropic's documentation for details.

  1. In Claude Desktop, navigate to Customize → Connectors.
  2. Click + and select Add custom connector.
  3. Enter https://mcp.pubnub.com as the connector URL.
  4. Complete the OAuth login when prompted.

Learn more in Claude Desktop documentation

Codex

In the terminal, run:

bash
codex mcp add pubnub --url https://mcp.pubnub.com

Then run codex mcp login pubnub to authenticate, select the organization you want to authorize, and click Allow access. Learn more in Codex documentation

Codex Desktop
  1. Navigate to Settings → MCP servers and click + Add server.
  2. Select Streamable HTTP as the transport type.
  3. Enter https://mcp.pubnub.com as the server URL.
  4. Follow the OAuth login prompt to complete authorization.

Learn more in Codex Desktop documentation

Gemini CLI

In the terminal, run:

bash
gemini mcp add pubnub --scope user --transport http https://mcp.pubnub.com

Then run gemini to open Gemini CLI and run /mcp auth pubnub to authenticate. Learn more in Gemini CLI documentation

OpenCode

Add the following to ~/.config/opencode/config.json:

json
{  "mcp": {    "pubnub": {      "type": "remote",      "url": "https://mcp.pubnub.com",      "enabled": true    }  }}

Then run opencode mcp auth pubnub to authenticate. Learn more in OpenCode documentation

Local PubNub MCP Server

If your AI tool doesn't support remote MCP servers, run the server locally with:

bash
npx @pubnub/mcp@latest
API Key

Before you begin, we highly recommend creating a Service Integration in the PubNub Admin Portal and providing your API key to the MCP server. While some basic features will work without it, adding an API key unlocks much more functionality. Alternatively, refer to Local server configuration for instructions on configuring the server to work with a single PubNub keyset.

The installation process for an MCP server depends on the AI assistant you're using. For the standard setup, you'll need Node.js (v20.0.0 or higher).

VS Code

[Open in VS Code]

Just click the link above, then select "Open in Visual Studio Code" on the page that appears. Back in VS Code, click "Install". You'll be prompted to enter your PubNub API Key. Once provided, your MCP server is ready to use. For additional configuration options, refer to Local server configuration.

Cursor

[Add to Cursor]

Click the link above, then select "Open Cursor" on the page that appears. Back in Cursor, there's a "Install MCP Server?" prompt. Make sure to provide the value for variable holding your PubNub API Key. Once you do, click "Install". Your MCP server is now ready to use. For additional configuration options, refer to Local server configuration.

Claude Code

With Claude Code installed run this command to have the MCP added to your configuration. Make sure to replace the value of <your-api-key>:

bash
claude mcp add pubnub --env PUBNUB_API_KEY=<your-api-key> --scope user --transport stdio -- npx -y @pubnub/mcp@latest

Server is added in the "User" scope which means it will be available across all projects. For additional configuration options, refer to Local server configuration.

Codex

With Codex installed run this command to have the MCP added to your configuration. Make sure to replace the value of <your-api-key>:

bash
codex mcp add pubnub --env PUBNUB_API_KEY=<your-api-key> -- npx -y @pubnub/mcp@latest

For additional configuration options, refer to Local server configuration.

Gemini CLI

Gemini CLI does not support automatic MCP installations. You'll have to manually edit your settings.json file and add the section below. Make sure to replace the value of <your-api-key>:

json
"mcpServers": {  "pubnub": {    "command": "npx",    "args": [      "-y",      "@pubnub/mcp@latest"    ],    "env": {      "PUBNUB_API_KEY": "<your-api-key>"    }  }}

For additional configuration options, refer to the Local server configuration section in the PubNub documentation.

Development

Prerequisites

  • Node.js >= 20.0.0

Running locally

bash
npm installnpm run dev

Environment variables

VariableDescriptionRequired
PORTHTTP server port (default: 3000)No
MCP_OAUTH_ENABLEDEnable OAuth authenticationYes (for production)
OAUTH_ISSUEROAuth authorization server URLWhen OAuth enabled
OAUTH_CLIENT_IDOAuth client IDWhen OAuth enabled
OAUTH_CLIENT_SECRETOAuth client secretWhen OAuth enabled
ADMIN_API_RESOURCE_URLAdmin API resource identifierWhen OAuth enabled
MCP_RESOURCE_URLMCP resource URLWhen OAuth enabled
MCP_CLOUD_MODECloud deployment modeNo
MCP_SESSION_SUPPORTEnable session persistenceNo
ADMIN_API_V2_URLOverride Admin API v2 endpointNo
PUBNUB_ORIGINOverride PubNub originNo
SDK_DOCS_API_URLOverride docs API endpointNo

Testing

bash
npm run test:unit        # Unit testsnpm run test:integration # Integration tests (requires build)npm run test:coverage    # Coverage report

API Reference

This PubNub MCP server provides a comprehensive set of tools, resources, and prompts to help you build real-time applications. Below is a complete reference of all available functionality:

Tools

Documentation Access
  • get_sdk_documentation - Get PubNub Core SDK documentation for specific programming languages and features
  • get_chat_sdk_documentation - Get PubNub Chat SDK documentation for specific programming languages and features
  • how_to - Get PubNub conceptual guides for specific use cases and integrations
  • write_pubnub_app - Get PubNub best practices guide covering architecture, security, channel modeling, and optimization
  • get_sdk_migration_guide - Get SDK version migration guides
  • get_general_migration_guide - Get general platform migration guides
App & Keyset Management
  • manage_apps - Manage PubNub apps (list, create, update)
  • manage_keysets - Manage PubNub keysets (get, list, create, update)
  • get_usage_metrics - Fetch usage metrics for an account, app, or keyset
Real-time Communication
  • 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 message limits
  • get_pubnub_messages - Fetch historical messages from one or more PubNub channels
  • get_pubnub_presence - Get presence data using HereNow (channel occupancy) or WhereNow (user's channels)
  • manage_app_context - Manage PubNub App Context (Objects API) for users, channels, and memberships with full CRUD operations
Illuminate Analytics & Automation
  • manage_illuminate - Manage PubNub Illuminate resources (business objects, queries, metrics, decisions, dashboards) with full CRUD, activation, analytics queries, action log inspection, and test data publishing
Insights Analytics
  • insights - Query PubNub Insights for aggregated analytics metrics: unique channels/users, message volume, top-N rankings (channels, users, message types), country breakdowns, new vs. recurring user trends, user duration, and device type distributions. Requires a Service Integration API key with Account-level Insights Read access and Insights Premium tier.

Prompts

Healthcare & HIPAA Compliance
  • hipaa-chat-short - Quick prompt to create HIPAA compliant chat applications
  • hipaa-chat-long - Detailed prompt for HIPAA compliant chat with Pub/Sub, Presence, and App Context
React Development
  • react-app-short - Scaffold a React app with PubNub Pub/Sub and Presence
  • react-app-long - Comprehensive React app with real-time messaging, presence indicators, and user metadata
Gaming Applications
  • gamelobby-short - Build multiplayer game lobby with chat and presence
  • gamelobby-long - Advanced multiplayer lobby with team assignments and real-time features
OEM & Multi-Tenant Solutions
  • oem-client-management - Create apps and configure keysets for OEM client deployments
  • multi-tenant-onboarding-short - Implement automated tenant onboarding for SaaS applications
  • multi-tenant-onboarding-long - Enterprise-grade multi-tenant onboarding with data isolation and error handling
Illuminate Analytics & Automation
  • illuminate-spam-detection - Set up an Illuminate spam detection pipeline with escalating moderation actions
  • illuminate-reward-engagement - Build an Illuminate engagement reward pipeline for live events and gaming
  • illuminate-use-case - Guided setup of any Illuminate analytics and automation use case
  • illuminate-test-verify - Test and verify an existing Illuminate configuration end-to-end
Insights Analytics
  • insights-snapshot - Quick high-level analytics snapshot for a date range: unique channels, unique users, message volume, top 20 channels by messages, and anomaly callouts
  • insights-channel-analysis - Deep dive into top channels by ranking category, channel naming patterns, and cross-category engagement comparisons
  • insights-user-growth - New vs. recurring user trends, daily/weekly/monthly breakdowns, top countries, and whale user identification
  • insights-engagement-deep-dive - Average user duration, session-length bucket histogram, top channels by user-minutes, and device-type breakdown across publishes, subscribers, and unique users

Resources

  • pubnub_sdk_docs - Access PubNub SDK documentation via URI scheme: pubnub-docs://sdk/{language}/{feature}

Supported languages: asyncio, c-core, c-sharp, dart, freertos, go, java, javascript, kotlin, mbed, objective-c, php, posix-c, posix-cpp, python, ruby, rust, swift, unity, unreal, windows-c, windows-cpp

Supported features: access-manager, access-manager-v2, channel-groups, configuration, encryption, files, message-actions, misc, mobile-push, objects, presence, publish-and-subscribe, storage-and-playback

  • pubnub_chat_sdk_docs - Access PubNub Chat SDK documentation via URI scheme: pubnub-docs://chat-sdk/{language}/{feature}

Supported Languages: javascript, kotlin, swift, unity, unreal

Supported Features: channels-create, channels-delete, channels-details, channels-invite, channels-join, channels-leave, channels-list, channels-membership, channels-references, channels-typing-indicator, channels-updates, channels-watch, connection-management, custom-events, error-logging, messages-delete, messages-details, messages-drafts, messages-files, messages-forward, messages-history, messages-links, messages-moderation, messages-pinned, messages-quotes, messages-reactions, messages-read-receipts, messages-restore, messages-send-receive, messages-threads, messages-unread, messages-updates, moderation, push-notifications, users-create, users-delete, users-details, users-list, users-mentions, users-moderation, users-moderation-user, users-permissions, users-presence, users-updates, utility-methods

來源:README.md,提交 05221c6

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v2.3.2最新Sep 16, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。