A Go application that wraps stdio-based programs and exposes them via HTTP. Originally built to enable remote access to MCP (Model Context Protocol) servers when only stdio transport was available.
- Run MCP servers remotely over HTTP
- Containerize any stdio-based JSON-RPC application
- Add HTTP interface to CLI tools without modifying them
- Bridge legacy stdio protocols to modern HTTP APIs
docker run -p 8222:8222 \
-e CLI_TOOL_COMMAND="npx" \
-e CLI_TOOL_ARGS="-y @modelcontextprotocol/server-memory" \
ghcr.io/kirha-ai/iowrapper:latest# Clone and build
git clone https://github.com/kirha-ai/iowrapper.git
cd iowrapper
go build -o iowrapper cmd/main.go
# Run
export CLI_TOOL_COMMAND="npx"
export CLI_TOOL_ARGS="-y @modelcontextprotocol/server-memory"
./iowrapper server| Environment Variable | Description | Default |
|---|---|---|
CLI_TOOL_COMMAND |
The command to execute | (required) |
CLI_TOOL_ARGS |
Arguments for the command | (empty) |
SERVER_PORT |
HTTP server port | 8222 |
Send JSON-RPC requests to the HTTP endpoint:
curl -X POST http://localhost:8222 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {
"name": "test-client",
"version": "1.0.0"
}
}
}'┌─────────┐ HTTP ┌───────────┐ stdio ┌───────────┐
│ Client │ ──────────> │ IOWrapper │ ──────────> │ MCP Server│
│ │ <────────── │ │ <────────── │ (stdio) │
└─────────┘ └───────────┘ └───────────┘
- IOWrapper starts your program as a child process
- Captures stdin/stdout/stderr pipes
- Exposes an HTTP endpoint for JSON-RPC requests
- Translates HTTP requests to stdin writes
- Reads responses from stdout and returns via HTTP
IOWrapper supports concurrent HTTP requests over a single stdio stream by:
- Assigning internal UUIDs to track each request
- Using a concurrent map to store pending request channels
- Matching responses to requests when they arrive on stdout
docker pull ghcr.io/kirha-ai/iowrapper:latestCreate a Dockerfile to wrap your specific tool:
FROM ghcr.io/kirha-ai/iowrapper:latest
# Install your MCP server or tool
RUN npm install -g @your/mcp-server
ENV CLI_TOOL_COMMAND="your-command"
ENV CLI_TOOL_ARGS="your args here"
EXPOSE 8222When building from source, pass GH_TOKEN for private dependencies:
docker build --build-arg GH_TOKEN=your_token -t iowrapper .├── cmd/ # CLI entry point
├── di/ # Dependency injection
├── internal/
│ ├── adapters/
│ │ ├── executors/ # stdio wrapper implementation
│ │ └── handlers/ # HTTP/JSON-RPC handler
│ ├── applications/ # Business logic
│ └── core/
│ └── ports/ # Interfaces
docker run -p 8222:8222 \
-e CLI_TOOL_COMMAND="npx" \
-e CLI_TOOL_ARGS="-y @modelcontextprotocol/server-memory" \
ghcr.io/kirha-ai/iowrapper:latestdocker run -p 8222:8222 \
-v /path/to/data:/data \
-e CLI_TOOL_COMMAND="npx" \
-e CLI_TOOL_ARGS="-y @modelcontextprotocol/server-filesystem /data" \
ghcr.io/kirha-ai/iowrapper:latest- Go 1.24+
- Wire (for dependency injection)
go build -o iowrapper cmd/main.gocd di && wireMIT
Contributions are welcome! Please open an issue or submit a pull request.