AI development
PubNub provides three independent resources for AI coding assistants and agents: Markdown versions of the docs, the PubNub Model Context Protocol (MCP) server, and prompt templates. An assistant can use any of them on its own or combine them. Only the MCP server connects to your PubNub account.
| Resource | What it gives the assistant | Needs your PubNub account |
|---|---|---|
| Docs in Markdown | Current PubNub documentation without HTML scraping | No |
| MCP server | Tools that act on your apps, keysets, and real-time data | Yes |
| Prompt templates | Ready-made starting prompts for common build tasks | No |
Docs in Markdown and llms.txt
Every page under /docs/ on the PubNub documentation site is also served as Markdown at the same URL with .md appended. For example, https://www.pubnub.com/docs/pub-sub/overview is also available at https://www.pubnub.com/docs/pub-sub/overview.md. The Markdown version keeps the page content and drops navigation, styling, and interactive components, so it costs an agent fewer tokens than the HTML page. Each HTML page also returns a Link: rel="alternate"; type="text/markdown" response header that points to its Markdown version.
PubNub follows the llms.txt convention for pointing a large language model (LLM) at that content:
- pubnub.com/llms.txt is the curated entry point to PubNub products and documentation.
- pubnub.com/llms-full.txt is its expanded companion. It contains the complete index of documentation pages, with a Markdown link to each one.
Every generated Markdown page starts with a short note that points the agent to llms-full.txt, so it can look up a path rather than guess a URL from a naming pattern or from an older fetch. Every HTML page carries a note for agents with the URL of that page's Markdown version and the documentation index. A .md URL that matches no page returns a 404 response in Markdown. That response points back at the same index, so an agent that guessed wrong can recover and continue its task.
None of this needs setup. It applies to every docs page.
MCP server
The PubNub MCP server turns PubNub account operations into tools an AI assistant can call. Once it's connected, a plain-language request can:
- Create and configure apps and keysets.
- Retrieve current SDK documentation, Chat SDK documentation, and migration guides.
- Read usage metrics and Insights analytics.
- Publish and subscribe, read message history, and query Presence and App Context data.
- Manage Functions and Illuminate resources.
PubNub runs a hosted server at https://mcp.pubnub.com that you sign in to with OAuth. The same server is also available as an npm package you run locally with a PubNub API key.
- Set up the MCP server. Connect Claude Code, Cursor, VS Code, or another MCP client.
- Available MCP tools. What each tool does and what access it requires.
- Manage MCP connections. Revoke hosted connections or turn them off for an organization.
How the resources fit together
Your AI coding assistant reads the docs through llms.txt and per-page Markdown and starts tasks from prompt templates. Neither of these touches your PubNub account. When the assistant calls MCP server tools, the server acts on your PubNub account, such as its apps, keysets, and real-time APIs. It authenticates with OAuth for the hosted server or with an API key for the local server.
Prompt templates and the MCP server do different jobs. A prompt template starts a task, such as building a live auction app. The MCP server then creates the keyset and publishes test messages that show the code working against your account. Prompt templates work with or without the MCP server.
Next steps
- Set up the MCP server. Connect an AI assistant to your PubNub account.
- Prompt templates. Start a build task from a ready-made prompt.
- Quickstart. Build your first PubNub application by hand, so you know what the AI assistant does for you.