home / mcp / fledge mcp server

Fledge MCP Server

Exposes Fledge data and actions through MCP for Cursor AI, including data access, control, UI generation, streaming, and validation.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "krupalp525-fledge-mcp": {
      "url": "http://localhost:8082/tools"
    }
  }
}

You run an MCP (Model Context Protocol) server that exposes Fledge capabilities to Cursor AI, letting you query sensors, manage services, generate UI components, stream real-time data, and validate API connections through natural language commands. This server acts as the bridge between Fledge and Cursor AI, enabling practical, AI-assisted control and visualization of your Fledge data and operations.

How to use

Start the Fledge MCP server and connect it to Cursor AI to perform common data-access, control, and visualization tasks. With the server running, you can use Cursor to check sensor status, fetch sensor data with optional filters, generate frontend components, subscribe to real-time readings, validate the Fledge API connection, and generate mock data for testing. Use natural language prompts in Cursor to invoke the available tools, and rely on the API-provided endpoints to manage services, update configuration, and retrieve API schemas when needed.

Typical usage patterns include: starting the MCP server, ensuring Fledge is running, connecting Cursor to the server’s tools endpoint, then issuing commands like checking sensor availability, listing sensors, or generating UI components for data visualization. If you enable the secure mode, you’ll authenticate with an API key passed in the X-API-Key header for protected operations while keeping the health endpoint accessible without authentication.

How to install

Prerequisites for running the Fledge MCP Server are as follows: Fledge installed locally or accessible via API at http://localhost:8081, Cursor AI installed, and Python 3.8 or newer.

Step 1: Prepare your environment and install dependencies.

# Clone the MCP server repository
git clone https://github.com/Krupalp525/fledge-mcp.git
cd fledge-mcp

# Install Python dependencies
pip install -r requirements.txt

Step 2: Start Fledge and the MCP server.

fledge start

# Standard MCP server
python mcp_server.py

# Secure MCP server (requires API key generation on first run)
python secure_mcp_server.py

Step 3: Verify the server is running by checking the health endpoint.

curl http://localhost:8082/health

Additional notes and configuration

To connect Cursor to the MCP server, point Cursor to the tools endpoint at the server’s address and upload the provided tools configuration, or use the local path to the tools file.

If you enable the secure server, you will need to supply the API key from the generated api_key.txt in the X-API-Key header for protected endpoints. The health endpoint remains accessible without authentication.

The server implements a JSON-RPC over WebSocket interface and provides a range of tools for data access, service control, UI generation, real-time subscriptions, validation, documentation, and AI-assisted features. You can update tools by modifying the tools.json file and restarting the server if needed.

Available tools

validate_api_connection

Check if the Fledge API is reachable and responsive by performing a lightweight health-like check against the Fledge API.

get_sensor_data

Fetch sensor data from Fledge with optional filtering by time range and limit to control data retrieval needs.

list_sensors

Return a list of all sensors available in the Fledge instance.

ingest_test_data

Ingest test data into Fledge, with optional batch count to simulate data flow.

get_service_status

Query the status of all running Fledge services to monitor health and uptime.

start_stop_service

Start or stop a specific Fledge service by its type to manage operations.

update_config

Update configuration parameters within Fledge to adjust behavior or performance.

generate_ui_component

Generate frontend UI components for visualizing Fledge data, enabling rapid dashboards.

fetch_sample_frontend

Retrieve sample frontend templates for common frameworks to accelerate UI development.

suggest_ui_improvements

Provide AI-powered suggestions to improve UI code and data visualization.

subscribe_to_sensor

Create a subscription to receive real-time updates from a specified sensor.

get_latest_reading

Fetch the most recent reading from a specific sensor for quick status checks.

simulate_frontend_request

Test API requests with different methods and payloads to validate endpoints.

get_api_schema

Get information about available Fledge API endpoints to guide integration.

list_plugins

List available Fledge plugins to understand extended capabilities.

generate_mock_data

Produce realistic mock sensor data for testing and UI demos.