Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
HTTP_PORTNoPort number to enable Server-Sent Events (SSE) HTTP transport mode
PUBNUB_PUBLISH_KEYNoYour PubNub publish key (required for publishing messages)
PUBNUB_SUBSCRIBE_KEYNoYour PubNub subscribe key (required for subscribing and message history)
MCP_SUBSCRIBE_ANALYTICS_DISABLEDNoSet to 'true' to disable the PubNub server analytics subscription

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}
prompts
{
  "listChanged": true
}
resources
{
  "listChanged": true
}
completions
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
get_sdk_documentationA

Retrieve Core SDK documentation for low-level real-time features.

  **When to use:**
  - Building NON-CHAT real-time apps (IoT, gaming state sync, live analytics, notifications)
  - Need fine-grained control over pub/sub, presence, storage, or access management
  - Implementing custom real-time patterns
  - Need API reference for specific SDK methods (publish, subscribe, history, etc.)

  **Do NOT use for:**
  - Chat/messaging apps → use "get_chat_sdk_documentation" instead
  - Conceptual guides → use "how_to"

  Returns code examples, API references, and implementation guides for the specified language/feature combination.
get_chat_sdk_documentationA

Retrieve Chat SDK documentation for building chat/messaging applications.

  **When to use:**
  - Building ANY chat or messaging application (1:1, group, channels)
  - Need typing indicators, read receipts, @mentions, unread counts
  - Want message threads, reactions, pinned messages, moderation
  - Need user/channel management with chat-specific features
  - Prefer rapid development with intuitive methods like sendText(), startTyping(), join()

  **Do NOT use for:**
  - Non-chat real-time apps (IoT, gaming state, analytics) → use "get_sdk_documentation"
  - Conceptual guides → use "how_to"

  **Example features:**
  - messages-send-receive, messages-threads, messages-reactions
  - channels-create, channels-join, channels-typing-indicator
  - users-mentions, users-presence

  Returns code examples and API references for the specified language/feature.
get_sdk_migration_guideA

Retrieve SDK migration guides for upgrading between PubNub SDK versions.

  **When to use:**
  - Upgrading a PubNub SDK to a newer major version
  - Need step-by-step instructions for migrating breaking changes
  - Refactoring a codebase after a PubNub SDK version bump

  **Do NOT use for:**
  - General SDK documentation → use "get_sdk_documentation"
  - Chat SDK documentation → use "get_chat_sdk_documentation"

  Returns the migration guide content for the specified language and target version.
get_general_migration_guideA

Retrieve general migration guides for cross-cutting PubNub platform changes.

  **When to use:**
  - Migrating to a new encryption standard (e.g. 256-bit encryption)
  - Upgrading push notification setup (e.g. APNs HTTP/2, FCM v1)
  - Migrating to new API versions (e.g. Access Manager v3, Objects v2)
  - Replacing deprecated features (e.g. legacy webhooks)

  **Do NOT use for:**
  - SDK version upgrades (e.g. JavaScript v7→v8) → use "get_sdk_migration_guide"
  - General SDK documentation → use "get_sdk_documentation"

  Returns the migration guide content for the specified slug.
how_toA

Retrieve conceptual guides for specific PubNub use cases and integrations. When to use: - Learning how to implement a specific use case (gaming, healthcare, IoT) - Need step-by-step integration guide for a platform (Unity, Unreal etc) - Understanding PubNub features in context (presence, push notifications, functions)

  **Do NOT use for:**
  - API reference or code samples of a specific PubNub features → use `get_sdk_documentation` or `get_chat_sdk_documentation`
  - General best practices → use `write_pubnub_app`
  
write_pubnub_appA

Retrieve PubNub best practices guide covering: 1) Architecture & project setup (environments, payload sizes), 2) Security (Access Manager tokens, least privilege, PII hygiene), 3) Channel & data modeling (naming conventions, message schemas), 4) Publish/Subscribe patterns, 5) History usage, 6) Client reliability (reconnect, idempotency, ordering), 7) Functions/edge logic, 8) Presence & state, 9) App Context, 10) Mobile specifics (push notifications, caching), 11) Web specifics (tab lifecycle, Service Workers), 12) Observability & ops, 13) Performance & cost optimization. Call this tool when building PubNub applications to ensure robust, scalable, and secure implementations.

manage_appsA

Manages PubNub apps with operations: list, create, update. - 'list': List all apps on your account. - 'create': Create a new app. User must provide data.name. - 'update': Update an existing app name. User must provide data.id and data.name.

manage_keysetsA

Manages PubNub keysets with operations: get, list, create, update. - 'get': Get a specific keyset information. User needs to provide the keyset id. - 'list': List all keysets for your account or a specific app. - 'create': Create a new keyset. New keyset is created with Message Persistence, App Context, Files, and Presence enabled by default; the user must provide name, production, and config with nested objects (messagePersistence, appContext, files, presence), and if any required parameter is missing, you must ask the user to provide it. - 'update': Update an existing keyset. User needs to provide the keyset id and the config to update.

get_usage_metricsB

Fetches usage metrics from the PubNub Admin API for an account, app, or keyset.

  **Parameters:**
  - entityType: 'account', 'app', or 'keyset'
  - entityId: The ID of the entity
  - from: Start date (inclusive) in YYYY-MM-DD format
  - to: End date (exclusive) in YYYY-MM-DD format
  - metrics: Array of metric names to retrieve

  **Available Metric Categories:**
  - Core transactions: txn_total, mtd_txn_total, replicated, signals, edge
  - MAU/UUID: mtd_uuid, uuid, pn_uuid
  - Messages: msgs_total, publish, subscribe_msgs, history_msgs, files_msgs, push_msgs
  - Storage: bytes_stored, bytes_stored_messages, bytes_stored_files, etc.
  - Access Manager: accessmanager_grants_transactions, accessmanager_audits_transactions
  - Functions: executions, kv_read_transactions, kv_write_transactions
  - History: history_transactions, history_with_actions_transactions
  - Message Actions: message_actions_add_transactions, message_actions_get_transactions
  - Objects/App Context: objects_create_user_transactions, objects_get_user_transactions, etc.
  - Presence: presence_herenow_transactions, presence_wherenow_transactions
  - Push Notifications: apns_sent_transactions, gcm_sent_transactions
  - Subscribe: subscribe_transactions, subscribe_heartbeats_transactions
  - Publish: publish_transactions, publish_bytes
  - Signal: signal_transactions
  - Files: files_publish_transactions, files_get_file_transactions
manage_app_contextA

Manages PubNub App Context (Objects API) for users, channels, and memberships. Supports CRUD operations including get, set, remove, and getAll. Use this tool to manage user profiles, channel metadata, and membership relationships in your PubNub application.

send_pubnub_messageA

Send a message or signal to a PubNub channel in real-time. Supports both regular messages and lightweight signals. Plain strings are automatically wrapped in a 'text' field. Requires publish and subscribe keys from your PubNub keyset.

get_pubnub_presenceB

Retrieves real-time presence information. Use 'channels'/'channelGroups' for HereNow (occupancy/users in channel) and/or 'uuid' for WhereNow (channels a user is in). Returns presence data in JSON format. Requires publish and subscribe keys from your PubNub keyset.

subscribe_and_receive_pubnub_messagesA

Subscribe to a PubNub channel and receive messages in real-time. Specify the number of messages (default 1) and/or a timeout (default 10s, max 30s) to wait for. Requires publish and subscribe keys from your PubNub keyset.

get_pubnub_messagesA

Fetches historical messages from one or more PubNub channels. Call this tool whenever you need to access past message history. Provide a list of channel names. Returns message content and metadata in JSON format. Supports pagination with start/end timetokens and count limit.

manage_illuminateA

