Skip to content

Conversation

@bolinfest
Copy link
Collaborator

@bolinfest bolinfest commented Oct 19, 2025

Today, we offer two transport mechanisms for an MCP server: stdio and HTTP.

I have been experimenting with a third, which is UNIX domain socket, because it has the advantages that:

  • The UDS can be attached to long-running process, like an HTTP server.
  • The UDS can leverage UNIX file permissions to restrict access.

To make it easier to get started with this approach, this introduces an experimental subcommand codex stdio-to-uds that provides an adapter between a UDS and stdio. The idea is that someone could start an MCP server that communicates over /tmp/mcp.sock. Then the user could specify this on the fly like so:

codex --config mcp_servers.example={command="codex",args=["stdio-to-uds","/tmp/mcp.sock"]}

If this approach becomes popular, we could support it directly in our config:

[mcp_servers.example]
# The presence of this property would imply that
# we launch the LSP using `codex stdio-to-uds`.
unix_domain_socket = "/tmp/mcp.sock"

Unfortunately, the Rust standard library does not provide support for UNIX domain sockets on Windows today even though support was added in October 2018 in Windows 10:

rust-lang/rust#56533

To address this, this PR pulls in https://crates.io/crates/uds_windows as a dependency on Windows.

stdio-to-uds/tests/stdio_to_uds.rs is a simple integration test to verify this works on all of our supported platforms.

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 3 to 6
use std::io;
use std::io::Read;
use std::io::Write;
use std::net::Shutdown;
use std::os::unix::net::UnixStream;
use std::path::Path;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Guard stdio-to-uds crate for non-Unix builds

The new stdio-to-uds implementation imports std::os::unix::net::UnixStream unconditionally and the CLI always builds this crate. On Windows, the std::os::unix module is absent, so adding this module to the workspace will cause cargo build for the CLI to fail even if the subcommand is never used. Other platform-specific code paths in the repo use #[cfg] guards; similar gating or a stub implementation is needed here to keep non-Unix builds compiling.

Useful? React with 👍 / 👎.

@bolinfest bolinfest force-pushed the pr5350 branch 3 times, most recently from c744eec to cdd7b30 Compare October 19, 2025 19:42
@bolinfest
Copy link
Collaborator Author

@codex review pls

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bolinfest bolinfest requested review from gpeal and pakrym-oai October 19, 2025 19:57
Copy link
Collaborator

@gpeal gpeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A README for this crate would probably be useful if you expect this to stick around

@bolinfest
Copy link
Collaborator Author

@gpeal good call: I adapted the PR body so it is suitable for the README

@bolinfest bolinfest merged commit d01f91e into main Oct 20, 2025
40 checks passed
@bolinfest bolinfest deleted the pr5350 branch October 20, 2025 04:12
@github-actions github-actions bot locked and limited conversation to collaborators Oct 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants