Purpose
Winx is a remote-first MCP runtime for AI coding agents that need a real shell, guarded file-editing primitives, repository-aware code navigation, and sessions that survive connection drops. Its primary deployment path is a hardened Streamable HTTP endpoint for ChatGPT and other cloud or web MCP clients; stdio is also fully supported for local clients such as Claude Code, Codex CLI, Cursor, and VS Code.
Key Capabilities
- Persistent sessions: HTTP is stateless from the client's perspective, but the PTY lives in a per-session guardian and can be resumed with the same thread_id.
- Identity-aware isolation: one token per principal; thread IDs and MCP Task IDs are scoped internally and converted back before responses leave the server. Workspace affinity absorbs unstable model-generated thread IDs.
- On-demand tool catalogs: full, coding, read-only, and terminal profiles are available, or a per-principal exact allowlist, reducing discovery/schema payload and rejecting calls without equivalent effective permissions.
- A single mutation tool: EditFiles performs create, edit, batch, patch, verify, and undo through one typed plan/commit engine, eliminating overlapping selections while preserving read evidence, canonical path binding, atomic writes, receipts, and recovery.
- Fail-closed network defaults: loopback-only binding, minimum 32-byte tokens, chmod-600 token files, DNS rebinding host checks, request body/time/concurrency limits, per-IP rate limiting, and delayed invalid-auth responses.
- Agent-native terminal semantics: foreground and background commands, status polling, interactive input, stable TUI snapshots, turn detection, real exit codes, and bounded output.
- Repository tools, not just a shell: a guarded edit protocol, multi-file planning, undo, token-budgeted reads, image input, context handoff, and tree-sitter symbol navigation.
Usage
Remote MCP Quick Start
Connect the MCP client to:
https://<your-host>/mcp
Cloud clients need a reachable HTTPS endpoint. Keep Winx on loopback and put a private MCP tunnel, VPN, or authenticated HTTPS reverse proxy in front. For OpenAI products, Secure MCP Tunnel keeps Winx private while exposing an OpenAI-hosted MCP endpoint.
Installation
cargo install winx-code-agent
On all platforms, this installs winx-code-agent, winxd, and winx-guardian together into ~/.cargo/bin (%USERPROFILE%.cargo\bin on Windows). Keep the three binaries together: the adapter automatically starts winxd, which starts one guardian per shell session.
Requires Rust 1.88+, bash, and a real terminal. Runs on Linux, macOS, WSL2, and native Windows 10/11 when the persistent daemon is running (named pipes under %LOCALAPPDATA%\winx\run, job objects for shell trees, no WSL involved). On native Windows, the shell is Git for Windows' bash.exe.
Transport selection
- Streamable HTTP: primary deployment path, for remote MCP clients. Binds to loopback by default, requires a strong bearer token, limits request size/rate/concurrency, and isolates sessions and MCP Tasks between authenticated principals.
- stdio: reserved for local tools such as Claude Code, Codex CLI, Cursor, VS Code.
Workspace modes
- wcgw: full access.
- architect: read-only.
- code_writer: allowlist for commands and write globs. The command allowlist is parsed with tree-sitter, so every command on the line is checked—pipelines, && / || / ;, command substitution, subshells—not just the first word, and cannot be bypassed via ls && curl … | sh or ls $(rm …).
File reading
Supports WCGW-style line ranges: file.rs:10-40, file.rs:10-, file.rs:-40. Active files are tracked and prioritized in repository context across calls.
EditFiles
A public EditFiles tool for replacement, SEARCH/REPLACE, revision-bound line patches, atomic batching, validationand undo. All modes share canonical path preflight, read/freshness evidence, bounded planning, per-file atomic replacement, compact diffs, typed recovery, and receipt-bound verification. A failed plan writes nothing. Rare mid-commit I/O failures stop immediately and report the committed prefix instead of pretending the whole batch rolled back.
Code navigation
tree-sitter code navigation via CodeMap: token-budgeted symbol maps of a file or an entire repository, or definition/reference lookup by symbol name — a semantic view that plain grep cannot provide, covering 13 languages.
Context handoff
ContextSave for handing a task summary and its files to the next session — including workspace context, active files, git status/diff, and terminal sharing, so it can be resumed correctly. On resume it reopens the saved project root, and the restored memory is token-capped so it never overflows the context window.
Image input
ReadImage lets multimodal clients pull verified JPEG/PNG/GIF/WebP content. Oversized images are resized and recompressed before base64 expansion, and unchanged duplicate content becomes a compact reference unless the caller explicitly requests fresh delivery.
Output handling
Clean, token-aware shell output: cursor/ANSI noise from interactive programs (REPLs, progress bars) is rendered away by a terminal emulator, and mechanical repetition is losslessly folded (line [winx: ×N]), so build/install logs do not exhaust the context budget. Folding can be toggled with WINX_NO_COMPRESS. When output still exceeds the cap, the discarded head is streamed to a temporary file under .winx/scratch/ that the agent can reread, rather than being lost.
Security
Secret redaction is on by default: provider API keys, JWTs, PEM private key blocks, and user:pass@ URLs are scrubbed from all tool output and saved memory before reaching the model (can be disabled with WINX_NO_REDACT=1). An optional Landlock sandbox (WINX_SANDBOX=1, Linux) adds a kernel-enforced second layer that restricts writes to the workspace and hides the home directory.
When to use
- Remote AI coding agents that need a real shell and persistent sessions.
- A local coding client that needs protected file editing and repository-aware code navigation.
- Multi-step development workflows that need to hand off task context to the next session.
- Multimodal coding agents that need image input.
Limitations
- Requires Rust 1.88+, bash, and a real terminal.
- Persistent daemon runtime supports Linux, macOS, WSL2, and native Windows 10/11; on native Windows the shell is Git for Windows' bash.exe.
- Remote HTTP deployment requires a reachable HTTPS endpoint, and a private MCP tunnel, VPN, or authenticated HTTPS reverse proxy is recommended.
- File tools have caps on temporary storage: 256 MiB per workspace, 64 MiB and 128 files per session, and 32 MiB per helper; inactive managed session directories are cleaned up after 24 hours.
- When an active session reaches 96 files or 48 MiB, Winx removes only helpers that have been inactive for the full 24-hour TTL until there is enough headroom (trending toward 64 files / 32 MiB); new helpers are never automatically removed.
- Sessions that exceed the budget block ordinary commands until the agent explicitly checks and removes the remaining stale helpers.
- This targeted guard is a supplement to the separately selected command policy, not a general-purpose shell sandbox.
- MCP Task is optional on BashCommand and applies only to foreground commands; it requires an explicit thread_id, and do not combine a protocol-level task object with is_background=true.
- Automatic Roots bootstrapping is disabled on shared HTTP services, so one remote client cannot silently select another client's workspace.