✨ Winx - MCP Server for Shell & Coding Agents ✨
Winx is the MCP server I wanted while running Claude, Codex, and friends against real repos: one process that handles the shell, file IO, and PTY-backed interactive sessions, written in Rust so it doesn't fight you on stdio.
It started as a Rust port of WCGW but isn't a Python wrapper. Everything runs on a
real PTY (via portable-pty), cd actually sticks, Ctrl+C actually interrupts, and background shells survive
long-running TUIs without leaking output buffers into your token budget.
What you get
- A stateful bash session per thread with proper PTY semantics — foreground, background, status checks, text input, Enter/Ctrl-C/Ctrl-D, raw ASCII.
- Workspaces with three modes:
wcgw(full access),architect(read-only),code_writer(allowlist of commands and write globs). - File reads with WCGW-style line ranges (
file.rs:10-40,file.rs:10-,file.rs:-40). - File writes and SEARCH/REPLACE edits that survive ambiguous matches, indentation drift, and the usual unicode quote-mismatches from LLMs.
ContextSavefor handing a task summary plus its files to the next session.ReadImageso multimodal clients can pull screenshots, mockups, error PNGs, etc.
MCP Tools
| Tool | What it does |
|---|---|
Initialize |
Boots the workspace, picks the mode, hands you a thread_id. Call this first or everything else errors out. |
BashCommand |
Runs commands, polls long-running ones, sends Enter/Ctrl-C, drives TUIs. Supports is_background, status_check, send_text, send_specials, send_ascii. |
ReadFiles |
One or many files, with line numbers. Append :10-40 to a path for a range. |
FileWriteOrEdit |
Full overwrites or SEARCH/REPLACE blocks. Refuses to write a file you haven't read yet. |
ContextSave |
Dumps task description + file globs into a single text file for resume/handoff. |
ReadImage |
Base64 + MIME, for clients that can render images. |
Search/Replace editing
Standard block syntax:
<<<<<<< SEARCH
old content
=======
new content
>>>>>>> REPLACE
Things the matcher forgives so you don't have to babysit the model:
- atomic: ambiguous or missing matches abort without touching the file
- adjusts replacement indentation when the LLM gets the leading whitespace wrong
- strips
ReadFilesline numbers if they leak into a SEARCH block - normalizes the usual "smart quote" / em-dash / ellipsis substitutions
- uses neighboring blocks to disambiguate when the same snippet appears twice
- single-line substring edits work — you don't need the whole line in SEARCH
Install
Binary lands in ~/.cargo/bin — every config snippet below assumes that's on $PATH. If your MCP client launches with
a sterile env, swap winx-code-agent for the absolute path (which winx-code-agent).
Needs Rust 1.75+, Linux/macOS/WSL2, and a real terminal (any modern one — Winx spawns its own PTY).
One-liner via the CLI (stdio is the default transport):
Or drop a .mcp.json in your project root:
Add to your config file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows):
Restart Claude Desktop after saving.
One-liner:
Or edit ~/.codex/config.toml:
[]
= "winx-code-agent"
= { = "winx_code_agent=info" }
Add to ~/.cursor/mcp.json (or .cursor/mcp.json for project-local):
Add to .vscode/mcp.json:
Add to your Zed settings (~/.config/zed/settings.json):
Add to ~/.codeium/windsurf/mcp_config.json:
Add to opencode.json:
Add to ~/.gemini/settings.json:
agy is Google's new Gemini-powered CLI (Go binary, usually at ~/.local/bin/agy). No mcp add subcommand yet — it
reads MCP servers from JSON.
Edit ~/.gemini/config/mcp_config.json (also ~/.gemini/antigravity/mcp_config.json if you run the Antigravity IDE
alongside):
If winx-code-agent is not on the agy process $PATH, swap command for the absolute path (~/.cargo/bin/winx-code-agent after cargo install winx-code-agent).
Add to your ~/.continue/config.yaml:
mcpServers:
- name: winx
command: winx-code-agent
env:
RUST_LOG: winx_code_agent=info
Add to ~/.kiro/settings/mcp.json:
Settings → MCP Servers → Add MCP Server:
Add to your Roo Code MCP config:
Any client that speaks stdio MCP works with this shape:
If your client launches Winx with an empty $PATH, swap command for the absolute path (
~/.cargo/bin/winx-code-agent).
For unreleased changes or a custom build:
Or run it without installing:
Check it's wired up
List MCP tools in your client. You should see six entries: Initialize, BashCommand, ReadFiles, FileWriteOrEdit,
ContextSave, ReadImage. The first call always has to be Initialize — Winx tracks workspace + mode per thread.
Hacking on it
CI runs the same three. If you touch src/state/pty.rs or anything in src/tools/bash_command.rs, the regression suite
at tests/bash_pty_regression_test.rs is what protects against the usual TUI/PTY foot-guns — run it first.
A note on security
This is a local MCP server. Anything connected to it can read files, edit files, and run shell commands inside the workspace — same blast radius as letting the model into your terminal.
If you want a tighter leash:
architectmode disables writes and most commands;code_writermode lets you allowlist commands and write globs.
SECURITY.md has the disclosure process and threat model.
License
MIT - Gabriel Maia (@gabrielmaialva33)