Skip to main content

Function: createInProcessCallApi()

createInProcessCallApi(__namedParameters): (request) => Promise<unknown>

Defined in: http-server-mcp-openapi/src/inProcessCallApi.ts:92

A callApi for openApiToTools that serves each tool call against the REST app in this same process, with no socket: validation, authorization and error handling run once, in the routes, for both surfaces.

The MCP request's headers (what createMcpRouter's getApiHeaders produced — typically the caller's Authorization) are forwarded onto the dispatched request. A 2xx answers its body; anything else throws, so the client sees a tool error rather than an error body rendered as a result.

Parameters​

ParameterType
__namedParametersCreateInProcessCallApiArgs

Returns​

(request) => Promise<unknown>

Example​

registerTools({
server,
tools: openApiToTools({ spec, callApi: createInProcessCallApi({ app }) }),
});