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.getMCPServers()

The .getMCPServers() method is used to retrieve all MCP server instances that have been registered in the Mastra instance.

Usage exampleDirect link to Usage example

mastra.getMCPServers();

ParametersDirect link to Parameters

This method does not accept any parameters.

ReturnsDirect link to Returns

servers:

Record<string, MCPServerBase> | undefined
A record of all registered MCP server instances, where keys are server IDs and values are MCPServerBase instances, or undefined if no servers are registered.

On this page