MQTTX SSE Server

MQTTX SSE Server

By ysfscream GitHub

An implementation of the Model-Context Protocol (MCP) that enables MQTT operations over Server-Sent Events (SSE) transport.

mqtt ai
Overview

What is MQTTX SSE Server?

MQTTX SSE Server is an implementation of the Model-Context Protocol (MCP) that enables MQTT operations over Server-Sent Events (SSE) transport, allowing AI assistants to interact with external tools and services.

How to use MQTTX SSE Server?

To use the MQTTX SSE Server, clone the repository, install the dependencies, and run the server. Configure your MQTTX settings to connect to the server using the provided URL.

Key features of MQTTX SSE Server?

  • Implements MCP protocol version 2024-11-05
  • Uses SSE for real-time message delivery
  • Supports MQTT operations: connect, subscribe, and publish messages
  • Session management for multiple clients

Use cases of MQTTX SSE Server?

  1. Connecting AI assistants to MQTT brokers for real-time data exchange.
  2. Enabling real-time updates for IoT applications.
  3. Facilitating communication between different services using MQTT.

FAQ from MQTTX SSE Server?

  • What is the MCP protocol?

The Model-Context Protocol (MCP) is a standardized protocol that allows AI assistants to interact with external tools and services.

  • How do I install MQTTX SSE Server?

Clone the repository, install dependencies using npm, and run the server.

  • Can I use MQTTX SSE Server with any MQTT broker?

Yes, as long as the broker supports standard MQTT operations.

Content

MQTTX SSE Server

An implementation of the Model-Context Protocol (MCP) that enables MQTT operations over Server-Sent Events (SSE) transport.

About MCP

The Model-Context Protocol (MCP) is a standardized protocol that allows AI assistants to interact with external tools and services. This server implements the MCP specification using SSE (Server-Sent Events) as the transport layer, providing MQTT broker connectivity capabilities.

Features

  • Implements MCP protocol version 2024-11-05
  • Uses SSE (Server-Sent Events) as the transport layer
  • Provides MQTT operations through MCP tools:
    • Connect to MQTT brokers
    • Subscribe to MQTT topics
    • Publish messages to MQTT topics
  • Real-time message delivery from subscribed topics
  • Session management for multiple clients

Getting Started

Prerequisites

  • Node.js (v14 or later)
  • npm

Installation

# Clone the repository
git clone https://github.com/yourusername/mqttx-sse-server.git
cd mqttx-sse-server

# Install dependencies
npm install

Running the Server

npm start

The server will start on port 4000 by default.

Configuring MQTTX

To use this MCP server with MQTTX, add the following configuration to your MQTTX settings:

{
  "mcpServers": {
    "mqttx-server": {
      "url": "http://localhost:4000/mqttx/sse"
    }
  }
}

MCP Protocol Implementation

This server implements the Model-Context Protocol with the following components:

  • SSE Connection: Establishes persistent connection for real-time updates
  • JSON-RPC API: Handles tool calls and responses according to MCP spec
  • Tools Interface: Provides MQTT functionality through standardized MCP tools
  • Session Management: Tracks client sessions and their MQTT connections

API Reference

SSE Connection

Establishes a persistent connection for receiving server events.

GET /mqttx/sse

Response events:

  • endpoint: Contains the URL for making JSON-RPC calls
  • heartbeat: Regular ping to keep the connection alive
  • message: Contains JSON-RPC responses

JSON-RPC Commands

All commands are sent to the message endpoint with your session ID:

POST /mqttx/message?sessionId=xxx

Initialize

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize"
}

List Tools

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/list"
}

MQTT Connect

{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "mqttConnect",
    "arguments": {
      "host": "broker.example.com",
      "port": 1883,
      "clientId": "mqttx-client"
    }
  }
}

MQTT Subscribe

{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
      "name": "mqttSubscribe",
      "arguments": {
        "topic": "test/topic",
        "qos": 0
      }
  }
}

MQTT Publish

{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "tools/call",
  "params": {
      "name": "mqttPublish",
      "arguments": {
        "topic": "test/topic",
        "payload": "Hello MQTT!",
        "qos": 0,
        "retain": false
      }
  }
}
No tools information available.

A Model Context Protocol server for integrating HackMD's note-taking platform with AI assistants.

YouTube MCP Server
YouTube MCP Server by IA-Programming

YouTube MCP Server is an AI-powered solution designed to revolutionize your YouTube experience. It empowers users to search for YouTube videos, retrieve detailed transcripts, and perform semantic searches over video content—all without relying on the official API. By integrating with a vector database, this server streamlines content discovery.

youtube ai
View Details

MCP Deep Research Server using Gemini creating a Research AI Agent

research ai
View Details
MCP-Mealprep
MCP-Mealprep by JoshuaRL

This project takes a number of MCP servers from GitHub locations, packages them together with this repo's GHCR container, and launches them with docker-compose to run as a stack for ML/AI resources.

docker ai
View Details

BioMCP: Biomedical Model Context Protocol

bioinformatics ai
View Details
MySQL MCP Server
MySQL MCP Server by designcomputer

A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases

Toolbase
Toolbase by Toolbase-AI

A desktop application that adds powerful tools to Claude and AI platforms