Get the FREE Ultimate OpenClaw Setup Guide →

prefect

Prefect MCP server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio prefecthq-prefect-mcp-server uvx --from prefect-mcp prefect-mcp-server \
  --env PREFECT_API_KEY="your-api-key" \
  --env PREFECT_API_URL="https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]"

How to use

This MCP server provides read-only diagnostics for Prefect resources and can also expose a CLI skill for mutations via the Claude Code plugin. The server integrates with Prefect Cloud (or OSS with appropriate credentials) to fetch information about your fences, flows, deployments, runs, and related resources, enabling you to query status, identities, and other telemetry. When running locally via uvx, the server uses your local Prefect configuration (e.g., ~/.prefect/profiles.toml) by default, allowing you to test against your own environment without publishing credentials. The provided CLI/plug-in pathway lets you perform mutations like triggering deployments or cancelling runs through the same MCP surface, giving you both observability and control from a unified interface.

How to install

Prerequisites:

  • Python 3.9+ installed
  • Access to a Prefect Cloud account or OSS with valid API credentials
  • Network access to Prefect API endpoints
  • Optional: uvx tooling installed for MCP execution

Installation steps:

  1. Install uvx (the MCP runner) if you don’t have it:
pipx install uvx
  1. Ensure you have a Prefect profile configured locally (or prepare credentials for environment variables as described in the README).

  2. Install the MCP server dependencies (via your preferred method). If you’re using the FastMCP/Claude workflow shown in the README, you can skip to running the server with uvx as shown below. Otherwise, install via your project’s packaging method (e.g., poetry or pip) if you are hosting the server yourself and want to run the Python module directly.

  3. Run the MCP server locally using uvx (example command from the README):

uvx --from prefect-mcp prefect-mcp-server
  1. Connect a client (e.g., Claude Code, Codex, Gemini, or a custom MCP client) to the server URL you expose (e.g., http transport or local stdio, depending on your setup).

If you prefer to deploy via FastMCP Cloud, follow the repository’s quick start steps in the README to fork, configure environment variables, and point the server path to src/prefect_mcp_server/server.py. The important part is providing PREFECT_API_URL and PREFECT_API_KEY (or PREFECT_API_AUTH_STRING for OSS) through environment variables or HTTP headers as described in the multi-tenant details.

Additional notes

Tips and common considerations:

  • Credentials: For Cloud, use PREFECT_API_KEY; for OSS with basic auth, use PREFECT_API_AUTH_STRING. In multi-tenant setups, you can pass credentials via HTTP headers (X-Prefect-Api-Url, X-Prefect-Api-Key, X-Prefect-Api-Auth-String) to have per-user authentication.
  • When HTTP headers are present, they take precedence over environment variables. If no headers are provided, the server will rely on the configured environment variables.
  • Local testing inherits your ~/.prefect/profiles.toml settings when available, enabling seamless testing against your existing Prefect configuration.
  • This MCP supports both read-only diagnostics and mutations via a CLI skill in the Claude Code plugin; make sure your usage complies with your organization’s security policies, particularly around mutation capabilities.
  • If you are using FastMCP Cloud, remember that environment variables on the server are configured there, while your client-side configuration determines how you connect and authenticate.

Related MCP Servers

Sponsor this space

Reach thousands of developers