Prefect (MCP)¶
The Prefect MCP server provides access to Prefect workflow orchestration for monitoring and troubleshooting. It enables Holmes to inspect flow runs, retrieve logs, check worker health, and investigate failed or crashed workflows.
Prerequisites¶
Before configuring the Prefect MCP server, you need:
- Your Prefect API URL
- A Prefect API key (required for Prefect Cloud, optional for self-hosted)
- Log in to Prefect Cloud
- Go to your profile → API Keys
- Click Create API Key
- Copy the API key
- Your API URL follows this format: You can find your account and workspace IDs in the Prefect Cloud URL when logged in.
Configuration¶
For CLI usage, you need to deploy the Prefect MCP server first, then configure Holmes to connect to it.
Step 1: Create the Prefect Credentials Secret
kubectl create namespace holmes-mcp
kubectl create secret generic prefect-mcp-credentials \
--from-literal=api-url=<YOUR_PREFECT_API_URL> \
--from-literal=token=<YOUR_PREFECT_API_KEY> \
-n holmes-mcp
Step 2: Deploy the Prefect MCP Server
Create a file named prefect-mcp-deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: prefect-mcp-server
namespace: holmes-mcp
spec:
replicas: 1
selector:
matchLabels:
app: prefect-mcp-server
template:
metadata:
labels:
app: prefect-mcp-server
spec:
containers:
- name: prefect-mcp
image: us-central1-docker.pkg.dev/genuine-flight-317411/mcp/prefect-mcp:1.0.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8000
name: http
env:
- name: PREFECT_API_URL
valueFrom:
secretKeyRef:
name: prefect-mcp-credentials
key: api-url
- name: PREFECT_API_KEY
valueFrom:
secretKeyRef:
name: prefect-mcp-credentials
key: token
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
readinessProbe:
tcpSocket:
port: 8000
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
tcpSocket:
port: 8000
initialDelaySeconds: 10
periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
name: prefect-mcp-server
namespace: holmes-mcp
spec:
selector:
app: prefect-mcp-server
ports:
- port: 8000
targetPort: 8000
protocol: TCP
name: http
Deploy it to your cluster:
Step 3: Configure Holmes CLI
Add the MCP server configuration to ~/.holmes/config.yaml:
mcp_servers:
prefect:
description: "Prefect workflow orchestration and monitoring"
config:
url: "http://prefect-mcp-server.holmes-mcp.svc.cluster.local:8000/sse"
mode: sse
llm_instructions: |
Use Prefect tools to investigate workflow failures, check flow run status, and troubleshoot orchestration issues.
When investigating a failed flow run:
1. First get the flow run details to understand what failed
2. Retrieve the logs for the failed flow/task run
3. Check if the deployment is healthy and workers are running
4. Look at recent runs of the same flow to identify patterns
After making changes to your configuration, run:
First, create a Kubernetes secret with your Prefect API key:
kubectl create secret generic prefect-mcp-token \
--from-literal=token=<YOUR_PREFECT_API_KEY> \
-n <NAMESPACE>
Then add the following to your values.yaml:
mcpAddons:
prefect:
enabled: true
auth:
secretName: "prefect-mcp-token"
config:
apiUrl: "https://api.prefect.cloud/api/accounts/<ACCOUNT_ID>/workspaces/<WORKSPACE_ID>"
To customize how Holmes uses Prefect, you can provide your own LLM instructions:
mcpAddons:
prefect:
enabled: true
auth:
secretName: "prefect-mcp-token"
config:
apiUrl: "https://api.prefect.cloud/api/accounts/<ACCOUNT_ID>/workspaces/<WORKSPACE_ID>"
llmInstructions: |
Use Prefect tools to investigate workflow failures, check flow run status, and troubleshoot orchestration issues.
When investigating a failed flow run:
1. First get the flow run details to understand what failed
2. Retrieve the logs for the failed flow/task run
3. Check if the deployment is healthy and workers are running
4. Look at recent runs of the same flow to identify patterns
Then deploy or upgrade your Holmes installation:
First, create a Kubernetes secret with your Prefect API key:
kubectl create secret generic prefect-mcp-token \
--from-literal=token=<YOUR_PREFECT_API_KEY> \
-n <NAMESPACE>
Then add the following to your generated_values.yaml:
holmes:
mcpAddons:
prefect:
enabled: true
auth:
secretName: "prefect-mcp-token"
config:
apiUrl: "https://api.prefect.cloud/api/accounts/<ACCOUNT_ID>/workspaces/<WORKSPACE_ID>"
Then deploy or upgrade your Robusta installation: