📚 Improve usage documentation of API type generator script

This commit is contained in:
Dominik Jain
2026-02-06 22:18:02 +01:00
parent 467eb3c333
commit d7282518c4

View File

@@ -1,7 +1,8 @@
# Types Generator
This subproject contains helper scripts used in the development of the
Penpot MCP server for generate the types yaml.
Penpot MCP server, specifically for the generation of a YAML file containing
Penpot plugin API types and their documentation.
## Setup
@@ -12,15 +13,36 @@ Install the environment via (optional, already handled by `build` script)
pixi install
## Running the API Documentation Preparation Script
### Buld API types
The script `prepare_api_docs.py` reads API documentation from the Web
and collects it in a single yaml file, which is then used by an MCP
The script `prepare_api_docs.py` reads API documentation from a Web URL
and collects it in a single YAML file, which is then used by an MCP
tool to provide API documentation to an LLM on demand.
Successful execution will generate the output file `../packages/server/data/api_types.yml`.
### Generating the YAML File for a Given URL
Running the script:
./build <optional-url>
pixi run python prepare_api_docs.py <url>
This will generate `../packages/server/data/api_types.yml`.
You can alternatively run `./build <url>`, which additionally performs pixi environment installation.
For example, to generate the API documentation based on the current PROD Penpot API documentation,
use the URL
https://doc.plugins.penpot.app
### Generating the YAML File Based on the Current Documentation in the Repository
Requirement: [Caddy](https://caddyserver.com/download) must be installed and available in the system path.
To generate the API documentation based on the current documentation in the repository,
run the `build:types` script in the parent directory, i.e.
cd ..
pnpm run build:types
This will spawn a local HTTP server on port 9090 and run the `prepare_api_docs.py` script with the
URL `http://localhost:9090`.