Remove unused --nc flag and nc crate (#55962)

The `nc` crate and `zed --nc <socket>` flag were added in #34577 to let
the Claude Code integration spawn the running zed binary as a
netcat-style bridge between stdio and a Unix socket for its MCP server.

That integration was removed in #37120 in favor of the external
`@agentclientprotocol/claude-agent-acp` npm package, which dropped the
only caller of `--nc`. The flag, its dispatch in `main.rs`, and the `nc`
crate itself were left behind and have been unused since.

Nothing in the Zed codebase spawns `zed --nc` anymore, so remove the
flag and delete the crate. The unrelated `--askpass` netcat bridge (in
the `askpass` crate) is unaffected.

Release Notes:

- N/A
This commit is contained in:
Agus Zubiaga 2026-05-29 05:16:05 -03:00 committed by GitHub
parent a3669a29e6
commit ef5da3ccc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 0 additions and 102 deletions

View file

@ -181,7 +181,6 @@
/crates/fs_benchmarks/ @zed-industries/infrastructure-team
/crates/http_client/ @zed-industries/infrastructure-team
/crates/http_client_tls/ @zed-industries/infrastructure-team
/crates/nc/ @zed-industries/infrastructure-team
/crates/net/ @zed-industries/infrastructure-team
/crates/paths/ @zed-industries/infrastructure-team
/crates/release_channel/ @zed-industries/infrastructure-team

11
Cargo.lock generated
View file

@ -11725,16 +11725,6 @@ dependencies = [
"uuid",
]
[[package]]
name = "nc"
version = "0.1.0"
dependencies = [
"anyhow",
"futures 0.3.32",
"net",
"smol",
]
[[package]]
name = "ndk"
version = "0.9.0"
@ -23598,7 +23588,6 @@ dependencies = [
"migrator",
"mimalloc",
"miniprofiler_ui",
"nc",
"node_runtime",
"notifications",
"onboarding",

View file

@ -137,7 +137,6 @@ members = [
"crates/miniprofiler_ui",
"crates/mistral",
"crates/multi_buffer",
"crates/nc",
"crates/net",
"crates/node_runtime",
"crates/notifications",
@ -399,7 +398,6 @@ migrator = { path = "crates/migrator" }
mistral = { path = "crates/mistral" }
multi_buffer = { path = "crates/multi_buffer" }
miniprofiler_ui = { path = "crates/miniprofiler_ui" }
nc = { path = "crates/nc" }
net = { path = "crates/net" }
node_runtime = { path = "crates/node_runtime" }
notifications = { path = "crates/notifications" }

View file

@ -1,19 +0,0 @@
[package]
name = "nc"
version = "0.1.0"
edition.workspace = true
publish.workspace = true
license = "GPL-3.0-or-later"
[lints]
workspace = true
[lib]
path = "src/nc.rs"
doctest = false
[dependencies]
anyhow.workspace = true
futures.workspace = true
net.workspace = true
smol.workspace = true

View file

@ -1 +0,0 @@
../../LICENSE-GPL

View file

@ -1,51 +0,0 @@
use anyhow::Result;
#[cfg(windows)]
pub fn main(_socket: &str) -> Result<()> {
// It looks like we can't get an async stdio stream on Windows from smol.
panic!("--nc isn't yet supported on Windows");
}
/// The main function for when Zed is running in netcat mode
#[cfg(not(windows))]
pub fn main(socket: &str) -> Result<()> {
use futures::{AsyncReadExt as _, AsyncWriteExt as _, FutureExt as _, io::BufReader, select};
use net::async_net::UnixStream;
use smol::{Unblock, io::AsyncBufReadExt};
smol::block_on(async {
let socket_stream = UnixStream::connect(socket).await?;
let (socket_read, mut socket_write) = socket_stream.split();
let mut socket_reader = BufReader::new(socket_read);
let mut stdout = Unblock::new(std::io::stdout());
let stdin = Unblock::new(std::io::stdin());
let mut stdin_reader = BufReader::new(stdin);
let mut socket_line = Vec::new();
let mut stdin_line = Vec::new();
loop {
select! {
bytes_read = socket_reader.read_until(b'\n', &mut socket_line).fuse() => {
if bytes_read? == 0 {
break
}
stdout.write_all(&socket_line).await?;
stdout.flush().await?;
socket_line.clear();
}
bytes_read = stdin_reader.read_until(b'\n', &mut stdin_line).fuse() => {
if bytes_read? == 0 {
break
}
socket_write.write_all(&stdin_line).await?;
socket_write.flush().await?;
stdin_line.clear();
}
}
}
anyhow::Ok(())
})
}

View file

@ -156,7 +156,6 @@ menu.workspace = true
migrator.workspace = true
miniprofiler_ui.workspace = true
mimalloc = { version = "0.1", optional = true }
nc.workspace = true
node_runtime.workspace = true
notifications.workspace = true
onboarding.workspace = true

View file

@ -244,17 +244,6 @@ fn main() {
return;
}
// `zed --nc` Makes zed operate in nc/netcat mode for use with MCP
if let Some(socket) = &args.nc {
match nc::main(socket) {
Ok(()) => return,
Err(err) => {
eprintln!("Error: {}", err);
process::exit(1);
}
}
}
#[cfg(all(not(debug_assertions), target_os = "windows"))]
unsafe {
use windows::Win32::System::Console::{ATTACH_PARENT_PROCESS, AttachConsole};
@ -1831,11 +1820,6 @@ struct Args {
#[arg(long)]
system_specs: bool,
/// Used for the MCP Server, to remove the need for netcat as a dependency,
/// by having Zed act like netcat communicating over a Unix socket.
#[arg(long, hide = true)]
nc: Option<String>,
/// Used for recording minidumps on crashes by having Zed run a separate
/// process communicating over a socket.
#[arg(long, hide = true)]