API reference
generateTools
Code
generateTools(document: OpenApiDocument): GeneratedTool[]Compiles explicitly enabled operations into deterministic descriptors. Unsupported enabled operations fail the build.
buildRequest
TypeScript
buildRequest(tool: GeneratedTool, input: Record<string, unknown>, origin: string): RequestValidates input and constructs the path, query, and optional JSON body described by the operation.
createWebMcpCompanion
TypeScript
createWebMcpCompanion(options: {
document: OpenApiDocument;
renderPage: () => Response | Promise<Response>;
dispatch: (request: Request, tool: GeneratedTool) => Response | Promise<Response>;
prepareWrite?: (request: Request, tool: GeneratedTool, input: Record<string, unknown>) => Response | Promise<Response>;
basePath?: string;
resultSelector?: string;
maxInputBytes?: number;
}): WebMcpCompanionProvides the page, manifest, bootstrap, and call routes. If any generated tool changes data, prepareWrite is required.
Routes
| Route | Purpose |
|---|---|
GET /__mulder/ | Return your page and add the bootstrap. |
GET /__mulder/manifest | List browser-visible tools. |
GET /__mulder/bootstrap.js | Register tools in a supported browser. |
POST /__mulder/call/:name | Validate and route one call. |
injectWebMcpBootstrap
TypeScript
injectWebMcpBootstrap(response: Response, bootstrapPath: string): Promise<Response>generateStaticWebMcp
Code
generateStaticWebMcp(document: OpenApiDocument, options: {
apiOrigin: string;
maxResponseBytes?: number;
resultSelector?: string;
}): { manifest: string; bootstrap: string }Emits build-time files for a static site. It accepts public GET operations only, requires a credential-free HTTPS origin, omits browser credentials, rejects redirects, requires JSON, and bounds response size.
Supported OpenAPI subset
- OpenAPI 3.1 with inline schemas.
- Enabled GET operations with scalar path and query parameters.
- Enabled POST operations with one
application/jsonbody. - Enabled DELETE operations without a body.
- Bounded object and array schemas inside POST bodies.
- String, boolean, integer, and number constraints.
POST and DELETE require both x-webmcp-enabled: true and x-webmcp-approval-required: true.
Rejected
- PUT and PATCH.
- Header and cookie parameters.
- References, combined schemas, and undeclared object properties.
- Unsupported URL styles, media types, and unmatched path templates.