serveStaticFiles
Serve static files (HTML, CSS, JS, images) from a local directory. Includes path
traversal protection, MIME type detection, and security headers
(Cache-Control, X-Content-Type-Options).
This method is useful for serving a web frontend alongside your agents — for example, an admin dashboard or a configuration UI.
Parameters
directory
Path to the directory containing static files. Can be absolute or relative
(resolved via path.resolve() at registration time).
route
URL path prefix for static files.
Returns
void
Example
With this configuration:
Path traversal attempts (e.g., /../etc/passwd) are blocked. The resolved file path
must remain within the configured static directory.