refactor(#2455): split hive-agent-mcp into its own bin crate

This commit is contained in:
damocles 2026-07-14 23:45:33 +02:00
commit e7f8254788
15 changed files with 334 additions and 100 deletions

View file

@ -1,40 +0,0 @@
//! MCP-server binary for the built-in hyperhive surface. Runs a long-lived
//! streamable-http listener (the `hive-mcp-http` systemd unit) on `--http
//! <addr>`; tools dispatch through `/run/hive/mcp.sock` back into the
//! hyperhive broker. claude reconnects to the stable URL each turn via
//! `--mcp-config`, avoiding the per-turn re-registration race. HTTP is the
//! sole transport — there is no stdio mode. Sibling of `hive-agent` (the
//! serve loop that renders the `--mcp-config` blob pointing here) and
//! `hive-agent-wake`.
use std::path::PathBuf;
use anyhow::Result;
use clap::Parser;
use hive_ag3nt::{DEFAULT_SOCKET, mcp};
#[derive(Parser)]
#[command(name = "hive-agent-mcp", about = "hyperhive MCP server")]
struct Cli {
/// Path to the per-agent MCP socket (bind-mounted from the host).
#[arg(long, default_value = DEFAULT_SOCKET)]
socket: PathBuf,
/// Serve streamable-http on this address (e.g. `127.0.0.1:8790`).
/// Bind loopback only.
#[arg(long)]
http: std::net::SocketAddr,
}
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")),
)
.init();
let cli = Cli::parse();
mcp::serve_http(cli.socket, cli.http).await
}