Applied AI School
v0 · 規劃中
AnthropicOpenAI

stdio transport

用標準輸入輸出傳輸 MCP 訊息,最常見的本機 server 模式。

概念

stdio transport 把 MCP server 當成一個子程序(subprocess)。Host 透過:

  • stdin → 把請求送進去
  • stdout → 接收回應
  • stderr → 接收 log

訊息以 JSON-RPC 格式逐行傳遞。

適用情境

  • 本機工具(檔案系統、Git、shell command)
  • 開發中的快速原型
  • 不需要網路權限的 server

範例設定

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["@modelcontextprotocol/server-filesystem", "/Users/me/docs"]
    }
  }
}

(mock 內容)