prefect-mcp-server logo

prefect-mcp-server

Organization
PrefectHQ

Prefect MCP server

PublisherPrefectHQ
Repositoryprefect-mcp-server
LanguagePython
Forks
42
Stars
53
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    prefect-mcp-server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    53 stars and 42 forks from the linked repository.

prefect-mcp-server

[!WARNING] This project is under active development and may change drastically at any time.

This is an experimental MCP server for Prefect. APIs, features, and behaviors are subject to change without notice. We encourage you to try it out, provide feedback, and contribute. Please create issues or open PRs with your ideas and suggestions.

An MCP server for interacting with prefect resources.

The server gives MCP clients read-only tools for inspecting Prefect Cloud and self-hosted Prefect instances, plus a docs proxy so assistants can look up current Prefect CLI, SDK, and deployment guidance.

Choose Your Setup

See the agent setup guides for client-specific instructions and setup prompts, or give your agent the plain-text setup index.

Use caseRecommended setupAuthentication
ChatGPTPrefect pluginPrefect Cloud OAuth
ClaudePrefect connectorPrefect Cloud OAuth
Claude Code or CodexPrefect plugin for your clientPrefect Cloud OAuth
Claude Tag or CoworkThe same Prefect pluginOrganization-managed Prefect Cloud OAuth
Local MCP clientuvx stdio serverActive local Prefect profile or env vars
Self-hosted Prefect or custom Cloud workspaceSelf-hosted HTTP or stdio serverAPI key, basic auth, env vars, or headers
Team-operated shared serverHTTP deployment with per-request headersUser or service-account credentials in headers

ChatGPT Plugin and Claude Connector

Install the Prefect plugin in ChatGPT or connect the Prefect connector in Claude. Sign in to Prefect Cloud and select the workspaces the assistant may read. Both use Prefect's hosted MCP server; no local installation or API key is required.

In ChatGPT, installing the plugin and connecting your Prefect account are separate steps. Start a chat with Prefect selected and complete the Connect prompt. If an existing chat does not discover the newly connected tools, start a fresh chat. In Claude, connect from the directory listing and approve tool calls when prompted.

Try asking: "Which Prefect workspaces can you access?" Then choose a workspace and ask: "Why did my most recent failed flow run fail?" The hosted tools inspect runs, logs, and workspace health and search documentation; they do not change Prefect state.

See the Prefect MCP setup guide for more connection options.

Claude Code Plugin

The easiest setup for Claude Code is the Prefect plugin:

bash
# add from marketplace
/plugin marketplace add prefecthq/prefect-mcp-server

# install the plugin
/plugin install prefect

This connects Claude to Prefect's hosted, read-only MCP server for diagnostics, documentation, and current release notes. Claude opens Prefect Cloud OAuth during installation so you can select the workspaces it may access.

[!NOTE] The plugin does not read ~/.prefect/profiles.toml or require a local Prefect installation. For self-hosted Prefect or explicit credentials, use the local uvx setup below.

Codex Plugin

The same hosted MCP server and workflow guidance are available as a Codex plugin:

bash
# add from marketplace
codex plugin marketplace add prefecthq/prefect-mcp-server

# install the plugin
codex plugin add prefect@prefect

Like the Claude Code plugin, Codex authenticates directly with Prefect Cloud OAuth. The plugin contains no API keys or placeholder credentials.

If you also configure a local MCP server, give it a distinct name such as prefect-local. The plugin endpoint uses Prefect Cloud OAuth; a local server uses the Prefect profile or environment variables available to its process. Call get_identity before acting on workspace state to confirm which target is active.

The same plugin bundle is suitable for Cowork and Claude Tag because it references the hosted MCP URL instead of launching a process on the user's machine. Claude Tag administrators attach it and its Prefect credential to the appropriate Access bundle.

Prefect's privacy policy and terms and conditions apply to the hosted service.

Run Locally

When running the MCP server locally with stdio transport, it automatically uses your local Prefect configuration from ~/.prefect/profiles.toml if available.

bash
# minimal setup - inherits from local Prefect profile
claude mcp add prefect \
  -- uvx --from prefect-mcp prefect-mcp-server

# or explicitly set credentials
claude mcp add prefect \
  -e PREFECT_API_URL=https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID] \
  -e PREFECT_API_KEY=your-cloud-api-key \
  -- uvx --from prefect-mcp prefect-mcp-server

[!NOTE] For self-hosted Prefect servers with basic auth, use PREFECT_API_AUTH_STRING instead of PREFECT_API_KEY.

