Skip to main content
Mastra v1 is coming in January 2026. Get ahead by starting new projects with the beta or upgrade your existing project today.

Mastra.getServer()

The .getServer() method is used to retrieve the server configuration that has been configured in the Mastra instance.

Usage exampleDirect link to Usage example

mastra.getServer();

ParametersDirect link to Parameters

This method does not accept any parameters.

ReturnsDirect link to Returns

server:

ServerConfig | undefined
The configured server configuration including port, timeout, API routes, middleware, CORS settings, and build options, or undefined if no server has been configured.

On this page