PubNub MCP Server

by stephenlb

Integrations

  • Provides formatted SDK documentation for PubNub's JavaScript SDK, allowing developers to access reference materials for methods like subscribe() and publish() from within Cursor IDE.

  • Supports PubNub functionality through Node.js, allowing users to publish messages to channels, subscribe to channels, fetch message history, and retrieve presence information.

  • Offers access to PubNub's Python SDK documentation, enabling users to fetch docs for methods like publish() directly through Cursor IDE.

커서 IDE용 PubNub 모델 컨텍스트 프로토콜(MCP) 서버

이 저장소는 PubNub SDK 설명서와 PubNub Functions 리소스를 LLM 기반 도구에 노출하는 CLI 기반 모델 컨텍스트 프로토콜(MCP) 서버를 제공합니다. 이 서버를 Cursor IDE에 추가하면 다음과 같은 작업을 수행할 수 있습니다.

  • 포맷된 PubNub JavaScript, Python, Java SDK 문서를 가져옵니다.
  • 정적 Markdown 파일에서 PubNub Functions 문서에 액세스합니다.

예시 프롬프트

  • " Hello, PubNub! 라는 메시지와 함께 my_channel 채널에 메시지를 게시하세요."
  • " subscribe() 에 대한 PubNub JavaScript SDK 설명서를 보여주세요."
  • "사용 가능한 PubNub 함수를 모두 나열하세요."
  • " publish() 메서드에 대한 Python SDK 문서를 가져옵니다."
  • " test 채널의 메시지 기록을 가져옵니다."
  • test 채널과 default 채널 그룹에 대한 상태 정보(점유 및 UUID)를 검색합니다.

이 작업에는 Node.js(>= 18)와 npm( https://nodejs.org/ )이 필요합니다. npx 자동으로 최신 MCP 서버를 가져와서 실행합니다.

필수 조건

  • Node.js(>= 18) 및 npm
  • MCP를 지원하는 커서 IDE
  • (선택 사항) 라이브 예제를 위한 PubNub 계정 및 API 키

설치

PubNub MCP 서버를 로컬에서 실행하거나 npx를 통해 Cursor IDE에 추가하는 가장 좋은 방법은 다음과 같습니다.

지엑스피1

구성

MCP 서버를 사용하려면 커서가 에이전트 모드에 있어야 합니다.

커서 IDE는 JSON 구성 파일을 통해 MCP 서버를 검색합니다. PubNub MCP 서버를 전역 또는 프로젝트별로 구성하세요.

글로벌 구성

~/.cursor/mcp.json 편집하거나 생성합니다.

{ "mcpServers": { "pubnub": { "command": "npx", "args": ["-y", "@pubnub/mcp"], "env": { "PUBNUB_SUBSCRIBE_KEY": "YOUR_SUBSCRIBE_KEY", "PUBNUB_PUBLISH_KEY": "YOUR_PUBLISH_KEY" } } } }

프로젝트 구성

프로젝트 디렉토리에 .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 MCP 서버를 시작하기 위한 실행 파일을 지정합니다.
  • args 명령에 전달할 인수를 지정합니다.
  • env 서버 프로세스에 대한 환경 변수를 설정합니다.

커서 IDE에서 사용

  1. 커서 IDE를 다시 시작하거나 새로운 세션을 엽니다.
  2. MCP 설정 창을 열고 pubnub 서버가 사용 가능한 도구 및 리소스 에 나열되어 있는지 확인하세요.
  3. 채팅에서 사용 가능한 리소스를 호출합니다.
    • pubnub://docs/javascript — PubNub JavaScript SDK 설명서 가져오기
    • pubnub://docs/python — PubNub Python SDK 문서 가져오기
    • pubnub://docs/java — PubNub Java SDK 문서 가져오기
    • pubnub://functions — PubNub 함수 목록( resources/pubnub_functions.md 의 정적 콘텐츠)
  4. 메시지가 표시되면 리소스 실행을 승인하거나 신뢰할 수 있는 리소스에 대한 설정에서 자동 실행을 활성화합니다.

클로드 코드

## 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

출력은 다음과 같습니다.

Added stdio MCP server pubnub with command: npx -y @pubnub/mcp to local config

예시 프롬프트

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".

다음을 사용하여 MCP 서버를 제거합니다.

claude mcp remove pubnub

Claude Desktop 사용

  1. 도구 섹션에서 pubnub 이라는 이름의 새 도구를 추가합니다.
  2. 명령을 npx 로 설정하고 인수를 ["-y", "@pubnub/mcp"] 로 설정합니다.
  3. PubNub 키에 대한 환경 변수를 추가합니다.
    • PUBNUB_SUBSCRIBE_KEY
    • PUBNUB_PUBLISH_KEY
  4. 구성을 저장합니다.

Claude Desktop에서 이전 버전의 노드를 사용할 수 있습니다. 노드 설치 경로의 전체 경로를 명령어에 지정해야 할 수도 있습니다.

git clone https://github.com/stephenlb/pubnub-mcp-server.git

MCP 서버는 index.js 파일에 있습니다.

{ "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" } } } }

특허

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 라이선스 파일을 참조하세요.

문제 해결

  • MCP 서버를 사용하려면 에이전트 모드에 있어야 합니다.
  • Node.js와 npm 설치를 확인하세요.
  • server.js 에 실행 권한이 있는지 확인하세요.
  • command , args , env 설정이 올바른지 확인하세요.
  • MCP 시작 오류를 확인하려면 Cursor IDE 로그를 검토하세요.

직접 JSON-RPC 명령줄 사용

JSON-RPC v2.0을 사용하여 STDIN/STDOUT을 통해 MCP 서버를 직접 호출할 수 있습니다. PubNub 키가 환경에 설정되어 있는지 확인하세요. 예:

PUBNUB_SUBSCRIBE_KEY=YOUR_SUBSCRIBE_KEY \ PUBNUB_PUBLISH_KEY=YOUR_PUBLISH_KEY \ node index.js

서버가 실행 중이거나 일회성 호출을 사용하는 경우 JSON을 node index.js 로 파이프하여 요청을 보냅니다. 예:

# 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

빠른 JSON-RPC 예제

아래는 STDIN/STDOUT을 사용하여 PubNub SDK 문서를 가져오고 메시지를 게시하는 간소화된 JSON-RPC v2.0 명령줄 예제입니다.

1) PubNub JavaScript SDK 문서 가져오기

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) PubNub 채널에 메시지 게시

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

특허

MIT

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

PubNub SDK 설명서와 기능 리소스를 Cursor IDE와 같은 LLM 기반 도구에 노출하는 CLI 기반 모델 컨텍스트 프로토콜 서버로, 사용자가 자연어 프롬프트를 통해 설명서를 가져오고 PubNub 채널과 상호 작용할 수 있도록 합니다.

  1. 예시 프롬프트
    1. 필수 조건
      1. 설치
        1. 구성
          1. 글로벌 구성
          2. 프로젝트 구성
        2. 커서 IDE에서 사용
          1. 클로드 코드
            1. 예시 프롬프트
          2. Claude Desktop 사용
            1. 특허
              1. 문제 해결
                1. 직접 JSON-RPC 명령줄 사용
                  1. 빠른 JSON-RPC 예제
                    1. 1) PubNub JavaScript SDK 문서 가져오기
                    2. 2) PubNub 채널에 메시지 게시
                  2. 특허

                    Related MCP Servers

                    • -
                      security
                      F
                      license
                      -
                      quality
                      A simple Model Context Protocol server that enables searching and retrieving relevant documentation snippets from Langchain, Llama Index, and OpenAI official documentation.
                      Last updated -
                      Python
                      • Apple
                      • Linux
                    • -
                      security
                      F
                      license
                      -
                      quality
                      A customized MCP server that enables integration between LLM applications and documentation sources, providing AI-assisted access to LangGraph and Model Context Protocol documentation.
                      Last updated -
                      Python
                      • Linux
                      • Apple
                    • A
                      security
                      A
                      license
                      A
                      quality
                      A Model Context Protocol server that loads multiple OpenAPI specifications and exposes them to LLM-powered IDE integrations, enabling AI to understand and work with your APIs directly in development tools like Cursor.
                      Last updated -
                      7
                      292
                      7
                      TypeScript
                      MIT License

                    View all related MCP servers

                    ID: u5x3u3txbh