MCP Server Setup¶
Machina exposes its connectors as an MCP server, allowing Claude Desktop, Cursor, and any MCP-compatible client to interact with your maintenance data without writing agent code.
Install¶
Configuration¶
Create a machina.yaml config file (see YAML Configuration):
name: "Maintenance MCP Server"
plant:
name: "My Plant"
connectors:
cmms:
type: generic_cmms
primary: true
settings:
data_dir: "./sample_data/cmms"
llm:
provider: "openai:gpt-4o"
sandbox: true
Starting the Server¶
stdio (default — for IDE integration)¶
Use this with Claude Desktop or Cursor. Add to your MCP client config:
{
"mcpServers": {
"machina": {
"command": "python",
"args": ["-m", "machina.mcp", "--config", "/path/to/machina.yaml"]
}
}
}
Single-user only
stdio mode has no authentication. Any local process can connect. See Security for details.
streamable-http (for multi-client / server deployment)¶
Requires bearer token authentication. See Auth for setup.
CLI arguments:
| Argument | Default | Description |
|---|---|---|
--config |
(required) | Path to machina.yaml |
--transport |
stdio |
stdio or streamable-http |
--host |
0.0.0.0 |
Bind address (HTTP only) |
--port |
8000 |
Listen port (HTTP only) |
Health Endpoint¶
The HTTP transport exposes GET /health:
# Unauthenticated — basic liveness check
curl http://localhost:8000/health
# {"status": "healthy", "server": "machina", "transport": "streamable-http"}
# Authenticated — includes connector details
curl -H "Authorization: Bearer <token>" http://localhost:8000/health
# {"status": "healthy", "connectors": {...}, "sandbox": true, "version": "0.3.0"}
Lifecycle¶
On startup, the MCP server:
- Loads config from YAML
- Instantiates
MachinaRuntimewith all configured connectors - Calls
connect_all()— establishes connections to CMMS, IoT, etc. - Auto-registers MCP tools based on connector capabilities
- Registers resources and prompts
On shutdown (SIGTERM):
- Stops accepting new requests
- Drains in-flight requests (up to 30s)
- Calls
disconnect_all()on all connectors - Exits cleanly
Docker¶
See Docker Deployment for the containerized setup.