Files
windmill/backend/generate_mcp_endpoints_tools
centdix 03eb16a7c6 feat(mcp): add endpoint tools for scripts, flows, apps, and jobs (#7859)
* add endpoints

* feat: add MCP tools for script/flow/app CRUD and run endpoints with field filtering

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: convert enum arrays to description text in MCP tool schemas

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: auto-detect and rename conflicting parameter names across MCP tool schemas

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: use two-pass approach in convert_enums_to_descriptions to preserve dict ordering

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: add MCP instructions to createScript, runScriptByPath, and runFlowByPath

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: add query param exclusion for MCP tools, slim down run endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: preserve additional top-level keys in allOf schema flattening

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor: replace x-mcp-tool-exclude-query-params with x-mcp-tool-include-query-params

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: replace empty {} schemas with valid JSON Schema draft 2020-12 equivalents

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: revert openapi value:{} changes, sanitize empty schemas in generator instead

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
2026-02-10 11:30:39 +00:00
..

MCP Tools Generator

The generate_mcp_tools.py script parses the OpenAPI specification and generates Rust code for MCP (Model Context Protocol) tools.

Setup

cd backend/generate_mcp_endpoints_tools
pip install -r requirements.txt

Usage

python3 generate_mcp_tools.py

The script will:

  1. Parse backend/windmill-api/openapi.yaml
  2. Find all endpoints marked with x-mcp-tool: true
  3. Generate backend/windmill-api/src/mcp_tools.rs with a const array of tools

Adding MCP Tools

To mark an endpoint as an MCP tool, add x-mcp-tool: true to the operation in the OpenAPI spec. You can also add x-mcp-instructions to complete the description of the tool with instructions on how to correctly use the endpoint:

/w/{workspace}/scripts/list:
  get:
    x-mcp-tool: true
    x-mcp-instructions: you should call that with this or that arg
    summary: list scripts in workspace
    operationId: listScripts
    # ... rest of endpoint definition