[!TIP] Prefect Cloud users on Team, Pro, and Enterprise plans can use service accounts for API authentication. Pro and Enterprise users can restrict service accounts to read-only access since this MCP server requires no write permissions.

Deploy Your Own Server

Deploy your own server when you need a custom Prefect API target, self-hosted Prefect, a private network, or an API-key-based team deployment.

  1. Fork this repository on GitHub:

    bash
    gh repo fork prefecthq/prefect-mcp-server
  2. Deploy it on Prefect Horizon or FastMCP Cloud.

  3. Configure the server:

    • server path: src/prefect_mcp_server/server.py
    • requirements: pyproject.toml
    • environment variables:
      • PREFECT_API_URL: https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]
      • PREFECT_API_KEY: your Prefect Cloud API key
      • PREFECT_API_AUTH_STRING: basic auth credentials for self-hosted Prefect, if needed
      • OPENAI_APPS_CHALLENGE_TOKEN: domain-verification token for an OpenAI public plugin submission, if needed
  4. Add the deployed HTTP URL to your MCP client:

    bash
    claude mcp add prefect --transport http https://your-server-name.fastmcp.app/mcp

[!NOTE] For self-hosted deployments, environment variables are configured on the deployed MCP server, not in your MCP client configuration. The MCP host authenticates access to the MCP server, while this server uses the configured Prefect credentials to access Prefect.

Prefect operates a hosted MCP deployment that uses HTTP MCP OAuth instead of asking users to create or paste API keys. This is the endpoint used by the Prefect plugin.

A user can also add the hosted MCP URL directly to a compatible client:

bash
claude mcp add prefect \
  --transport http https://prefect.fastmcp.app/mcp

The MCP client discovers OAuth metadata from the server, opens a browser for Prefect Cloud authentication, and asks the user to choose the workspaces this MCP client may read. After authentication, the assistant can list the consented workspaces and call the same read-only Prefect tools against those workspaces.

Cloud OAuth mode:

  • uses HTTP MCP OAuth, not stdio credentials
  • does not require PREFECT_API_KEY in the MCP client
  • limits workspace-scoped tools to the workspaces selected during consent
  • requires workspace-scoped tool calls to include a workspace_id
  • keeps the shared read-only tool definitions from this repository

Useful first prompts:

  • "Tell me what Prefect workspaces you can access."
  • "Look across all authorized workspaces and summarize recent failed flow runs."
  • "Compare deployment health between my staging and production workspaces."

Unattended Service-Account Clients

Browser OAuth is the right flow for human-operated MCP clients. Workflow agents and other noninteractive runtimes should use service-account MCP OAuth credentials issued by Prefect Cloud, exchange those credentials for an MCP bearer token, and connect to the hosted MCP URL with an Authorization header.

bash
export PREFECT_MCP_CLOUD_CLIENT_ID=...
export PREFECT_MCP_CLOUD_CLIENT_SECRET=...

uvx --from prefect-mcp prefect-mcp-cloud-token

Agents can also exchange credentials in process before constructing their MCP client:

python
from fastmcp import Client
from fastmcp.client.transports import StreamableHttpTransport
from prefect_mcp_server.cloud_oauth import exchange_client_credentials_token

token = await exchange_client_credentials_token()
transport = StreamableHttpTransport(
    url="https://prefect.fastmcp.app/mcp",
    headers={"Authorization": f"Bearer {token.access_token}"},
)

async with Client(transport) as client:
    print(await client.list_tools())

The token response includes expires_in. Treat an agent as long-running if it may keep using the MCP connection longer than that returned lifetime. In that case, request a new token with the same client credentials before reusing the MCP connection. This follows the OAuth client-credentials pattern: the client credentials are the renewable secret, and the access token is the time-limited bearer credential sent to the MCP server.

Cloud OAuth Deployment Entrypoint

Prefect-operated Cloud OAuth deployments use a dedicated entrypoint:

  • server path: src/prefect_mcp_server/cloud.py
  • required runtime flag: PREFECT_MCP_CLOUD_ENABLED=true

This entrypoint reuses the same read-only tool definitions as the local/API-key server, adds Prefect Cloud OAuth, and adds Cloud OAuth-only workspace discovery. If OAuth is not configured, the Cloud OAuth entrypoint fails at import time instead of starting an unprotected server.

Cloud OAuth mode is selected by deploying src/prefect_mcp_server/cloud.py. The hosted server validates Prefect Cloud-issued MCP OAuth access tokens against Prefect Cloud's JWKS endpoint, so the MCP runtime does not need access to Cloud token-signing secrets.

Cloud OAuth settings use the PREFECT_MCP_CLOUD_ prefix:

Environment variablePurpose
PREFECT_MCP_CLOUD_ENABLEDSet to true for hosted Cloud OAuth mode
PREFECT_MCP_CLOUD_API_BASE_URLOptional override for the Prefect API base URL
PREFECT_MCP_CLOUD_AUTH_BASE_URLOptional override for auth helper endpoints
PREFECT_MCP_CLOUD_AUTH_JWKS_URIOptional override for the Prefect Cloud MCP OAuth JWKS endpoint
PREFECT_MCP_CLOUD_AUTHORIZATION_SERVEROptional override for advertised OAuth authorization server
PREFECT_MCP_CLOUD_AUTH_AUDIENCEOptional override for the expected token audience; defaults to the hosted MCP resource URL (<public base URL>/mcp)
PREFECT_MCP_CLOUD_CLIENT_IDOptional service-account MCP OAuth client id for unattended token exchange
PREFECT_MCP_CLOUD_CLIENT_SECRETOptional service-account MCP OAuth client secret for unattended token exchange
PREFECT_MCP_CLOUD_PUBLIC_BASE_URLPublic base URL for the hosted MCP server
PREFECT_MCP_PUBLIC_BASE_URLLegacy alias for the public base URL

For centrally-hosted deployments where multiple users connect to the same MCP server instance, credentials can be passed via HTTP headers instead of environment variables. This enables each request to authenticate with its own Prefect workspace.

Supported headers:

  • X-Prefect-Api-Url: Prefect API URL, required for both Cloud and self-hosted Prefect
  • X-Prefect-Api-Key: Prefect Cloud API key
  • X-Prefect-Api-Auth-String: basic auth credentials for self-hosted Prefect, formatted as username:password

Claude Code CLI:

bash
claude mcp add-json prefect '{
  "type": "http",
  "url": "https://your-server.fastmcp.app/mcp",
  "headers": {
    "X-Prefect-Api-Url": "https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]",
    "X-Prefect-Api-Key": "your-api-key"
  }
}'

Claude Desktop app:

json
{
  "mcpServers": {
    "prefect": {
      "type": "http",
      "url": "https://your-server.fastmcp.app/mcp",
      "headers": {
        "X-Prefect-Api-Url": "https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]",
        "X-Prefect-Api-Key": "your-api-key"
      }
    }
  }
}

Python with FastMCP client:

python
from fastmcp.client import Client
from fastmcp.client.transports import StreamableHttpTransport

headers = {
    "X-Prefect-Api-Url": "https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]",
    "X-Prefect-Api-Key": "your-api-key",
}

transport = StreamableHttpTransport(
    url="https://your-server.fastmcp.app/mcp",
    headers=headers,
)
client = Client(transport=transport)

async with client:
    result = await client.call_tool("get_identity", {})
    print(result)

[!NOTE] When HTTP headers are provided, they take precedence over environment variables. If no headers are present, the server falls back to the configured environment variables or local Prefect profile.

Other MCP Clients

This MCP server works with any MCP-compatible client. Most local clients use the same stdio command and optional environment variables.

Cursor (.cursor/mcp.json):

json
{
  "mcpServers": {
    "prefect": {
      "command": "uvx",
      "args": ["--from", "prefect-mcp", "prefect-mcp-server"],
      "env": {
        "PREFECT_API_URL": "https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]",
        "PREFECT_API_KEY": "your-api-key"
      }
    }
  }
}

Codex CLI:

bash
codex mcp add prefect -- uvx --from prefect-mcp prefect-mcp-server

codex mcp add prefect \
  --env PREFECT_API_URL=https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID] \
  --env PREFECT_API_KEY=your-api-key \
  -- uvx --from prefect-mcp prefect-mcp-server

Or edit ~/.codex/config.toml directly:

toml
[mcp.prefect]
command = "uvx"
args = ["--from", "prefect-mcp", "prefect-mcp-server"]

[mcp.prefect.env]
PREFECT_API_URL = "https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]"
PREFECT_API_KEY = "your-api-key"

Gemini CLI:

bash
gemini mcp add prefect uvx --from prefect-mcp prefect-mcp-server

gemini mcp add prefect \
  -e PREFECT_API_URL=https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID] \
  -e PREFECT_API_KEY=your-api-key \
  uvx --from prefect-mcp prefect-mcp-server

Or edit ~/.gemini/settings.json directly:

