---
title: "Reference: Mastra.getServer() | Core"
description: "Documentation for the `Mastra.getServer()` method in Mastra, which retrieves the configured server configuration."
packages:
  - "@mastra/core"
---

# Mastra.getServer()

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

## Usage example

```typescript
mastra.getServer();
```

## Parameters

This method does not accept any parameters.

## Returns

<PropertiesTable
  content={[
    {
      name: "server",
      type: "ServerConfig | undefined",
      description:
        "The configured server configuration including port, host, studioBase, timeout, API routes, middleware, CORS settings, and build options, or undefined if no server has been configured.",
    },
  ]}
/>

## Related

- [Server deployment](/docs/v1/deployment/mastra-server)
- [Server configuration](/docs/v1/server/custom-api-routes)
