transport
transport
¶
MCP transport implementations.
Classes¶
MCPTransport
¶
Bases: ABC
Abstract transport layer for MCP communication.
Functions¶
send
abstractmethod
¶
send(request: MCPRequest) -> MCPResponse
send_notification
¶
send_notification(request: MCPRequest) -> None
Send a JSON-RPC notification (no response expected).
The default implementation delegates to :meth:send and discards the
response. Transports may override this when the server returns no
body for notifications (e.g. HTTP 202 Accepted).
Source code in src/openjarvis/mcp/transport.py
InProcessTransport
¶
InProcessTransport(server: MCPServer)
Bases: MCPTransport
Direct in-process transport for testing.
Routes requests directly to an MCPServer instance without
serialization overhead.
Source code in src/openjarvis/mcp/transport.py
Functions¶
send
¶
send(request: MCPRequest) -> MCPResponse
StdioTransport
¶
Bases: MCPTransport
JSON-RPC over stdin/stdout subprocess transport.
Launches a subprocess and communicates via JSON lines on stdin/stdout.
Source code in src/openjarvis/mcp/transport.py
Functions¶
send
¶
send(request: MCPRequest) -> MCPResponse
Write request as JSON line, read response line.
Source code in src/openjarvis/mcp/transport.py
StreamableHTTPTransport
¶
Bases: MCPTransport
MCP Streamable HTTP transport (JSON-RPC over HTTP).
Uses a persistent httpx.Client session, tracks the
Mcp-Session-Id header, and sends the Accept header
required by the MCP Streamable HTTP specification.
Source code in src/openjarvis/mcp/transport.py
Functions¶
send
¶
send(request: MCPRequest) -> MCPResponse
Send request via HTTP POST following the MCP Streamable HTTP spec.
Handles both application/json and text/event-stream responses
as allowed by the MCP Streamable HTTP specification.
Source code in src/openjarvis/mcp/transport.py
send_notification
¶
send_notification(request: MCPRequest) -> None
Send a notification — accept any 2xx, don't parse the body.