|
Entropic 2.3.8
Local-first agentic inference engine
|
entropic mcp-bridge — stdio↔unix-socket relay for MCP.
More...
#include <poll.h>#include <sys/socket.h>#include <sys/un.h>#include <unistd.h>#include <cerrno>#include <cstdio>#include <cstring>#include <filesystem>#include <string>
Go to the source code of this file.
Namespaces | |
| namespace | entropic |
| Activate model on GPU (WARM → ACTIVE). | |
Functions | |
| std::filesystem::path | entropic::compute_socket_path (const std::filesystem::path &project_dir) |
| Compute project-unique Unix socket path for self-detection. | |
| int | entropic::cli::run_mcp_bridge (int argc, char *argv[]) |
Entry point for the mcp-bridge subcommand. | |
entropic mcp-bridge — stdio↔unix-socket relay for MCP.
Pure protocol adapter. Connects to a running engine's external MCP unix socket and shuttles JSON-RPC 2.0 bytes between the local stdio pair (read from an MCP client like Claude Code) and the socket pair (read by the engine's ExternalBridge). The bridge:
compute_socket_path used by the engine), so .mcp.json consumers do not have to know the path.The relay is byte-transparent: it does not parse JSON-RPC at all, so server-initiated progress notifications, streaming, and out-of-order responses all pass through unmodified. Both sides use newline-framed messages (the wire convention established by the engine's ExternalBridge).
Usage in .mcp.json:
An engine must already be running for the same project directory (TUI, consumer app, or a future headless server). The bridge is an optional service on top of that engine — never a substitute for it.
\n-terminated frames; the relay merely shuttles bytes in order.poll(2) loop handles both directions independently, so server-initiated frames (notifications/progress, streaming partial results, etc.) reach the client even when no request is in flight. The pre-2.1.7 mcp-connect did synchronous request→response and would have stalled server-pushed frames.initialize / notifications/initialized handshake**: the bridge is transparent — the handshake occurs end-to-end between the MCP client and the engine, exactly as the spec describes.shutdown / exit**: handled by the engine's dispatch. On stdin EOF (client went away) the bridge half-closes the socket write side via shutdown(SHUT_WR), which the engine's serve_client observes as an empty read and uses to tear down the per-client thread cleanly.ExternalBridge::dispatch.Definition in file mcp_bridge.cpp.
| int entropic::cli::run_mcp_bridge | ( | int | argc, |
| char * | argv[] | ||
| ) |
Entry point for the mcp-bridge subcommand.
Resolves the project dir, computes the engine's unix socket path via the same deterministic hash the engine uses, connects, then relays bytes between stdio and the socket until either side closes.
| argc | Argument count (after the "mcp-bridge" subcommand). |
| argv | Argument vector. argv[0] is "mcp-bridge". |
Definition at line 275 of file mcp_bridge.cpp.