The Prefect MCP Server enables comprehensive management of Prefect 3 workflows through the Model Context Protocol, providing tools to manage flows, deployments, and flow runs.
Flow Management: Retrieve flows by ID or name, list with pagination, and search by name (case-insensitive) or tags.
Deployment Management: Get deployments by ID or fully qualified name (flow_name/deployment_name), list with pagination and optional flow ID filtering, and search by schedule status (active/inactive).
Flow Run Operations: Retrieve flow runs by ID, list with pagination and optional flow ID filtering, search by state type (e.g., "COMPLETED", "FAILED") or state name, cancel active runs, and create new flow runs from deployments with optional parameters, custom names, and timeout settings.
Advanced Filtering: Apply complex, dictionary-based filter criteria according to the Prefect API specification to refine searches across all resource types.
Enables configuration of the Prefect environment through environment variables stored in .env files, supporting settings like API URLs and authentication keys.
Provides tools for workflow orchestration through Prefect, allowing interaction with the Prefect API to manage and monitor data pipelines and workflows.
Prefect MCP Server
This repository provides a Prefect MCP server configuration using the prefect-mcp-server package with a reliable running mechanism via uvx. The configuration is tailored for use with the Cursor IDE.
Prerequisites
Python 3.9 or newer.
A preferred virtual environment tool (such as uv) for managing Python environments.
Prefect 3 (see Prefect Documentation for installation instructions).
Related MCP server: MCP Development Framework
Installation
Create and activate your virtual environment, then install Prefect MCP Server:
Configuration
The server is configured via the .cursor/mcp.json file. The updated configuration is as follows:
This configuration ensures that the server uses the uvx command with the exact package version installed via uv pip install. This approach provides enhanced reliability and consistency in your development environment.
Environment Variables
Set the following environment variables to configure your Prefect environment. You can create a file named .env in the project root with entries such as:
Additionally, if needed, set other environment variables like PREFECT_API_KEY to authenticate with your Prefect server or Prefect Cloud.
Running the Server
To start the server, you can run the following command:
Alternatively, if you are using the Cursor IDE with its configuration, the server will be automatically invoked with the command specified in .cursor/mcp.json.
Documentation
Detailed documentation on the Prefect MCP Server functionality and usage is available in the docs/prefect_mcp_documentation.md file. The documentation includes:
Complete list of available tools and their parameters
Instructions for installation and configuration
Examples of usage with different MCP clients
Prefect 3.0 compatibility information
Cursor Rules
This repository includes Cursor Rules for working with the Prefect MCP Server, located in the .cursor/rules/ directory. These rules provide contextual help and guidance when working with Prefect MCP in the Cursor IDE.
Additional Information
For further details on Prefect installation and usage, please refer to the Prefect Documentation.
For information about the Model Context Protocol (MCP), see the MCP Documentation.
Use
uv runfor running scripts within the configured environment as recommended by Cursor.
Happy coding!