> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # Mastra.getMCPServer() `.getMCPServer()` メソッドは、レジストリキー(`mcpServers` 設定で Server を登録したときのキー)で MCP Server インスタンスを取得します。Server 自体の `id` プロパティで取得するには、代わりに `.getMCPServerById()` を使用します。 ## 使用例 ```typescript // Register an MCP server with a registry key const myServer = new MCPServer({ id: 'my-mcp-server', name: 'My Server', version: '1.0.0', tools: {/* ... */}, }) export const mastra = new Mastra({ mcpServers: { customKey: myServer, // 'customKey' is the registry key }, }) // Retrieve by registry key const server = mastra.getMCPServer('customKey') // Alternatively, retrieve by intrinsic ID const serverById = mastra.getMCPServerById('my-mcp-server') ``` ## パラメータ **registryKey** (`string`): mcpServers 設定オブジェクトで MCP Server を登録したときに使用したレジストリキー。Server 自体の id プロパティではなく、キーと値の組における設定キーです。 ## 戻り値 **server** (`MCPServerBase | undefined`): 指定したレジストリキーの MCP Server インスタンス。見つからない場合は undefined。 ## 関連メソッド - [Mastra.getMCPServerById()](https://mastra.zisheng.pro/ja/reference/core/getMCPServerById): Server 自体の `id` プロパティで MCP Server を取得 - [Mastra.listMCPServers()](https://mastra.zisheng.pro/ja/reference/core/listMCPServers): 登録済みのすべての MCP Server を一覧表示 ## 関連情報 - [MCP の概要](https://mastra.zisheng.pro/ja/docs/mcp/overview) - [MCP Server リファレンス](https://mastra.zisheng.pro/ja/reference/tools/mcp-server)