MCP Plugin Transport Types in DeepSeek-Reasonix: stdio vs HTTP
DeepSeek-Reasonix supports two MCP plugin transport types—stdio and HTTP—selected via the Spec.Type field to handle JSON-RPC message exchange with external servers.
The internal/plugin package in the esengine/DeepSeek-Reasonix repository implements the MCP (Modular Compute Plugin) client, defining how the application communicates with external MCP servers. Understanding the available MCP plugin transport types is essential for configuring plugin specifications correctly, as each transport determines the underlying protocol for JSON-RPC message exchange.
Understanding MCP Transport Types
A transport in the DeepSeek-Reasonix architecture determines the communication channel for JSON-RPC messages between the client and an external MCP server. The transport layer abstracts the connection mechanism, allowing the plugin system to support different server hosting models through a unified interface defined in internal/plugin/plugin.go.
Supported MCP Plugin Transport Types
The codebase currently implements two distinct transport mechanisms, each suited for different deployment scenarios.
stdio Transport
The stdio transport uses a child process's stdin and stdout streams to exchange JSON-RPC messages. Each request is written as a single line of JSON to the process's standard input, with responses read line-by-line from standard output. This follows the historic "one JSON message per line" convention common in many MCP tools and is ideal for local server binaries or npm scripts. The implementation resides in internal/plugin/transport_stdio.go, where the stdioTransport struct handles process spawning and stream management.
HTTP Transport
The HTTP transport implements the Streamable HTTP specification for remote MCP servers. It sends requests via HTTP POST and handles responses in two formats: plain application/json bodies or Server-Sent Events (SSE) streams (text/event-stream). This transport manages the Mcp-Session-Id header to maintain session continuity across requests. Found in internal/plugin/transport_http.go, the httpTransport struct manages connection pooling and SSE parsing for real-time notifications.
Configuring the Transport Type
Transport selection occurs during plugin initialization through the Spec.Type field, which must contain either "stdio" or "http".
The newTransport function in internal/plugin/plugin.go acts as a factory, instantiating the appropriate implementation based on the specification:
// internal/plugin/plugin.go
func newTransport(spec Spec) (transport, error) {
switch spec.Type {
case "stdio":
return newStdioTransport(spec) // creates a stdioTransport
case "http":
return newHTTPTransport(spec) // creates an httpTransport
default:
return nil, fmt.Errorf("unknown MCP transport %q", spec.Type)
}
}
Example configuration fragments demonstrating valid type declarations:
# stdio transport configuration
type: stdio
command: ./server-binary
# HTTP transport configuration
type: http
url: https://api.example.com/mcp
Transport Interface Implementation
Both transports implement the transport interface defined in the plugin package, requiring three core methods: call for request-response operations, notify for one-way messages, and close for resource cleanup. The stdioTransport manages subprocess lifecycle and line-buffered I/O, while the httpTransport handles HTTP client configuration and SSE stream parsing.
The stdio transport's call method writes marshaled JSON to stdin and reads the response from stdout:
// internal/plugin/transport_stdio.go (excerpt)
func (t *stdioTransport) call(ctx context.Context, method string, params any) (json.RawMessage, error) {
// marshal request, write line to stdin, read matching line from stdout
}
The HTTP transport issues POST requests and manages response parsing:
// internal/plugin/transport_http.go (excerpt)
func (t *httpTransport) call(ctx context.Context, method string, params any) (json.RawMessage, error) {
// marshal request, POST to t.url, handle plain JSON or SSE response
}
Summary
- DeepSeek-Reasonix supports two MCP plugin transport types: stdio for local process communication and HTTP for remote server connectivity.
- The stdio transport in
internal/plugin/transport_stdio.goexchanges JSON-RPC messages via stdin/stdout streams using line-delimited JSON. - The HTTP transport in
internal/plugin/transport_http.goimplements Streamable HTTP with SSE support and session header management. - Transport selection is controlled by the
Spec.Typefield, validated ininternal/plugin/plugin.go'snewTransportfactory function. - Both implementations conform to the
transportinterface requiringcall,notify, andclosemethods.
Frequently Asked Questions
What determines which MCP transport type to use?
Choose the stdio transport when running local binaries or scripts that communicate via standard streams, and the HTTP transport when connecting to remote MCP servers over the network. The HTTP transport supports session persistence via the Mcp-Session-Id header and real-time updates through SSE streams, while stdio is limited to local process boundaries.
Can I implement a custom transport type for DeepSeek-Reasonix?
Yes, you can extend the system by implementing the transport interface with call, notify, and close methods, then registering it in the newTransport function within internal/plugin/plugin.go. The current codebase only includes stdio and HTTP implementations, but the architecture supports additional transport protocols.
How does the HTTP transport handle session management?
The HTTP transport maintains session continuity using the Mcp-Session-Id header, which it extracts from initial responses and includes in subsequent requests. This allows stateful MCP servers to correlate multiple JSON-RPC calls within a single logical session, even when using stateless HTTP as the underlying protocol.
Where is the transport type validated in the source code?
Transport type validation occurs in the newTransport function located in internal/plugin/plugin.go. This factory function uses a switch statement on spec.Type to instantiate either stdioTransport or httpTransport, returning an error if the type string does not match supported values.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →