Prefect MCP Server
完美 MCP 服务器
本仓库使用prefect-mcp-server包提供了一个 Prefect MCP 服务器配置,并通过uvx实现了可靠的运行机制。该配置专为配合 Cursor IDE 使用而定制。
先决条件
Python 3.9 或更新版本。
用于管理 Python 环境的首选虚拟环境工具(例如 uv)。
Prefect 3(有关安装说明,请参阅Prefect 文档)。
Related MCP server: MCP Prompt Server
安装
创建并激活您的虚拟环境,然后安装 Prefect MCP Server:
uv venv --python 3.12 && source .venv/bin/activate
uv pip install -U prefect-mcp-server配置
服务器通过.cursor/mcp.json文件进行配置。更新后的配置如下:
{
"mcpServers": {
"prefect": {
"command": "uvx",
"args": [
"prefect-mcp-server"
],
"env": {}
}
}
}此配置可确保服务器使用uvx命令,并且该命令与通过uv pip install安装的软件包版本完全相同。此方法可增强开发环境的可靠性和一致性。
环境变量
设置以下环境变量来配置您的 Prefect 环境。您可以在项目根目录中创建一个名为.env的文件,其中包含以下内容:
PREFECT_API_URL=http://localhost:4200/api此外,如果需要,请设置其他环境变量(如PREFECT_API_KEY以向您的 Prefect 服务器或 Prefect Cloud 进行身份验证。
运行服务器
要启动服务器,您可以运行以下命令:
uv run <script>或者,如果您使用带有其配置的 Cursor IDE,则服务器将使用.cursor/mcp.json中指定的命令自动调用。
文档
有关 Prefect MCP Server 功能和使用的详细文档,请参阅docs/prefect_mcp_documentation.md文件。该文档内容如下:
可用工具及其参数的完整列表
安装和配置说明
不同 MCP 客户端的使用示例
Prefect 3.0 兼容性信息
游标规则
此代码库包含用于与 Prefect MCP 服务器配合使用的 Cursor 规则,位于.cursor/rules/目录中。这些规则在 Cursor IDE 中使用 Prefect MCP 时提供上下文帮助和指导。
附加信息
有关 Prefect 安装和使用的更多详细信息,请参阅Prefect 文档。
有关模型上下文协议 (MCP) 的信息,请参阅MCP 文档。
按照 Cursor 的建议,使用
uv run在配置的环境内运行脚本。
编码愉快!
Available Tools
17 toolscancel_flow_runB
Cancel a flow run.
Args:
flow_run_id: ID of the flow run to cancel.
Inputs: flow_run_id (required). Returns: result
create_flow_runB
Create a new flow run for the specified deployment (Legacy).
Args:
deployment_id: ID of the deployment to create a run for.
parameters: Dictionary with parameters for the flow run (optional).
Inputs: deployment_id (required), parameters. Returns: result
create_flow_run_from_deploymentB
Create a new flow run for the specified deployment.
Args:
deployment_id: ID of the deployment or name in format 'flow_name/deployment_name'.
parameters: Dictionary with parameters for the flow run (optional).
name: Optional name for the flow run.
timeout: Timeout in seconds, 0 means no waiting for completion (default 0).
Inputs: deployment_id (required), parameters, name, timeout. Returns: result
filter_deploymentsB
Filter deployments based on specified criteria.
Args:
filter_criteria: Dictionary with filter criteria according to Prefect API.
Example1: {"deployments": {"is_schedule_active": {"eq_": true}}}
Example2: {"deployments": {"tags": {"all_": ["production"]}}}
Inputs: filter_criteria (required). Returns: result
filter_flow_runsC
Filter flow runs based on specified criteria.
Args:
filter_criteria: Dictionary with filter criteria according to Prefect API.
Example: {"flow_runs": {"state": {"type": {"any_": ["FAILED", "CRASHED"]}}}}
Inputs: filter_criteria (required). Returns: result
filter_flowsB
Filter flows based on specified criteria.
Args:
filter_criteria: Dictionary with filter criteria according to Prefect API.
Example: {"flows": {"tags": {"all_": ["production"]}}}
Inputs: filter_criteria (required). Returns: result
get_deployment_by_idB
Get a deployment by its ID.
Args:
deployment_id: ID of the deployment to retrieve.
Inputs: deployment_id (required). Returns: result
get_deployment_by_nameB
Get a deployment by its name.
Args:
name: Name of the deployment to retrieve, in format "flow_name/deployment_name".
Inputs: name (required). Returns: result
get_flow_by_idB
Get a flow by its ID.
Args:
flow_id: ID of the flow to retrieve.
Inputs: flow_id (required). Returns: result
get_flow_by_nameC
Get a flow by its name.
Args:
name: Name of the flow to retrieve.
Inputs: name (required). Returns: result
get_flow_run_by_idB
Get a flow run by its ID.
Args:
flow_run_id: ID of the flow run to retrieve.
Inputs: flow_run_id (required). Returns: result
list_deploymentsB
Get a list of deployments from the Prefect API.
Args:
limit: Maximum number of deployments to return (default 20).
offset: Number of deployments to skip (default 0).
flow_id: Optional ID of the flow to filter deployments by.
Inputs: limit, offset, flow_id. Returns: result
list_flow_runsB
Get a list of flow runs from the Prefect API.
Args:
limit: Maximum number of flow runs to return (default 20).
offset: Number of flow runs to skip (default 0).
flow_id: Optional ID of the flow to filter runs by.
Inputs: limit, offset, flow_id. Returns: result
list_flowsB
Get a list of flows from the Prefect API.
Args:
limit: Maximum number of flows to return (default 20).
offset: Number of flows to skip (default 0).
Inputs: limit, offset. Returns: result
search_deployments_by_statusB
Search for deployments by schedule status.
Args:
is_schedule_active: Filter deployments by whether their schedule is active.
limit: Maximum number of deployments to return (default 20).
Inputs: is_schedule_active, limit. Returns: result
search_flow_runs_by_stateB
Search for flow runs by state.
Args:
state_type: Optional state type (e.g., "COMPLETED", "FAILED", "CRASHED").
state_name: Optional state name (e.g., "Completed", "Failed").
limit: Maximum number of flow runs to return (default 20).
Inputs: state_type, state_name, limit. Returns: result
search_flowsA
Search for flows by name and/or tags.
Args:
name: Optional name to search for (case-insensitive contains match).
tags: Optional list of tags to filter by.
limit: Maximum number of flows to return (default 20).
Inputs: name, tags, limit. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Most tools have distinct purposes targeting specific resources (flows, deployments, flow runs) with clear action verbs, but there is some overlap between filter_* and search_* tools that could cause confusion. For example, filter_deployments and search_deployments_by_status both filter deployments but use different approaches, and create_flow_run vs create_flow_run_from_deployment are similar with minor differences.
Tool names follow a highly consistent verb_noun pattern throughout, with clear conventions like get_*, list_*, create_*, filter_*, search_*, and cancel_*. All names use snake_case uniformly, making them predictable and easy to parse for an agent.
With 17 tools, the count is slightly high but reasonable for a workflow orchestration domain like Prefect, which requires operations across flows, deployments, and runs. It covers essential CRUD and query functions without being overwhelmingly bloated, though some tools could potentially be consolidated.
The tool set provides comprehensive coverage for managing Prefect workflows, including full CRUD/lifecycle operations for flows, deployments, and flow runs (e.g., create, get, list, filter, search, cancel). There are no obvious gaps that would hinder an agent from performing typical orchestration tasks, and the surface supports complex filtering and searching needs.
Maintenance
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server for Cursor IDE that simplifies the installation and configuration of other MCP servers.312 npm75MIT
- AlicenseDqualityDmaintenanceA server based on Model Context Protocol that provides predefined prompt templates for tasks like code review and API documentation generation, enabling more efficient workflows in Cursor/Windsurf editors.10247MIT
- FlicenseNot gradedqualityDmaintenanceA lightweight Python-based server designed to run, manage and create CrewAI workflows using the Model Context Protocol for communicating with LLMs and tools like Claude Desktop or Cursor IDE.36-
- AlicenseBqualityFmaintenanceA Model Context Protocol server that allows AI assistants to interact with Prefect's workflow automation platform through natural language, enabling users to manage flows, deployments, tasks, and other Prefect resources via conversational commands.4615Apache 2.0