Skip to main content

Experimental_StdioMCPTransport

还没翻译译自英文(ai-sdk.dev)本页 7 段都还没译

Creates a transport for Model Context Protocol (MCP) clients to communicate with MCP servers using standard input and output streams. This transport is only supported in Node.js environments.

This feature is experimental and may change or be removed in the future.

Import

import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio"

API Signature

Parameters

  • config (StdioConfig): Configuration for the MCP client.
    • StdioConfig
      • command (string): The command to run the MCP server.
      • args? (string[]): The arguments to pass to the MCP server.
      • env? (Record<string, string>): The environment variables to set for the MCP server.
      • stderr? (IOType | Stream | number): The stream to write the MCP server's stderr to.
      • cwd? (string): The current working directory for the MCP server.