Prefect MCP server

Enables interaction with Prefect workflow orchestration platform for retrieving flow information, managing flow runs, searching deployments, and executing workflows directly from conversational interfaces.
Back to servers
Provider
Rusty
Release date
Apr 03, 2025
Language
Python
Package
Stats
1.4K downloads
3 stars

Prefect MCP Server allows you to run a Model Context Protocol server for Prefect workflows. It provides a reliable configuration using the prefect-mcp-server package with uvx as the running mechanism, specifically optimized for the Cursor IDE.

Prerequisites

  • Python 3.9 or newer
  • A virtual environment tool (such as uv)
  • Prefect 3 installed

Installation

Create and activate a virtual environment, then install the Prefect MCP Server:

uv venv --python 3.12 && source .venv/bin/activate
uv pip install -U prefect-mcp-server

Configuration

Configure the server by creating a .cursor/mcp.json file with the following content:

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

This configuration ensures that the server runs with the exact package version installed via uv, providing enhanced reliability in your development environment.

Environment Setup

Set up your Prefect environment by creating a .env file in your project root:

PREFECT_API_URL=http://localhost:4200/api

If you're connecting to Prefect Cloud or a secured Prefect server, you may also need to set:

PREFECT_API_KEY=your-api-key-here

Running the Server

To manually start the server, run:

uv run <script>

When using the Cursor IDE with the proper configuration, the server will automatically start using the command specified in your .cursor/mcp.json file.

Using the Prefect MCP Server

Once running, the Prefect MCP Server provides Model Context Protocol functionality for your Prefect workflows. You can interact with it through the Cursor IDE or any other MCP client.

Connecting to the Server

The server runs locally by default. Your Prefect client should be configured to connect to the API URL specified in your environment variables.

Running Workflows

With the server running, you can create and execute Prefect workflows that leverage the MCP capabilities, allowing for enhanced context-aware automation and intelligence in your workflow executions.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later