Manages PubNub Illuminate resources with operations: list, get, create, update, delete, activate, deactivate, get-fields, execute-adhoc, publish-fake-data, verify-query, check-action-log, raw-snapshot, aggregate, field-health, and custom-query.

  Supports full CRUD for: Business Objects, Metrics, Queries, Decisions, and Dashboards.

  **Operations:**
  - list: GET all resources of a given type
  - get: GET one resource by id
  - create: POST a new resource (Decisions use automatic 2-step POST→PUT workflow)
  - update: PUT/replace a resource
  - delete: DELETE a resource (Business Object delete cascades to all associated resources)
  - activate / deactivate: toggle isActive (Business Object) or enabled (Decision)
  - get-fields: fetch Query output field definitions (required before building a Query Decision)
  - execute-adhoc: run a one-off Query pipeline without saving it
  - publish-fake-data: generate type-aware fake PubNub messages and publish them to test Decisions. Fetches BO field schema and produces realistic values per field type. Payloads are NESTED to match each field's JSONPath (e.g. `$.message.body.application.user_id` produces `{ application: { user_id: ... } }`, not the flat key `"application.user_id"`), so JSONPath resolution works against nested BO schemas. Pass secret_key when the keyset has Access Manager enabled — initializing with the secret key grants root permissions and bypasses 403 errors. Alternatively pass auth_key with a token from grantToken(). Failures are reported per-message; partial publishes return success with a 'failures' array. NOTE: Illuminate ingests with a 20–30 second delay — wait before querying after publish.
  - verify-query: execute a saved Query by id and return results (confirms data is flowing)
  - check-action-log: fetch recent Decision action log entries to verify a Decision fired
  - raw-snapshot: return the most recent rows from a Business Object via ad-hoc query
  - aggregate: group and count BO data by user/channel or custom group_by fields
  - field-health: check which BO fields are populated vs empty (reveals JSONPath mismatches)
  - custom-query: run a fully custom ad-hoc pipeline

  **ID Dependency Chain — always capture before proceeding:**
  Business Object → id, fields[*].id
  Metric          → id, measureId, dimensionIds
  Query           → id, then call get-fields for output field IDs
  Decision        → id, inputFields[*].id, outputFields[*].id, actions[*].id
  Dashboard       → id, charts[*].id

  **Critical Decision rules:**
  hitType ('SINGLE'|'MATCH_ALL') and executeOnce (boolean) are required — omitting causes HTTP 500.
  Handler auto-injects safe defaults (hitType=SINGLE, executeOnce=false, activeFrom=now, activeUntil=now+2yr).
  The 2-step create workflow resolves field/action names → UUIDs in: action templates
  (both output variable names AND input field names — input names are sentinel-substituted
  pre-POST and restored post-POST), inputValues.inputFieldId, outputValues.outputFieldId,
  outputValues.value (dollar-brace), actionValues.actionId, and
  actionValues.executionLimitInputFieldIds. Use names everywhere.
  If the PUT step fails the handler deletes the orphaned scaffold automatically.

  **CRITICAL — QUERY decision input field naming:**
  For sourceType=QUERY decisions, each inputField.name MUST exactly match the source
  query's output field alias (case-sensitive, including underscores). Illuminate binds
  query result rows to decision inputs by NAME — not by sourceId. If names don't match,
  the decision will be created and activated successfully but will silently NEVER fire
  even with valid data. Always run get-fields on the source query first and copy the
  'field' values verbatim into your decision's inputFields[].name.

  **Business Object limits (handler pre-flights and rejects on violation):**
  - name: 1-100 characters
  - fields[].name: 1-50 characters
  - max 100 fields per BO
  - **max 5 TEXT_LONG fields per BO** (use TEXT, which holds 256 chars, for shorter strings)
  - keep `description` concise — overly long descriptions are rejected with HTTP 400 by the API

  **Decision action default:**
  When the user doesn't specify what action to fire, default to actionType='PUBNUB_PUBLISH'
  with a message body that includes the relevant input/output values via dollar-brace
  template references. PUBNUB_PUBLISH requires no external infrastructure and is trivially
  verifiable via check-action-log or by subscribing to the target channel. Only use WEBHOOK
  when the user has provided a specific URL.

  NEVER delete without explicit user confirmation.

  TOOL SELECTION GUIDE — Illuminate Claude Behavior:
  1. Intent-first: Always start from the user's desired outcome. Ask what they want
     to achieve before suggesting Business Objects, Metrics, or Decisions.
  2. Preview-first: Before creating any resources, describe automation in 1-2 sentences
     and show a conditions → actions decision table. Ask for confirmation before building.
  3. Predefined templates: For spam (flooding/cross-posting) and ranking (Top N/Bottom N),
     use the Query Builder predefined templates. Never recreate these from scratch.
  4. Built-in BO fields: For chat/moderation/ranking, User/Channel/Message/Message Type
     are auto-created. Never ask users to define them.
  5. Start simple: Minimal decision for the core goal; add complexity only when requested.
  6. PubNub extension: For delayed checks, scheduling, or orchestration beyond Illuminate,
     suggest PubNub Functions or pub/sub as the first extension path.
