home / mcp / prefect mcp server
An MCP implementation for Prefect
Configuration
View docs{
"mcpServers": {
"allen-munsch-mcp-prefect": {
"command": "mcp-prefect",
"args": [
"--transport",
"stdio"
],
"env": {
"MCP_PORT": "8000",
"PREFECT_API_KEY": "your_api_key_here",
"PREFECT_API_URL": "http://localhost:4200/api"
}
}
}
}You can run a Prefect MCP Server to let AI assistants interact with Prefect by sending natural-language requests. The MCP server exposes a lightweight bridge that translates your queries into Prefect actions, such as creating flows, managing deployments, and reading logs, so you can control your Prefect environment from chat or automation tools.
Run the MCP server locally using stdio transport so you can connect compatible MCP clients that speak the MCP protocol. This setup lets you issue natural-language requests like listing flows, starting a flow run, pausing schedules, or querying logs, and have them executed by Prefect.
Prerequisites: you need Python and a working internet connection to install the MCP client library. You also need access to your Prefect API endpoint and an API key to authorize requests.
pip install mcp-prefect
```
# Alternative: install from source
```
git clone https://github.com/allen-munsch/mcp-prefect
cd mcp-prefect
pip install -e .
```
# Quick start (stdio transport)
```
PREFECT_API_URL=http://localhost:4200/api \
PREFECT_API_KEY=your_api_key_here \
MCP_PORT=8000 \
mcp-prefect --transport stdioTo connect a client, use a stdio configuration that specifies the command and environment variables shown below. This enables a local MCP server for Prefect interactions.
{
"mcpServers": {
"prefect": {
"command": "mcp-prefect",
"args": ["--transport", "stdio"],
"env": {
"PREFECT_API_URL": "http://localhost:4200/api",
"PREFECT_API_KEY": "your_api_key_here"
}
}
}
}Keep your Prefect API key confidential. Use environment-scoped keys when possible and restrict MCP access to trusted clients. If you expose the MCP server over a network, enable firewalls and rotate API keys periodically.
If the MCP server fails to start, verify that the required environment variables are set correctly and that the Prefect API URL is reachable. Check that the MCP port you choose is not blocked by your firewall. If you switch transport backends, ensure the corresponding command and arguments are updated in your client configuration.
Create a new artifact and store its metadata in Prefect.
Remove an artifact from Prefect storage.
Retrieve a specific artifact by its ID.
List artifacts matching given criteria.
Fetch the most recently created artifacts.
Update metadata or content for an artifact.
Create a new automation workflow.
Delete an existing automation workflow.
Retrieve a single automation by ID.
List all automations.
Pause an automation workflow.
Resume a paused automation.
Update parameters of an automation.
Remove a block document.
Retrieve a block document by ID.
List block documents.
Fetch details about a block type.
List available block types.
Delete a deployment.
Get deployment details.
Retrieve deployment schedules.
List deployments.
Pause a deployment schedule.
Resume a deployment schedule.
Set or update deployment schedules.
Update deployment parameters.
Cancel an ongoing flow run.
Create a flow run associated with a deployment.
Remove a flow definition.
Delete a specific flow run.
Fetch a flow definition.
Get details about a specific flow run.
Retrieve logs for a flow run.
List flow runs.
List runs for a specific flow.
List all flows.
List task runs within a flow run.
Restart a flow run.
Set the state of a flow run.
Create a log entry.
Fetch logs.
Check server health.
Retrieve a task run.
Get logs for a task run.
List task runs.
Update the state of a task run.
Create a variable in the workspace.
Delete a variable.
Get a specific variable.
List all variables.
Update a variable.
Create a new work queue.
Delete a work queue.
Fetch the current workspace.
Retrieve a work queue by ID.
Find a work queue by name.
List runs for a work queue.
List all work queues.
Get workspace details.
Find a workspace by handle.
List workspaces.
Pause a work queue.
Resume a paused work queue.
Update work queue settings.