Skip to main content

Mastra.getMCPServer()

The .getMCPServer() method is used to retrieve a specific MCP server instance by its logical ID and optional version. If a version is provided, it attempts to find the server with that exact logical ID and version. If no version is provided, it returns the server with the specified logical ID that has the most recent releaseDate.

Usage exampleDirect link to Usage example

mastra.getMCPServer("1.2.0");

ParametersDirect link to Parameters

serverId:

string
The logical ID of the MCP server to retrieve. Should match the `id` property of the MCPServer instance.

version:

string
Optional specific version of the MCP server to retrieve. If not provided, returns the server with the most recent releaseDate.

ReturnsDirect link to Returns

server:

MCPServerBase | undefined
The MCP server instance with the specified ID and version, or undefined if not found or if the specific version is not found.

On this page