insightsA

Queries PubNub Insights — read-only aggregated analytics scoped to an account, app, or keyset.

  **Entity scoping:** Every query requires an entityType ('account', 'app', or 'keyset') and
  an entityId. For 'account' and 'app', the entityId is the numeric ID. For 'keyset', the
  entityId is the subscribe key (sub-c-...).

  Two endpoints, picked automatically by metric name:
  - /v2/insights        → aggregated metrics (unique_channels, unique_users, messages, etc.)
  - /v2/insights/top    → ranked metrics (top_20_channels, top_20_users, top_10_message_types, etc.)

  TOOL SELECTION GUIDE — Insights Claude Behavior:

  1. Group-aware: Insights metrics are organized into 5 functional groups — Channels, Users,
     Messages, User Behavior, Devices. When a user asks an analytic question, pick the right
     group first and then the specific metric. See the how-to guides:
     how_to(slug="how-to-get-insights-api-access"), channels, users, messages,
     user-behavior-and-devices, filters.

  2. Period rules (enforced at runtime):
     - Duration metrics (avg_user_duration, unique_users_by_duration_timeframe,
       top_*_channels_with_user_duration) → period=hourly ONLY.
     - Top-N metrics (top_20_*, top_1000_*) → hourly or daily ONLY (no weekly/monthly).
     - Country metrics → hourly or daily ONLY.
     - new_vs_recurring_users → daily / weekly / monthly only (NOT hourly).
     - All other metrics → all four periods supported.

  3. Top metrics REQUIRE category. Without it, the call errors. Valid categories:
     by_messages, by_chats, by_subscribers, by_users_with_messages,
     by_users_with_chats, by_subscribed_channels, all.

  4. Top-metric filtering uses `filters` (JSON), not `filter`. Use `filters` on
     top_20_* / top_1000_* for thresholds (count_messages gt), allowlists (channel_name
     in), and prefixes (uuid startsWith). Use `filter` only on channel_patterns.

  5. UTC timestamps. fromDate and toDate are YYYY-MM-DD in UTC. Always frame the response
     with the date range and timezone so the user has unambiguous context.

  6. Top-N counts CANNOT be summed across periods. If the user asks for "top channels this
     week" and you query with period=daily, return one ranking per day, not a weekly sum.

  7. Default to period=daily for most queries. It supports the widest set of metrics and
     gives a clean trend view. Use hourly only when intra-day granularity is needed or for
     duration metrics.

  8. Account must be on Insights Premium. Free plan has no API access. Pro existing
     customers may need to upgrade from Standard to Premium. If a 403 comes back, surface
     this as the likely cause.

  9. The tool does not write or store anything. Insights is strictly read-only.

Prompts

Interactive templates invoked by user choice

NameDescription
hipaa-chat-shortExample of how to prompt PubNub MCP to create a HIPAA compliant chat application - short version
hipaa-chat-longExample of how to prompt PubNub MCP to create a HIPAA compliant chat application - long version
react-app-shortExample of how to scaffold a React application with PubNub Pub/Sub and Presence - short version
react-app-longExample of how to scaffold a React application with PubNub Pub/Sub and Presence - long version
gamelobby-shortExample of how to build a multiplayer game lobby with chat and presence - short version
gamelobby-longExample of how to build a multiplayer game lobby with chat and presence - long version
oem-client-managementExample of how to create apps and configure keysets for OEM clients
multi-tenant-onboarding-shortExample of how to implement automated tenant onboarding for multi-tenant applications - short version
multi-tenant-onboarding-longExample of how to implement automated tenant onboarding for multi-tenant applications - long version
illuminate-spam-detectionGuided setup of a complete Illuminate spam detection pipeline (message flooding and cross-posting)
illuminate-reward-engagementGuided setup of an Illuminate engagement reward pipeline for live events and gaming
illuminate-use-caseGuided setup of a new Illuminate analytics and automation use case
illuminate-test-verifyStep-by-step test and verification workflow for an existing Illuminate configuration
insights-snapshotQuick high-level analytics snapshot for a date range — unique channels, unique users, message volume, and top channels
insights-channel-analysisDeep dive into top channels by category, channel patterns, and channel engagement
insights-user-growthNew vs recurring users, daily/weekly/monthly trends, and geographic distribution
insights-engagement-deep-diveAverage user duration, duration buckets, and device-type breakdown of publishes, subscribers, and unique users

Resources

Contextual data attached and managed by the client

NameDescription
asyncio_access-manager_docsPubNub sdk documentation for access-manager in asyncio
asyncio_channel-groups_docsPubNub sdk documentation for channel-groups in asyncio
asyncio_configuration_docsPubNub sdk documentation for configuration in asyncio
asyncio_files_docsPubNub sdk documentation for files in asyncio
asyncio_message-actions_docsPubNub sdk documentation for message-actions in asyncio
asyncio_misc_docsPubNub sdk documentation for misc in asyncio
asyncio_mobile-push_docsPubNub sdk documentation for mobile-push in asyncio
asyncio_presence_docsPubNub sdk documentation for presence in asyncio
asyncio_publish_docsPubNub sdk documentation for publish in asyncio
asyncio_storage-and-playback_docsPubNub sdk documentation for storage-and-playback in asyncio
asyncio_subscribe_docsPubNub sdk documentation for subscribe in asyncio
c-core_access-manager_docsPubNub sdk documentation for access-manager in c-core
c-core_channel-groups_docsPubNub sdk documentation for channel-groups in c-core
c-core_configuration_docsPubNub sdk documentation for configuration in c-core
c-core_encryption_docsPubNub sdk documentation for encryption in c-core
c-core_misc_docsPubNub sdk documentation for misc in c-core
c-core_presence_docsPubNub sdk documentation for presence in c-core
c-core_publish_docsPubNub sdk documentation for publish in c-core
c-core_storage-and-playback_docsPubNub sdk documentation for storage-and-playback in c-core
c-core_subscribe_docsPubNub sdk documentation for subscribe in c-core
c-sharp_access-manager_docsPubNub sdk documentation for access-manager in c-sharp
c-sharp_appcontext-channel_docsPubNub sdk documentation for appcontext-channel in c-sharp
c-sharp_appcontext-members_docsPubNub sdk documentation for appcontext-members in c-sharp
c-sharp_appcontext-memberships_docsPubNub sdk documentation for appcontext-memberships in c-sharp
c-sharp_appcontext-user_docsPubNub sdk documentation for appcontext-user in c-sharp
c-sharp_channel-groups_docsPubNub sdk documentation for channel-groups in c-sharp
c-sharp_configuration_docsPubNub sdk documentation for configuration in c-sharp
c-sharp_encryption_docsPubNub sdk documentation for encryption in c-sharp
c-sharp_files_docsPubNub sdk documentation for files in c-sharp
c-sharp_message-actions_docsPubNub sdk documentation for message-actions in c-sharp
c-sharp_misc_docsPubNub sdk documentation for misc in c-sharp
c-sharp_mobile-push_docsPubNub sdk documentation for mobile-push in c-sharp
c-sharp_presence_docsPubNub sdk documentation for presence in c-sharp
c-sharp_publish_docsPubNub sdk documentation for publish in c-sharp
c-sharp_storage-and-playback_docsPubNub sdk documentation for storage-and-playback in c-sharp
c-sharp_subscribe_docsPubNub sdk documentation for subscribe in c-sharp
dart_access-manager_docsPubNub sdk documentation for access-manager in dart
dart_appcontext-channel_docsPubNub sdk documentation for appcontext-channel in dart
dart_appcontext-members_docsPubNub sdk documentation for appcontext-members in dart
dart_appcontext-memberships_docsPubNub sdk documentation for appcontext-memberships in dart
dart_appcontext-user_docsPubNub sdk documentation for appcontext-user in dart
dart_channel-groups_docsPubNub sdk documentation for channel-groups in dart
dart_configuration_docsPubNub sdk documentation for configuration in dart
dart_encryption_docsPubNub sdk documentation for encryption in dart
dart_files_docsPubNub sdk documentation for files in dart
dart_message-actions_docsPubNub sdk documentation for message-actions in dart
dart_misc_docsPubNub sdk documentation for misc in dart
dart_mobile-push_docsPubNub sdk documentation for mobile-push in dart
dart_presence_docsPubNub sdk documentation for presence in dart
dart_publish_docsPubNub sdk documentation for publish in dart
dart_storage-and-playback_docsPubNub sdk documentation for storage-and-playback in dart
dart_subscribe_docsPubNub sdk documentation for subscribe in dart
freertos_channel-groups_docsPubNub sdk documentation for channel-groups in freertos
freertos_configuration_docsPubNub sdk documentation for configuration in freertos
freertos_misc_docsPubNub sdk documentation for misc in freertos
freertos_presence_docsPubNub sdk documentation for presence in freertos
freertos_publish_docsPubNub sdk documentation for publish in freertos
freertos_storage-and-playback_docsPubNub sdk documentation for storage-and-playback in freertos
freertos_subscribe_docsPubNub sdk documentation for subscribe in freertos
go_access-manager_docsPubNub sdk documentation for access-manager in go
go_appcontext-channel_docsPubNub sdk documentation for appcontext-channel in go
go_appcontext-members_docsPubNub sdk documentation for appcontext-members in go
go_appcontext-memberships_docsPubNub sdk documentation for appcontext-memberships in go
go_appcontext-user_docsPubNub sdk documentation for appcontext-user in go
go_channel-groups_docsPubNub sdk documentation for channel-groups in go
go_configuration_docsPubNub sdk documentation for configuration in go
go_encryption_docsPubNub sdk documentation for encryption in go
go_files_docsPubNub sdk documentation for files in go
go_message-actions_docsPubNub sdk documentation for message-actions in go
go_misc_docsPubNub sdk documentation for misc in go
go_mobile-push_docsPubNub sdk documentation for mobile-push in go
go_presence_docsPubNub sdk documentation for presence in go
go_publish_docsPubNub sdk documentation for publish in go
go_storage-and-playback_docsPubNub sdk documentation for storage-and-playback in go
go_subscribe_docsPubNub sdk documentation for subscribe in go
java_access-manager_docsPubNub sdk documentation for access-manager in java
java_appcontext-channel_docsPubNub sdk documentation for appcontext-channel in java
java_appcontext-members_docsPubNub sdk documentation for appcontext-members in java
java_appcontext-memberships_docsPubNub sdk documentation for appcontext-memberships in java
java_appcontext-user_docsPubNub sdk documentation for appcontext-user in java
java_channel-groups_docsPubNub sdk documentation for channel-groups in java
java_configuration_docsPubNub sdk documentation for configuration in java
java_encryption_docsPubNub sdk documentation for encryption in java
java_files_docsPubNub sdk documentation for files in java
java_message-actions_docsPubNub sdk documentation for message-actions in java
java_misc_docsPubNub sdk documentation for misc in java
java_mobile-push_docsPubNub sdk documentation for mobile-push in java
java_presence_docsPubNub sdk documentation for presence in java
java_publish_docsPubNub sdk documentation for publish in java
java_storage-and-playback_docsPubNub sdk documentation for storage-and-playback in java
java_subscribe_docsPubNub sdk documentation for subscribe in java
javascript_access-manager_docsPubNub sdk documentation for access-manager in javascript
javascript_appcontext-channel_docsPubNub sdk documentation for appcontext-channel in javascript
javascript_appcontext-members_docsPubNub sdk documentation for appcontext-members in javascript
javascript_appcontext-memberships_docsPubNub sdk documentation for appcontext-memberships in javascript
javascript_appcontext-user_docsPubNub sdk documentation for appcontext-user in javascript
javascript_channel-groups_docsPubNub sdk documentation for channel-groups in javascript
javascript_configuration_docsPubNub sdk documentation for configuration in javascript
javascript_encryption_docsPubNub sdk documentation for encryption in javascript
javascript_files_docsPubNub sdk documentation for files in javascript

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pubnub/pubnub-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server