json
{
  "mcpServers": {
    "prefect": {
      "command": "uvx",
      "args": ["--from", "prefect-mcp", "prefect-mcp-server"],
      "env": {
        "PREFECT_API_URL": "https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]",
        "PREFECT_API_KEY": "your-api-key"
      }
    }
  }
}

Kiro (~/.kiro/settings/mcp.json):

json
{
  "mcpServers": {
    "prefect": {
      "command": "uvx",
      "args": ["--from", "prefect-mcp", "prefect-mcp-server"],
      "env": {
        "PREFECT_API_URL": "https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]",
        "PREFECT_API_KEY": "your-api-key"
      }
    }
  }
}

VS Code with GitHub Copilot (.vscode/mcp.json):

json
{
  "servers": {
    "prefect": {
      "command": "uvx",
      "args": ["--from", "prefect-mcp", "prefect-mcp-server"],
      "env": {
        "PREFECT_API_URL": "https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]",
        "PREFECT_API_KEY": "your-api-key"
      }
    }
  }
}

Windsurf (~/.codeium/windsurf/mcp_config.json):

json
{
  "mcpServers": {
    "prefect": {
      "command": "uvx",
      "args": ["--from", "prefect-mcp", "prefect-mcp-server"],
      "env": {
        "PREFECT_API_URL": "https://api.prefect.cloud/api/accounts/[ACCOUNT_ID]/workspaces/[WORKSPACE_ID]",
        "PREFECT_API_KEY": "your-api-key"
      }
    }
  }
}

[!TIP] Most MCP clients follow a similar configuration pattern. If your client is not listed here, check its documentation for MCP server configuration. The command, args, and env values above usually work with minor adjustments to the config format.

Capabilities

This server enables MCP clients to interact with Prefect read-only APIs:

Monitoring and inspection

  • View dashboard overviews with flow run statistics and work pool status
  • Query deployments, flows, flow runs, task runs, work pools, and automations with advanced filtering
  • Retrieve detailed execution logs from flow runs
  • Track events across your workflow ecosystem
  • Review rate limit usage for Prefect Cloud

Documentation access

  • Search current Prefect documentation through the mounted docs MCP server
  • Find current CLI and SDK syntax for write operations
  • Look up deployment, work pool, and automation patterns

Intelligent debugging

  • Get contextual guidance for troubleshooting failed flow runs
  • Diagnose deployment issues, including concurrency problems and unhealthy work pools
  • Identify root causes of workflow failures

Development

bash
# clone the repo
gh repo clone prefecthq/prefect-mcp-server && cd prefect-mcp-server

# install dev deps and pre-commit hooks
just setup

# run tests
just test

Evals

This project includes scenario tests that connect Pydantic AI agents to the MCP server and validate that they can solve realistic Prefect support tasks. See evals/README.md.

Evals should be written like support case reproductions: set up a workspace state that represents a real customer problem, ask the agent the kind of question a user or support engineer would ask, and verify the final answer identifies the concrete cause or next action. Protocol behavior such as OAuth token validation belongs in unit tests; evals should prove that the MCP server helps an agent solve user-facing Prefect problems.

bash
uv run pytest evals

Links


mcp-name: io.github.PrefectHQ/prefect-mcp-server

Installation

TypingMind
{
  "mcpServers": {
    "prefect-mcp-server": {
      "command": "uvx",
      "args": [
        "--from",
        "prefect-mcp",
        "prefect-mcp-server"
      ]
    }
  }
}

Use prefect-mcp-server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once prefect-mcp-server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add prefect-mcp-server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the prefect-mcp-server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "prefect-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the prefect-mcp-server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the prefect-mcp-server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use prefect-mcp-server to help me with this task?
prefect-mcp-server
Sure. I read it.
Here is what I found using prefect-mcp-server.

Option 2: Add an MCP server URL

Use this when prefect-mcp-server is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter https://your-server-name.fastmcp.app/mcp in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste https://your-server-name.fastmcp.app/mcp into the Server URL field.
  2. Enter a connection name for prefect-mcp-server.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the prefect-mcp-server connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the prefect-mcp-server tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the prefect-mcp-server tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use prefect-mcp-server to help me with this task?
prefect-mcp-server
Sure. I read it.
Here is what I found using prefect-mcp-server.

Frequently asked questions

What is the prefect-mcp-server MCP server used for?

prefect-mcp-server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use prefect-mcp-server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use prefect-mcp-server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use prefect-mcp-server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With prefect-mcp-server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect prefect-mcp-server MCP to TypingMind?

prefect-mcp-server can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does prefect-mcp-server MCP provide in TypingMind?

prefect-mcp-server exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use prefect-mcp-server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If prefect-mcp-server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