Diffusion MCP Server: Topics, Sessions, Metrics
Manage a Diffusion MCP server: connect to servers, explore and create topics, manage sessions, configure topic views and metrics, and monitor performance.
npx -y @diffusiondata/diffusion-mcp-serverOverview
The Diffusion MCP Server is a lightweight management service for Diffusion deployments that exposes common administrative operations over HTTP. It centralizes tasks such as connecting to Diffusion brokers, discovering and creating topics, controlling client sessions, configuring topic views, and exporting operational metrics for monitoring. The server acts as an MCP (Model Context Protocol) façade so external tooling and automation can manage Diffusion programmatically without embedding Diffusion client libraries.
This tool is useful for developers and operations engineers who want to automate or script Diffusion management tasks, integrate Diffusion into CI/CD or monitoring stacks, or provide a simple HTTP API for operational consoles. By combining topic and session management with Prometheus-compatible metrics, the server fits into observability workflows and simplifies operational automation.
Features
- Connects to one or more Diffusion brokers and exposes management APIs
- Browse existing topics and their types, schemas, and configuration
- Create, update, and delete topics programmatically
- Inspect and manage active client sessions, including termination
- Configure topic views and derived views for aggregation or transformation
- Expose runtime and Diffusion metrics in Prometheus format
- Health and readiness endpoints for orchestration systems
- Docker-friendly packaging and straightforward environment-based configuration
Installation / Configuration
Clone and build (Maven example):
Run with Docker:
Environment variables (common):
- DIFFUSION_HOST — Diffusion broker hostname or IP
- DIFFUSION_PORT — Diffusion port (typically 80, 443 or custom)
- DIFFUSION_USER / DIFFUSION_PASS — credentials for management connection
- SERVER_PORT — HTTP port for this server
- LOG_LEVEL — logging verbosity
Alternatively, set values in an application.properties / application.yml if the project uses Spring Boot:
Available Resources
Common API endpoints (typical paths — actual routes may vary by release):
| Resource | Method | Description |
|---|---|---|
| /api/topics | GET | List topics and metadata |
| /api/topics | POST | Create a new topic (JSON payload describing type/config) |
| /api/topics/{topic} | GET | Get topic details |
| /api/topics/{topic} | DELETE | Delete a topic |
| /api/views | POST | Create or update a topic view |
| /api/sessions | GET | List active client sessions |
| /api/sessions/{id} | DELETE | Terminate a session |
| /metrics | GET | Prometheus-compatible metrics |
| /health or /actuator/health | GET | Health check for orchestrators |
Prometheus scrape example:
scrape_configs:
- job_name: diffusion-mcp
static_configs:
- targets:
metrics_path: /metrics
Use Cases
Discover topics for an integration pipeline
- List topics to generate a mapping for downstream ETL:
|
- List topics to generate a mapping for downstream ETL:
Create a new topic from CI/CD when deploying a new service
- Example JSON to create a topic (type and config depend on your Diffusion deployment):
- Example JSON to create a topic (type and config depend on your Diffusion deployment):
Terminate a misbehaving client session without SSHing into brokers
# List sessions | # Terminate a session by idConfigure a server-side view to aggregate or filter topic data
- Post a view configuration to /api/views to create derived topics or aggregations used by applications.
Monitor Diffusion performance with Prometheus
- Add the /metrics endpoint to your scrape targets; build alerts on connection counts, message rates, or error counters exposed by the MCP server.
Tips and Best Practices
- Secure the management endpoint behind a network ACL or authentication proxy; the server has powerful administrative operations.
- Use orchestration health checks to ensure Diffusion connectivity before promoting a server instance to production.
- Combine the metrics endpoint with dashboards (Grafana) to visualize topic throughput, session trends, and server health.
- When automating topic creation, validate topic schemas in tests to prevent runtime incompatibilities.
Further Reading
- Consult the repository README and API documentation bundled with releases for exact routes and payload schemas.
- Integrate with your existing CI/CD and observability tooling using the example requests and Prometheus configuration shown above.