Mindfront Fiber Quick Start
For Mindfront Fiber V5
Create a web service whose functions Mindfront can call. No SDK is required. Use the tools you already know.
Using an AI coding tool? Give it the protocol reference and ask it to build a connection for the business operation you need.
How it works
What it looks like on the wire
What You Need To Build
- A Meta endpoint (
GET /meta) that describes what your service can do. - Action endpoints (optional) that perform tasks and return JSON.
- An Events endpoint (optional) that returns business events Mindfront drains on a poll.
1. Meta Endpoint
A GET endpoint at /meta tells Mindfront what your module can do.
Example Response:
{
"protocolVersion": 5,
"moduleVersion": "1.0.0",
"moduleName": "MyService",
"description": "A brief description of this service.",
"actions": [
{
"name": "doSomething",
"description": "Does something useful.",
"route": "/action/doSomething",
"riskLevel": "humanApprovalRequired",
"pictogram": "automation",
"typicalHumanProcessTimeInMinutes": 5,
"input": {
"type": "object",
"properties": {
"param1": {"type": "string"}
}
}
}
]
}
riskLevelmaps to a fixed risk score:safe(0.1),machineApprovalRequired(0.5),humanApprovalRequired(0.85), orforbidden(1.0). Live platform thresholds decide whether it runs, needs a check or approval, or is refused.inputdefines the parameters you want Mindfront to provide for you.pictogram(optional) names a Carbon Design icon for the action. Reserved for future UI use, current Mindfront versions render a standard connector icon.typicalHumanProcessTimeInMinutes(optional) tells Mindfront how many minutes this would take a human, so it can show time savings.
2. Action Endpoints
These are POST endpoints that do something useful, like perform a task or get some data. They receive JSON and must return JSON. Fiber does not retry action POSTs.
Success Response:
{
"status": "success",
"data": { "result": "The action was successful." },
"tldr": "A short summary of what just happened.",
"attachment_urls": []
}
tldr(optional) is a short human-readable line that Mindfront shows as the action’s success summary in the UI.attachment_urls(optional) is an array of URLs Mindfront fetches and ingests into the document store as file deliverables on the outcome.
Error Response:
{
"status": "failure",
"error": { "message": "Something went wrong." }
}
3. Events Endpoint (Optional)
If your module exposes a GET /events endpoint and sets "servesEvents": true in /meta, Mindfront polls it every five seconds. Your service owns the cursor and drains each response. Delivery is at most once: events can be lost if Mindfront stops after the drain and before publishing them. Return [] when nothing new has arrived. See the full spec for the event schema.
Complete Working Example
This minimal Python server correctly implements the protocol.
#!/usr/bin/env python3
import json
from http.server import HTTPServer, BaseHTTPRequestHandler
# Define what your module does
METADATA = {
"protocolVersion": 5,
"moduleVersion": "1.0.0",
"moduleName": "HelloWorld",
"description": "A simple example module that says hello.",
"actions": [
{
"name": "sayHello",
"description": "Says hello to someone.",
"route": "/action/sayHello",
"riskLevel": "safe",
"pictogram": "conversation",
"typicalHumanProcessTimeInMinutes": 5,
"input": {
"type": "object",
"properties": {"name": {"type": "string"}},
"required": ["name"]
}
}
]
}
# The handler for your server
class FiberHandler(BaseHTTPRequestHandler):
def do_GET(self):
# Handle the /meta endpoint
if self.path == "/meta":
self.send_response(200)
self.send_header("Content-type", "application/json")
self.end_headers()
self.wfile.write(json.dumps(METADATA).encode())
else:
self.send_error(404)
def do_POST(self):
# Handle the /action/sayHello endpoint
if self.path == "/action/sayHello":
try:
# Read and parse the JSON input
content_length = int(self.headers['Content-Length'])
post_data = self.rfile.read(content_length)
input_data = json.loads(post_data)
# Prepare the success response
name = input_data.get('name', 'World')
response_data = {
"status": "success",
"data": {"message": f"Hello, {name}!"}
}
# Send the success response
self.send_response(200)
self.send_header("Content-type", "application/json")
self.end_headers()
self.wfile.write(json.dumps(response_data).encode())
except Exception as e:
# On failure, return a JSON error body.
# A 200 status code is fine here because the transport (HTTP) succeeded. Mindfront will check the body.
self.send_response(200)
self.send_header("Content-type", "application/json")
self.end_headers()
error_data = {"status": "failure", "error": {"message": str(e)}}
self.wfile.write(json.dumps(error_data).encode())
else:
self.send_error(404)
# Run the server
if __name__ == "__main__":
print("Starting Mindfront Fiber server on http://localhost:8080")
HTTPServer(("", 8080), FiberHandler).serve_forever()
Test It
Run the Python script:
python3 your_script_name.pyIn another terminal, test the endpoints:
# Get the metadata curl "http://localhost:8080/meta" # Call the action curl -X POST "http://localhost:8080/action/sayHello" \ -H "Content-Type: application/json" \ -d '{"name": "Sarah Connor"}'
Connecting to Mindfront
To connect your running Mindfront Fiber service, ask your Mindfront administrator for assistance.
Full specification
See the full specification for authentication, actions, skills and events.