Skip to main content

Mastra.getMCPServers()

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

Usage example​

mastra.getMCPServers();

Parameters​

This method does not accept any parameters.

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