Skip to main content
Glama
Prefect MCP Server

Prefect MCP Server

by fortunto2

Prefect 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": {}
    }
  }
}

この設定により、サーバーはuv pip installでインストールされたパッケージバージョンと正確に一致するuvxコマンドを使用することが保証されます。このアプローチにより、開発環境の信頼性と一貫性が向上します。

環境変数

Prefect環境を構成するには、以下の環境変数を設定します。プロジェクトルートに.envというファイルを作成し、次のようなエントリを記述します。

PREFECT_API_URL=http://localhost:4200/api

さらに、必要に応じて、Prefect サーバーまたは Prefect Cloud で認証するために、 PREFECT_API_KEYなどの他の環境変数を設定します。

サーバーの実行

サーバーを起動するには、次のコマンドを実行します。

uv run <script>

あるいは、Cursor IDE をその構成で使用している場合、サーバーは.cursor/mcp.jsonで指定されたコマンドで自動的に呼び出されます。

ドキュメント

Prefect MCP Serverの機能と使用方法に関する詳細なドキュメントは、docs/prefect_mcp_documentation.mdファイルでご覧いただけます。ドキュメントの内容は以下の通りです。

  • 利用可能なツールとそのパラメータの完全なリスト

  • インストールと設定の手順

  • さまざまなMCPクライアントでの使用例

  • Prefect 3.0 互換性情報

カーソルルール

このリポジトリには、Prefect MCPサーバーを操作するためのカーソルルールが含まれています。これは.cursor/rules/ディレクトリにあります。これらのルールは、Cursor IDEでPrefect MCPを操作する際に、コンテキストに応じたヘルプとガイダンスを提供します。

追加情報

  • Prefect のインストールと使用方法の詳細については、 Prefect のドキュメントを参照してください。

  • モデル コンテキスト プロトコル (MCP) の詳細については、 MCP ドキュメントを参照してください。

  • Cursor の推奨に従って構成された環境内でスクリプトを実行するには、 uv runを使用します。

楽しいコーディングを!

Available Tools

17 tools
cancel_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

    A3.5/5.0

    Scored across 17 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count4/5

    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.

    Completeness5/5

    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

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers