此頁面尚未翻譯為您的語言,目前顯示英文版本。
MCP Transports
Moraya supports three transport mechanisms for MCP server communication.
stdio Transport
The stdio transport spawns a child process and communicates via stdin/stdout. This is managed by the Rust backend (MCPProcessManager).
# Example: Connect to a local MCP server
Command: npx @modelcontextprotocol/server-filesystem
Args: /path/to/workspace
- Best for local command-line MCP tools
- Process lifecycle managed by Moraya
- Communication via JSON-RPC over stdin/stdout
SSE Transport (Server-Sent Events)
The SSE transport connects to a remote server via EventSource for receiving messages and POST requests for sending.
# Example SSE endpoint
URL: http://localhost:3001/sse
- Best for long-running remote servers
- Server pushes events via SSE stream
- Client sends requests via HTTP POST
HTTP Transport
The HTTP transport uses stateless JSON-RPC POST requests for both directions.
# Example HTTP endpoint
URL: http://localhost:3002/mcp
- Simplest transport — standard HTTP POST
- Stateless, no persistent connection
- Good for serverless/cloud functions