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 example
mastra.getMCPServer("1.2.0");
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.
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.