Windmill MCP
Windmill supports the Model Context Protocol (MCP), an open standard that lets LLM clients call tools.
With MCP, you can connect an external client (like Claude, ChatGPT, Cursor, or any MCP compatible client) to Windmill and work in your workspace from its chat.
Windmill can also be the client rather than the server: an AI session chat calls the tools of the external MCP servers you connect to it from its assistant settings. The rest of this page covers the other direction, where an external client drives your Windmill workspace.
Two ways to connect
The server at /api/mcp works in one of two ways, chosen with the access at sign-in, on the token, or by the admin for your own identity provider:
- As an AI session (Build and run, Read and run, Read only): the client gets Windmill's own tools to explore the workspace, write scripts, flows and full-code apps as your drafts, test-run, diff and deploy them, run what is deployed and read its runs.
- As your scripts and flows (Scripts and flows as tools): each selected script or flow is one typed tool, and the client gets nothing else.
Pick an AI session to build and operate the workspace from your AI client, and scripts and flows as tools to share a few automations with an agent.
Connect with Claude
From the Claude Connectors Directory
The easiest way to connect Windmill to Claude is through the Claude Connectors Directory:
- Go to the Connectors Directory and search for Windmill
- Click Connect and log in to your Windmill account
- Choose the workspaces and the access to give Claude
- Start working in your workspace from Claude
As a custom connector
You can also add Windmill manually as a custom connector:
- Go to Claude > Settings > Connectors
- Click "Add custom connector"
- Name it "Windmill" and set the URL to:
https://app.windmill.dev/api/mcp
For self-hosted instances, replace the URL with your own instance base URL (e.g. https://windmill.example.com/api/mcp).
- When redirected to Windmill, choose the workspaces and the access to give Claude
- Click Approve to complete the connection
If your instance signs MCP clients in through your own identity provider, steps 4 and 5 happen at your provider, and the admin's settings decide the workspace and access.
Connect with ChatGPT
From the ChatGPT app directory
On Windmill Cloud, connect from the ChatGPT app directory:
- In ChatGPT, open Apps and search for Windmill
- Click Connect and log in to your Windmill account
- Choose the workspaces and the access to give ChatGPT
- Click Approve, then ask ChatGPT about your scripts, flows, apps and runs
Self-hosted instances
The Windmill app in the ChatGPT directory connects to Windmill Cloud (app.windmill.dev).
To connect your own instance, add it to ChatGPT as a custom app:
- In ChatGPT, open Settings > Apps > Advanced settings and turn on Developer mode
- Click Create app, name it "Windmill" and set the MCP server URL to your instance base URL followed by
/api/mcp:
https://windmill.example.com/api/mcp
- Choose OAuth as the authentication
- When redirected to Windmill, log in, choose the workspaces and the access to give ChatGPT, and click Approve
If your instance signs MCP clients in through your own identity provider, step 4 happens at your provider, and the admin's settings decide the workspace and access.
ChatGPT connects to your instance from OpenAI's servers, so the instance must be reachable from the internet over HTTPS.
How to use
Authentication
| Method | How |
|---|---|
| OAuth sign-in (recommended) | Add the bare URL <base_url>/api/mcp. The client opens Windmill to sign in and approve. See Connect with OAuth |
| Token in the URL | <base_url>/api/mcp?token=<token>. See Generate your MCP token and URL |
| Token in a header | The bare URL, with an Authorization: Bearer <token> header |
| Your identity provider (Enterprise Edition) | The bare URL. The client signs in at the OpenID Connect provider configured on the instance and sends its access token in an Authorization: Bearer header. See Sign in with your own identity provider |
Superadmins can refuse tokens in URLs.
Connect with OAuth
Windmill's MCP server has one URL:
<base_url>/api/mcp
(e.g. https://app.windmill.dev/api/mcp for Windmill Cloud, or your own instance URL for self-hosted)
Add it to your client as a remote MCP server. The client opens a Windmill page where you sign in, choose the workspaces it may work in and its access, then approve. With your own identity provider set up, a new client signs you in there instead.
The URL is also shown, ready to copy, in the "Build and run from your AI client" section of your account settings and in the MCP tab of the home page's connect drawer.
Access levels
The access decides which tools the client gets:
| Access | What the client gets |
|---|---|
| Build and run (default) | The whole toolset: explore, write drafts, test-run, diff, deploy, run deployed scripts, flows and AI agents, and read runs |
| Read and run | The read tools, plus running deployed scripts, flows and AI agents |
| Read only | The read tools. Nothing is run or changed |
| Scripts and flows as tools | Each selected script or flow as its own typed tool, and nothing else |
The tools of each level are listed under "Tools the client gets" when you choose it.
When creating a token through the API, Build and run is the scope mcp:all, Read and run mcp:all mcp:read_run, and Read only mcp:all mcp:read_only.
Scripts and flows as tools is mcp:runnables_as_tools plus the selection: mcp:favorites, or mcp:scripts:<paths> and mcp:flows:<paths>, comma-separated, where a folder is f/<folder>/* and everything is *.
mcp:hub:<integrations> adds the Hub scripts of those integrations.
Every tool call acts as you, so your permissions apply: a tool you cannot use, such as changing workspace settings when you are not an admin, is listed but refused. The guidance the client receives follows your access and, with Build and run, your role in the workspace and whether its protection rulesets let you deploy, so it does not plan work Windmill would refuse. With Read and run, the client changes nothing itself, but the scripts and flows it runs can.
In a workspace with a Disable direct deployment rule, Build and run works as Read and run for everyone, admins included: that workspace takes its changes from a dev workspace or a fork.
With "Scripts and flows as tools", the client cannot explore the workspace, read runs, build, or run anything outside the selection. It needs a single workspace. When configuring it, you can select favorites, several folders, or individual scripts and flows. A tool call waits for the run's result, and the run is canceled if the client disconnects or the wait times out: expose a long-running flow as a short tool that returns its run id with an early return, next to a tool that reads its status.
How the client works
The client works as an AI session does, with these differences:
- There is no preview panel: tools return links to the run, the draft's editor or the deployed item.
- Scripts, flows, apps, schedules, triggers, resources and variables are written as your drafts until deployed. Folders, resource types, workspace settings and datatable changes apply directly.
- Tools that run code, cancel a run, deploy, delete, overwrite a draft or change live data are marked as destructive, so clients that confirm such calls ask you first. There is no confirmation card.
- There is no question card, and your personal instructions are not applied.
Cards in the conversation
Clients that support MCP Apps, such as Claude and ChatGPT, can also show you results as interactive cards in the chat:
| Tool | What the card shows |
|---|---|
show_run | A run, refreshing until it finishes: status, result, logs, inputs and, for a flow, its steps, with a Cancel run button while it runs |
show_runs | Up to 20 runs as a table |
show_deploy_review | Up to 10 drafts with their diff against the deployed version, and a Deploy button |
show_item | A script, flow, schedule, trigger, resource, app or saved AI agent, with links to its editor and its page |
Expand a card to see it fullscreen. On a client without fullscreen, the card links to the page in Windmill.
The deploy review and Cancel run are the only actions a card takes. To deploy, open the deploy review in fullscreen, check the drafts to deploy and click Deploy. If a draft was edited after the card was shown, it is not deployed and the card shows its new diff. The deploy review and the Cancel run button need Build and run access.
Generate your MCP token and URL
Instead of signing in, a client can use a token:
- Open your account settings in Windmill.
- In the "Build and run from your AI client" section, expand "Use a token instead of signing in".
- Choose the workspaces and the access, then click Generate URL with token.
The generated URL looks like this:
<base_url>/api/mcp?token=<your-token>
(e.g. https://app.windmill.dev/api/mcp?token=abc123)
Save this URL securely. Treat it like an API key: anyone with access can act in your workspace as you, within the token's access.
A token's access can be changed later from the token list.
Workspaces
When signing in or creating a token, pick the workspaces the client may work in: one, several, or all of yours, including ones you join later, or, with superadmin rights, all workspaces of the instance, including ones created later.
Every AI session tool takes a workspace_id naming the workspace it acts in, and list_workspaces lists the ones the client may use.
Requests to any other workspace are refused.
Superadmin rights
A superadmin can give an MCP token their superadmin rights with the Superadmin rights toggle under Access, wherever you create an MCP token: account settings, the home page's connect drawer, or the OAuth consent page.
The token then reaches every workspace of the instance, including ones created later, as admin, within its access; without it, only the workspaces you are a member of.
Through the API, it is the super_admin field of POST /api/users/tokens/create, which a scoped token cannot set.
The rights end when you stop being a superadmin.
Refuse tokens in MCP URLs
A token in a URL ends up in browser history and proxy logs.
Superadmins can make the MCP endpoints refuse a ?token= query parameter with the Disable token in MCP URLs instance setting.
Clients then use the bare MCP URL and sign in through OAuth, or send the token in an Authorization: Bearer <token> header.
With the setting on, account settings no longer offer to create a token for a URL.
Sign in with your own identity provider
On Enterprise Edition, MCP clients can sign their users in at your organization's OpenID Connect provider (Keycloak, Okta, Entra, Auth0...) instead of at Windmill. Clients then discover your provider as their authorization server and sign users in there, without a Windmill page to choose workspaces or access: the admin sets each client's access in the setting below. A client already registered with Windmill can still sign in through Windmill. Tokens issued by Windmill, including those from Windmill sign-ins, stay valid.
Register each MCP client (Claude, ChatGPT, Cursor...) as an OAuth client at your provider, with the redirect URI the MCP client uses and the openid profile email scopes allowed.
If the MCP client relies on dynamic client registration, your provider must allow it.
Superadmins then set it up in the instance settings, under Authentication > SSO > MCP external identity provider:
- Issuer: your provider's issuer URL, over HTTPS (HTTP only on
localhostor127.0.0.1). Windmill must be able to reach its OIDC discovery document. - Audience: recommended. The
audyour provider puts in access tokens for Windmill. Without it, only tokens marked as access tokens are accepted. - Client claim: the claim naming the OAuth client. Defaults to
azp; usecidon Okta, orclient_idon RFC 9068 servers. - User email claim: defaults to
email. - MCP clients: for each OAuth client registered at your provider, its client id, the one workspace it works in, and its access.
Each request acts as the Windmill user with the token's email, within the client's access. That user must already be an active member of the client's workspace, for instance by signing in once through SSO or through SCIM. Otherwise the request is refused, as it is for a user deactivated in Windmill, a token with no user (client credentials), or an email your provider marks unverified.
When the SSO groups claim is set, membership in the instance groups linked to your provider comes from the token, so a group change applies at the user's next token. Roles stay as stored. On Entra, limit the groups claim to the groups assigned to the client: a token that leaves out the claim because the user has too many groups is refused.
Runs started this way record the client, and their steps read its id as the WM_MCP_CLIENT contextual variable.
Tool calls, and tokens refused for their client or user, are written to the audit logs with both the client and the user.
Connect your LLM to Windmill
Most LLM agents and interfaces support MCP as a plug-and-play integration. The Windmill MCP server uses HTTP streamable as the transport layer, and MCP clients should be configured to use that protocol. For example, with Cursor and Claude Code:
To connect with Cursor:
- Go to Cursor > Settings > MCP Tools
- Click on "Add a Custom MCP server"
- Add the following configuration in the json file:
{
"mcpServers": {
"windmill-mcp": {
"url": "<base_url>/api/mcp"
}
}
}
To connect with Claude Code:
- Use the Claude Code CLI to add the Windmill MCP server:
claude mcp add --transport http windmill <base_url>/api/mcp
- Run
/mcpin Claude Code, select windmill and choose Authenticate: the Windmill sign-in page opens in your browser.
If you created a token, send it in a header instead of signing in:
claude mcp add --transport http windmill <base_url>/api/mcp --header "Authorization: Bearer <token>"
The header keeps the token out of URLs, which end up in logs.
The ?token= URL also works.
Legacy MCP URLs
The legacy URLs (<base_url>/api/mcp/w/<workspace-id>/mcp, its /sse variant and <base_url>/api/mcp/gateway) still work; the UI shows only /api/mcp.
Tokens created for them keep the API endpoint tools they were created with.
Protocol versions
The server speaks every MCP revision from 2024-11-05 to 2026-07-28; there is nothing to configure.
Tool list updates
With Scripts and flows as tools, the server sends notifications/tools/list_changed when a script or flow of the workspace is added, updated, moved, archived or deleted, so a new script shows up as a tool in the same conversation.
Notifications require a client on protocol 2026-07-28 or later: older clients see new tools the next time they list them.
Changes made outside the MCP tools (the UI, the CLI, git sync, another user) can take up to 30 seconds to be announced.
The other access levels have a fixed tool list, so they receive no notifications: the client finds new scripts and flows with its exploration tools.
Example: Building and deploying a script
Once your MCP server is connected with Build and run, in Claude you could type:
"Write a script that sends a welcome email to a new user, test it with user@example.com, and deploy it to f/onboarding/send_welcome_email"
Claude will read the guidance for writing scripts, write the script as your draft, test-run it, and deploy it, returning links to the run and to the deployed script.
Example: Running a flow and checking its status
You can also trigger flows and follow their runs:
"Run the 'daily_data_sync' flow with the parameter region set to 'us-east-1'"
Claude finds the flow, runs it and returns a link to the run. You can then follow up:
"Did it succeed? Show me the logs of the failed step."
Reading the caller's request headers
A script or flow exposed as its own MCP tool can read the HTTP headers of the request that invoked it, through a preprocessor. This is how a multi-user MCP server learns who is on the other end.
The model's tool arguments arrive as event.body, and the request's headers as event.headers, a key the model never fills, so an identity read from a header cannot be forged by prompt injection.
There is nothing to configure: a runnable with a preprocessor receives the request the way a webhook or HTTP route one does, and a runnable without one receives only what the model sent, unchanged.
- TypeScript
- Python
export async function preprocessor(event: {
kind: "mcp";
body: Record<string, any>; // the arguments the model sent
headers: Record<string, string>;
tool_name: string; // the MCP tool that was called
}) {
const caller = event.headers["x-user-id"];
if (!caller) {
// the header is missing, rather than defaulting to an anonymous caller
throw new Error("missing x-user-id header");
}
// the header wins: it comes after the model's arguments, not before
return { ...event.body, caller };
}
export async function main(caller: string /*, the tool's own parameters */) {
// your code here
}
from typing import TypedDict, Literal
class McpEvent(TypedDict):
kind: Literal["mcp"]
body: dict # the arguments the model sent
headers: dict[str, str]
tool_name: str # the MCP tool that was called
def preprocessor(event: McpEvent):
caller = event["headers"].get("x-user-id")
if not caller:
# the header is missing, rather than defaulting to an anonymous caller
raise ValueError("missing x-user-id header")
# the header wins: it comes after the model's arguments, not before
return {**event["body"], "caller": caller}
def main(caller: str): # plus the tool's own parameters
# your code here
Header names are lowercase, as they appear on the wire (x-user-id, not X-User-Id).
Unlike webhooks, there is no include_header list to set: every header of the request is in event.headers, except authorization, cookie and proxy-authorization, which are withheld.
Which tools deliver headers
Only the per-script and per-flow tools of a Scripts and flows as tools token.
run_script, run_flow, runScriptByPath and runFlowByPath start the run through a second request, so its preprocessor does not see the caller's headers.
Which tool the model picks is its own choice, so a preprocessor relying on a header should treat a missing one as an error rather than defaulting.
A preprocessor also runs only on a triggered run: a scheduled run or a preview calls main directly with the arguments it is given.
Where a runnable relies on an identity read from its headers, scope the token to the scripts and flows it needs.
Troubleshooting
- Not seeing any scripts/flows?
- Ensure your LLM tool is connected to the correct MCP URL.
- With Scripts and flows as tools set to favorites, make sure the script or flow is in your favorites.
- My LLM does not find the correct script/flow to run
- Ensure the script or flow is deployed and visible in your workspace.
- Choose good titles and descriptions to help the LLM find the correct script/flow.
- A script or flow I just deployed doesn't show up as a tool
- Reconnect the MCP server in your client to re-list the tools, or see tool list updates for when clients refresh on their own.
- Client has issues connecting to the MCP server
- Make sure your MCP client is configured to use HTTP streamable as the transport protocol.
- Verify that your MCP URL is correct and the token is valid.
- If the client gets a
401saying the instance does not accept a token in the MCP URL, remove?token=and sign in through OAuth. - If the client reports error
-32022, it asked for a protocol revision the server does not serve; the error payload lists the ones it does.
Learn more
- MCP official docs
- MCP compatible clients
- Windmill Privacy Policy
- Support & Community: join our Discord or open an issue on GitHub