
PubNub MCP Server
A CLI-based Model Context Protocol server that exposes PubNub SDK documentation and Functions resources to LLM-powered tools like Cursor IDE, enabling users to fetch documentation and interact with PubNub channels via natural language prompts.
Tools
pubnub_docs
fetch_pubnub_sdk_docs
publish_pubnub_message
fetch_pubnub_docs
fetch_pubnub_messages
fetch_pubnub_presence
README
PubNub Model Context Protocol (MCP) Server for Cursor IDE
This repository provides a CLI-based Model Context Protocol (MCP) server that exposes PubNub SDK documentation and PubNub Functions resources to LLM-powered tools. By adding this server to Cursor IDE, you can:
- Fetch formatted PubNub JavaScript, Python, and Java SDK documentation.
- Access PubNub Functions documentation from a static Markdown file.
Example Prompts
- "Publish a message to the
my_channel
channel with the messageHello, PubNub!
." - "Show me the PubNub JavaScript SDK documentation for
subscribe()
." - "List all available PubNub Functions."
- "Fetch the Python SDK docs for the
publish()
method." - "Fetch the message history for the
test
channel." - "Retrieve presence information (occupancy and UUIDs) for the
test
channel and thedefault
channel group."
This requires Node.js (>= 18) and npm (https://nodejs.org/).
npx
will automatically fetch and run the latest MCP server.
Prerequisites
- Node.js (>= 18) and npm
- Cursor IDE with MCP support
- (Optional) PubNub account and API keys for live examples
Installation
The preferred way to run the PubNub MCP server locally or add it to Cursor IDE via npx:
npx -y @pubnub/mcp
Configuration
Cursor must be in AGENT MODE to use MCP servers.
Cursor IDE discovers MCP servers via a JSON config file. Configure the PubNub MCP server globally or per project.
Global Configuration
Edit or create ~/.cursor/mcp.json
:
{
"mcpServers": {
"pubnub": {
"command": "npx",
"args": ["-y", "@pubnub/mcp"],
"env": {
"PUBNUB_SUBSCRIBE_KEY": "YOUR_SUBSCRIBE_KEY",
"PUBNUB_PUBLISH_KEY": "YOUR_PUBLISH_KEY"
}
}
}
}
Project Configuration
In your project directory, create .cursor/mcp.json
:
{
"mcpServers": {
"pubnub": {
"command": "npx",
"args": ["-y", "@pubnub/mcp"],
"env": {
"PUBNUB_SUBSCRIBE_KEY": "YOUR_SUBSCRIBE_KEY",
"PUBNUB_PUBLISH_KEY": "YOUR_PUBLISH_KEY"
}
}
}
}
command
specifies the executable to launch the MCP server.args
specifies the arguments to pass to the command.env
sets environment variables for the server process.
Using in Cursor IDE
- Restart Cursor IDE or open a new session.
- Open the MCP settings pane and verify the pubnub server is listed under Available Tools & Resources.
- In chat, invoke available resources:
pubnub://docs/javascript
— Fetch PubNub JavaScript SDK documentationpubnub://docs/python
— Fetch PubNub Python SDK documentationpubnub://docs/java
— Fetch PubNub Java SDK documentationpubnub://functions
— List PubNub Functions (static content fromresources/pubnub_functions.md
)
- Approve resource execution when prompted, or enable auto-run in settings for trusted resources.
Claude Code
## Install the MCP server if you have node >= 18
claude mcp add pubnub -e PUBNUB_PUBLISH_KEY=your_publish_key -e PUBNUB_SUBSCRIBE_KEY=your_subscribe_key -- npx -y @pubnub/mcp
## Install the MCP server if you have node < 18 and need to point to the full path of node
claude mcp add pubnub -e PUBNUB_PUBLISH_KEY=your_publish_key -e PUBNUB_SUBSCRIBE_KEY=your_subscribe_key -- /Users/stephen/.nvm/versions/node/v22.14.0/bin/node /Users/stephen/Projects/mcp-pubnub/index.js
And the output will be:
Added stdio MCP server pubnub with command: npx -y @pubnub/mcp to local config
Example prompt
claude "publish a message 'hi' to the 'my_channel' pubnub channel."
claude "publish a message 'hi' to the 'my_channel' pubnub channel."
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview! │
│ │
│ /help for help, /status for your current setup │
│ │
│ cwd: /Users/stephen/Projects/mcp-pubnub │
╰───────────────────────────────────────────────────╯
※ Tip: Press Option+Enter to send a multi-line message
> publish a message 'hi' to the 'my_channel' pubnub channel.
⏺ I'll publish a message to the PubNub channel for you.
⏺ pubnub:publish_pubnub_message (MCP)(channel: "my_channel", message: "hi")…
⎿ Message published successfully. Timetoken: 17467422499409217
⏺ Message published successfully to "my_channel".
Remove the MCP server with:
claude mcp remove pubnub
Using Claude Desktop
- In the Tools section, add a new tool named pubnub.
- Set the Command to
npx
and Arguments to["-y", "@pubnub/mcp"]
. - Add environment variables for your PubNub keys:
PUBNUB_SUBSCRIBE_KEY
PUBNUB_PUBLISH_KEY
- Save the configuration.
Claude Desktop may use an old verson of node. You may need to set the command to the full path of your node installation.
git clone https://github.com/stephenlb/pubnub-mcp-server.git
MCP server is located in the index.js
file.:
{
"mcpServers": {
"pubnub": {
"command": "/Users/stephen/.nvm/versions/node/v22.14.0/bin/node",
"args": ["/Users/stephen/Projects/mcp-pubnub/index.js"],
"env": {
"PUBNUB_SUBSCRIBE_KEY": "demo",
"PUBNUB_PUBLISH_KEY": "demo"
}
}
}
}
License
This project is licensed under the MIT License. See the LICENSE file for details.
Troubleshooting
- Must be in agents mode to use MCP servers.
- Verify Node.js and npm installation.
- Ensure
server.js
has execute permission. - Check that the
command
,args
, andenv
settings are correct. - Review Cursor IDE logs for MCP startup errors.
Direct JSON-RPC Command-Line Usage
You can invoke the MCP server directly over STDIN/STDOUT using JSON-RPC v2.0. Ensure your PubNub keys are set in the environment, for example:
PUBNUB_SUBSCRIBE_KEY=YOUR_SUBSCRIBE_KEY \
PUBNUB_PUBLISH_KEY=YOUR_PUBLISH_KEY \
node index.js
Once the server is running (or using a one-off invocation), send requests by piping JSON into node index.js
. Examples:
# 1) List available tools
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' \
| node index.js
# 2) Fetch PubNub JavaScript SDK documentation
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":
{"name":"fetch_pubnub_sdk_docs","arguments":{"language":"javascript"}}}' \
| node index.js
# 3) Load PubNub Functions docs (static Markdown)
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":
{"name":"pubnub_functions_docs","arguments":{}}}' \
| node index.js
# 4) Publish a message to a channel
echo '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":
{"name":"publish_pubnub_message","arguments":
{"channel":"my_channel","message":"Hello, PubNub!"}}}' \
| node index.js
# 5) Read a static resource
echo '{"jsonrpc":"2.0","id":5,"method":"resources/read","params":
{"uri":"thank_you_pubnub://thank_you"}}' \
| node index.js
Quick JSON-RPC Examples
Below are simplified JSON-RPC v2.0 command-line examples using STDIN/STDOUT to fetch PubNub SDK documentation and publish messages.
1) Fetch PubNub JavaScript SDK documentation
PUBNUB_SUBSCRIBE_KEY=YOUR_SUBSCRIBE_KEY \
PUBNUB_PUBLISH_KEY=YOUR_PUBLISH_KEY \
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"fetch_pubnub_sdk_docs","arguments":{"language":"javascript"}}}' \
| node index.js
2) Publish a message to a PubNub channel
PUBNUB_SUBSCRIBE_KEY=YOUR_SUBSCRIBE_KEY \
PUBNUB_PUBLISH_KEY=YOUR_PUBLISH_KEY \
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"publish_pubnub_message","arguments":{"channel":"my_channel","message":"Hello, PubNub MCP JSON-RPC!"}}}' \
| node index.js
License
MIT
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。