Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and the project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added (`termherd mcp-proxy` for Antigravity and non-`--mcp-config` CLIs)

- Added the `termherd mcp-proxy` subcommand, a stdio-to-HTTP bridge that reads
`TERMHERD_MCP_CONFIG` (exported into every agent session's PTY environment,
pointing at the per-session `0600` config file) and forwards JSON-RPC to the
parent instance's live bridge. Registering `termherd mcp-proxy` once in `agy`
gives Antigravity sessions launched from TermHerd all live workspace tools;
outside TermHerd, it serves `settings.json` tools with explicit `initialize`
instructions explaining why the live tools are unavailable.

### Changed (a polished chrome)

- A sidebar title takes the whole row at rest, the room its hidden buttons
Expand Down
7 changes: 7 additions & 0 deletions crates/app/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ pub(crate) enum Command {
Gui,
/// Print the `mcpServers` snippet for the running instance, then exit.
McpConfig,
/// Run a stdio-to-HTTP MCP proxy to the parent session's live bridge.
McpProxy,
}

/// The subcommand that asks the running instance for its bridge config.
const MCP_CONFIG: &str = "mcp-config";

/// The subcommand that proxies stdio MCP traffic to the session's live bridge.
const MCP_PROXY: &str = "mcp-proxy";

/// Read the command out of `args`, which is the raw `std::env::args` including
/// the program name.
///
Expand All @@ -37,6 +42,7 @@ const MCP_CONFIG: &str = "mcp-config";
pub(crate) fn parse<I: IntoIterator<Item = String>>(args: I) -> Command {
match args.into_iter().nth(1).as_deref() {
Some(MCP_CONFIG) => Command::McpConfig,
Some(MCP_PROXY) => Command::McpProxy,
_ => Command::Gui,
}
}
Expand Down Expand Up @@ -97,6 +103,7 @@ mod tests {
#[test]
fn the_subcommand_is_recognised_and_nothing_else_is() {
assert_eq!(parse(argv(&[MCP_CONFIG])), Command::McpConfig);
assert_eq!(parse(argv(&[MCP_PROXY])), Command::McpProxy);
assert_eq!(parse(argv(&[])), Command::Gui);
}

Expand Down
20 changes: 17 additions & 3 deletions crates/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mod log_file;
#[cfg(target_os = "macos")]
mod macos;
mod mcp;
mod mcp_proxy;
mod metadata_store;
mod paths;
mod providers;
Expand Down Expand Up @@ -49,9 +50,22 @@ fn main() -> iced::Result {
// that would disturb it: the single-instance lock below exits(2) on a second
// process, which is the wrong answer to `termherd mcp-config`. Nor does it
// open the log file, which could rotate the running instance's log.
if cli::parse(std::env::args()) == cli::Command::McpConfig {
tracing_init::init_tracing(None);
return report_mcp_config(data_dir.as_ref());
match cli::parse(std::env::args()) {
cli::Command::McpConfig => {
tracing_init::init_tracing(None);
return report_mcp_config(data_dir.as_ref());
}
cli::Command::McpProxy => {
let config_path = paths::mcp_config_path();
let settings_file = data_dir.as_ref().map(settings::path);
if let Err(err) = mcp_proxy::run(config_path.as_deref(), settings_file.as_deref()) {
use std::io::Write;
let _ = writeln!(std::io::stderr(), "termherd mcp-proxy: {err}");
std::process::exit(1);
}
return Ok(());
}
cli::Command::Gui => {}
}

tracing_init::init_tracing(log_file::path(data_dir.as_ref()).as_deref());
Expand Down
Loading