Available MCP tools
The PubNub Model Context Protocol (MCP) server exposes 17 tools in six categories, plus two read-only documentation resources and a set of prompt templates. The hosted and the locally installed server expose the same tools. This page lists what each tool does, what access it needs, and the limits the AI tool works within. Your AI tool reads each tool's parameters from the server when it connects, so this page doesn't repeat them.
For what the server is, see MCP server. To connect a client, see Set up the MCP server.
| Category | Tools |
|---|---|
| Documentation access | get_sdk_documentation, get_chat_sdk_documentation, how_to, write_pubnub_app, get_sdk_migration_guide, get_general_migration_guide |
| App and keyset management | manage_apps, manage_keysets, get_usage_metrics |
| Real-time communication | send_pubnub_message, subscribe_and_receive_pubnub_messages, get_pubnub_messages, get_pubnub_presence, manage_app_context |
| Illuminate | manage_illuminate |
| Insights | insights |
| Functions | manage_functions |
Access requirements
Tools that manage your account, which are the app and keyset, Illuminate, Insights, and Functions tools, call the Admin API. On the hosted server they use the permissions of the user who signed in. On the locally installed server they use the Service Integration API key in PUBNUB_API_KEY, so they fail if the key is missing or lacks the permission the tool needs.
Documentation tools need no credentials. Real-time tools take a publish and subscribe key pair on every call, which the AI tool can look up with manage_keysets.
Documentation access
The PubNub MCP documentation tools retrieve current SDK documentation, guides, and migration guides. They're read-only and need no PubNub keys.
| Tool | What it does | Example prompt |
|---|---|---|
get_sdk_documentation | Retrieves SDK documentation for one language and feature, such as publish, presence, or App Context. Not every feature exists for every language. | Get the JS SDK docs for publish and subscribe. |
get_chat_sdk_documentation | Retrieves Chat SDK documentation for JavaScript, Kotlin, Swift, Unity, or Unreal. | Get the Swift Chat SDK docs for sending and receiving messages. |
how_to | Retrieves a conceptual guide for a feature or use case, such as game development in Unity or Unreal, push notifications, or moderation. | Show me how to add real-time chat to my Unity game. |
write_pubnub_app | Retrieves PubNub application best practices: architecture, Access Manager, channel and data modeling, reconnection, idempotency, ordering, and cost optimization. | What are the best practices for building PubNub applications? |
get_sdk_migration_guide | Retrieves the migration guide for a major version upgrade of one SDK. | How do I migrate my JavaScript PubNub SDK to v8? |
get_general_migration_guide | Retrieves a platform-wide migration guide, such as the move to 256-bit encryption or Access Manager v3. | How do I migrate to 256-bit encryption? |
App and keyset management
The PubNub MCP app and keyset tools manage apps and keysets and read usage. They call the Admin API. See Access requirements.
| Tool | What it does | Limits and behavior | Example prompt |
|---|---|---|---|
manage_apps | Lists, creates, and renames apps. | Create a new PubNub app called MyRealtimeApp. | |
manage_keysets | Gets, lists, creates, and updates keysets and their Message Persistence, App Context, File Sharing, and Presence configuration. | A keyset created without a configuration gets all four features enabled. This default differs from a keyset created in the Admin Portal. The App Context and File Sharing regions can't change after creation. | Create a production keyset with Message Persistence, Presence, and App Context in US East. |
get_usage_metrics | Returns usage metrics, such as transactions, publishes, and monthly active users, for an account, app, or keyset over a date range. | Show me the MAU metrics for app 12345 for the last month. |
Real-time communication
The PubNub MCP real-time tools publish, subscribe, read history, and query Presence and App Context data on a keyset. Each call takes the keyset's publish and subscribe key.
| Tool | What it does | Limits and behavior | Example prompt |
|---|---|---|---|
send_pubnub_message | Publishes a message or a signal to a channel and returns the publish timetoken. | Signal payloads are limited to 64 bytes. A signal isn't stored in message history. | Send "Hello, World!" to the chat-room channel. |
subscribe_and_receive_pubnub_messages | Subscribes to a channel and waits for one or more messages. | One call waits at most 30 seconds. Call the tool again for a longer window. | Subscribe to the notifications channel and wait for 3 messages. |
get_pubnub_messages | Retrieves stored messages from one or more channels, optionally between two timetokens. | Needs Message Persistence enabled on the keyset. | Get the last 50 messages from the chat-room channel. |
get_pubnub_presence | Returns channel occupancy, or the channels a user is subscribed to. | How many users are in the lobby channel? | |
manage_app_context | Gets, sets, and removes App Context users, channels, and memberships. | Needs App Context enabled on the keyset. | Add user-123 to the general-chat channel. |
Illuminate
manage_illuminate creates and runs Illuminate Business Objects, metrics, queries, Decisions, and Dashboards. It calls the Admin API. See Access requirements.
Beyond create, read, update, and delete, the tool can:
- Activate and deactivate Business Objects and Decisions.
- Run a query without saving it.
- Check whether a Decision fired.
- Inspect the data behind a Business Object.
- Publish generated test data, such as chat flooding or cross-posting scenarios, to prove a Decision works.
Illuminate ingests test data after a 20 to 30 second delay. On a keyset with Access Manager enabled, publishing test data needs the keyset's secret key, or the call returns a 403.
Example prompt: Set up Illuminate spam detection for my chat app. For a guided walkthrough, use the illuminate-use-case prompt template.
Insights
insights runs read-only PubNub Insights queries for an account, app, or keyset. It covers unique users and channels, message volume, top 20 or top 1000 channels and users, user duration, and breakdowns by country and device type. Results come hourly, daily, weekly, or monthly, though not every metric supports every period.
The account must be on Insights Premium. The Free plan has no Insights API access. On the local server, the Service Integration behind PUBNUB_API_KEY also needs the Insights Read permission. A 403 response means one of these is missing.
Example prompt: What are my top 20 channels by message volume today?
Functions
manage_functions manages Functions packages, revisions, deployments, the key-value (KV) store, secrets, scheduled events, and Integrations Catalog blueprints. It calls the Admin API. See Access requirements.
On the local server, the Service Integration key needs the scope that matches the resource:
functions.package:read|writeon the account, for packages, revisions, and the catalog.functions.package-deployment:read|writeon the keyset, for deployments and scheduled events.keyset:read|writeon the keyset, for the KV store and secrets.
The tool asks for confirmation before any delete. A deployment must be stopped before its package can be deleted. Secret values are never returned. A running Function's console output is published to the output-rev-{functionRevisionId}-key-{keysetId} channel, so the AI tool can read logs in real time with subscribe_and_receive_pubnub_messages.
Example prompt: Deploy my package revision to my keyset and start it.
Resources
MCP resources give the AI tool read-only access to PubNub documentation by URI, separately from the tools.
| Resource | URI format | Coverage |
|---|---|---|
pubnub_sdk_docs | pubnub-docs://sdk/{language}/{feature} | Core SDK documentation. Covers fewer languages than PubNub's full SDK lineup. |
pubnub_chat_sdk_docs | pubnub-docs://chat-sdk/{language}/{feature} | Chat SDK documentation for JavaScript, Kotlin, Swift, Unity, and Unreal. |
Prompt templates
The PubNub MCP server also ships prompt templates for common builds, such as HIPAA-compliant chat, React scaffolding, multiplayer game lobbies, OEM multi-tenant onboarding, and guided Illuminate and Functions setup. For the full list, see Prompt templates.
Related tasks
- Set up the MCP server. Connect a client to the hosted or local server.
- Prompt templates. Ready-made prompts that call these tools for common use cases.
- MCP server. How the server authenticates and how the hosted and local servers differ.