# Interface MCPTransport

All Known Implementing Classes:
  `MCPLoopbackSocketTransport`

public interface MCPTransport

A bidirectional line delimited transport for MCP JSON-RPC messages.

The MCP stdio transport frames messages as newline delimited JSON, one complete JSON-RPC object per line with no embedded newlines. Implementations therefore exchange whole message strings and never deal with partial frames.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Closes the transport and releases any underlying resources.
  `void`
  `open()`
  Opens the transport, blocking until it is ready to exchange messages.
  `String`
  `readMessage()`
  Reads the next complete JSON-RPC message.
  `void`
  `writeMessage(String message)`
  Writes a complete JSON-RPC message and flushes it.

- ## Method Details

  - ### open

    void open() throws IOException
    Opens the transport, blocking until it is ready to exchange messages. For a socket transport this waits for the first client connection.
    Throws:
      `IOException`

  - ### readMessage

    String readMessage() throws IOException
    Reads the next complete JSON-RPC message. Returns null at end of stream.
    Throws:
      `IOException`

  - ### writeMessage

    void writeMessage(String message) throws IOException
    Writes a complete JSON-RPC message and flushes it. The value must not contain embedded newlines.
    Throws:
      `IOException`

  - ### close

    void close()
    Closes the transport and releases any underlying resources.