Pulsar MCP Server
Enables interaction with Apache Pulsar clusters through MCP-compatible clients, supporting publish, consume, topic management, and connector operations.
README
Pulsar MCP Server
A Model Context Protocol (MCP) server for Apache Pulsar that provides tools to interact with Pulsar clusters through MCP-compatible clients.
Features
- Publish Messages: Send messages to Pulsar topics with optional properties
- Consume Messages: Receive messages from topics with configurable subscription settings
- Topic Management: Create, delete, and list topics
- Topic Statistics: Get detailed statistics and metadata about topics
- Connector Management: List, get status, and configuration of Pulsar IO connectors
- Flexible Configuration: Environment-based configuration with sensible defaults
Installation
From Source
- Clone the repository:
git clone <repository-url>
cd pulsar-mcp-server
- Install dependencies:
pip install -r requirements.txt
- Install the package in development mode:
pip install -e .
Using pip (when published)
pip install pulsar-mcp-server
Usage
Command Line
After installation, you can run the server using:
pulsar-mcp-server
The server will start and listen for MCP requests via stdio.
Programmatic Usage
from pulsar_mcp_server import main
# Run the server
main()
Cursor MCP Server Usage
In your ~/.cursor/mcp.json file, add the following:
"pulsar": {
"command": "pulsar-mcp-server",
"env": {
"PULSAR_SERVICE_URL": "pulsar://localhost:6650",
"PULSAR_WEB_SERVICE_URL": "http://localhost:8080"
}
}
Configuration
The server can be configured using environment variables or a .env file:
# Pulsar connection settings
PULSAR_SERVICE_URL=pulsar://localhost:6650
PULSAR_WEB_SERVICE_URL=http://localhost:8080
# Topic and subscription settings
TOPIC_NAME=my-topic
SUBSCRIPTION_NAME=pulsar-mcp-subscription
SUBSCRIPTION_TYPE=Shared
IS_TOPIC_READ_FROM_BEGINNING=false
# Authentication (optional)
PULSAR_TOKEN=your-jwt-token
PULSAR_TLS_TRUST_CERTS_FILE_PATH=/path/to/certs
PULSAR_TLS_ALLOW_INSECURE_CONNECTION=false
Available Tools
pulsar_publish
Publish a message to a Pulsar topic.
Parameters:
topic(string, required): The Pulsar topic to publish tomessage(string, required): The message content to publishproperties(object, optional): Message properties as key-value pairs
pulsar_consume
Consume messages from a Pulsar topic.
Parameters:
topic(string, required): The Pulsar topic to consume fromsubscription_name(string, required): The subscription namemax_messages(integer, optional): Maximum number of messages to consume (default: 10)
pulsar_create_topic
Create a new Pulsar topic.
Parameters:
topic(string, required): Name of the topic to createpartitions(integer, optional): Number of partitions (default: 1)
pulsar_delete_topic
Delete an existing Pulsar topic.
Parameters:
topic(string, required): Name of the topic to delete
pulsar_list_topics
List all topics in the Pulsar cluster.
Parameters: None
pulsar_topic_stats
Get statistics and metadata about a topic.
Parameters:
topic(string, required): Name of the topic to get stats for
pulsar_list_connectors
List all connectors of a specified type (source or sink).
Parameters:
connector_type(string, optional): Type of connectors to list ("source" or "sink", default: "source")
pulsar_connector_status
Get the status of a specific connector.
Parameters:
connector_name(string, required): Name of the connector to get status for
pulsar_connector_config
Get the configuration of a specific connector.
Parameters:
connector_name(string, required): Name of the connector to get configuration for
pulsar_all_connectors
Get all connectors organized by type (source and sink).
Parameters: None
Development
Project Structure
pulsar-mcp-server/
├── src/
│ └── pulsar_mcp_server/
│ ├── __init__.py # Package entry point
│ ├── server.py # MCP server implementation
│ ├── pulsar_connector.py # Pulsar client wrapper
│ └── settings.py # Configuration settings
├── pyproject.toml # Project configuration
├── requirements.txt # Dependencies
├── test_server.py # Test script
└── README.md # This file
Testing
Run the test script to verify the server functionality:
python test_server.py
Running with Docker
You can also run Pulsar locally using Docker for testing:
# Start Pulsar standalone
docker run -it -p 6650:6650 -p 8080:8080 apachepulsar/pulsar:latest bin/pulsar standalone
Requirements
- Python 3.12+
- Apache Pulsar cluster (local or remote)
- MCP-compatible client
Dependencies
mcp>=1.1.0,<2.0: Model Context Protocol librarypulsar-client>=3.4.0: Apache Pulsar Python clientpydantic>=2.10.3: Data validation and settings managementpydantic-settings>=2.6.1: Settings management for Pydantic
License
MIT License
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Support
For issues and questions, please open an issue on the GitHub repository.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。