feat(#2038): streamable-http mcp transport for hyperhive server
This commit is contained in:
parent
621ee66133
commit
ecba548787
4 changed files with 103 additions and 5 deletions
|
|
@ -40,10 +40,18 @@ enum Cmd {
|
|||
#[arg(long, default_value_t = 1000)]
|
||||
poll_ms: u64,
|
||||
},
|
||||
/// Run the MCP server on stdio. Spawned by `claude` via
|
||||
/// Run the MCP server. Default is stdio — spawned by `claude` via
|
||||
/// `--mcp-config`; tools dispatch through `/run/hive/mcp.sock` back
|
||||
/// into the hyperhive broker.
|
||||
Mcp,
|
||||
/// into the hyperhive broker. Pass `--http <addr>` to instead run a
|
||||
/// long-lived streamable-http listener (persistent daemon) that
|
||||
/// claude reconnects to each turn, avoiding the per-turn stdio
|
||||
/// re-registration race.
|
||||
Mcp {
|
||||
/// Serve over streamable-http on this address (e.g.
|
||||
/// `127.0.0.1:8790`) instead of stdio. Bind loopback only.
|
||||
#[arg(long)]
|
||||
http: Option<std::net::SocketAddr>,
|
||||
},
|
||||
/// Inject a wake-up event into this harness's inbox so the next
|
||||
/// turn fires with the given body. Intended for extra MCP servers
|
||||
/// / helpers (matrix bridge, scraper, webhook listener, etc.) that
|
||||
|
|
@ -70,7 +78,10 @@ async fn main() -> Result<()> {
|
|||
|
||||
match cli.cmd {
|
||||
Cmd::Serve { poll_ms } => serve_main::<AgentSurface>(&cli.socket, poll_ms).await,
|
||||
Cmd::Mcp => mcp::serve_agent_stdio(cli.socket).await,
|
||||
Cmd::Mcp { http } => match http {
|
||||
Some(addr) => mcp::serve_http(cli.socket, addr).await,
|
||||
None => mcp::serve_agent_stdio(cli.socket).await,
|
||||
},
|
||||
Cmd::Wake { from, body } => wake::<AgentSurface>(&cli.socket, from, body).await,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue