refactor(#2112): remove the dead stdio transport from hive-agent-mcp
This commit is contained in:
parent
1ba44b77ac
commit
4745274fca
3 changed files with 19 additions and 39 deletions
|
|
@ -1,12 +1,13 @@
|
|||
//! Embedded MCP server. Claude Code (running inside the agent container)
|
||||
//! launches this as a stdio child via `--mcp-config`; tool calls land here
|
||||
//! and are translated to `AgentRequest::*` / `ManagerRequest::*` against
|
||||
//! hyperhive's own per-container unix socket at `/run/hive/mcp.sock`.
|
||||
//! connects to this over streamable-HTTP via `--mcp-config` (the long-lived
|
||||
//! `hive-mcp-http` daemon); tool calls land here and are translated to
|
||||
//! `AgentRequest::*` / `ManagerRequest::*` against hyperhive's own
|
||||
//! per-container unix socket at `/run/hive/mcp.sock`.
|
||||
//!
|
||||
//! Two protocols, two surfaces:
|
||||
//! - **hyperhive socket** at `/run/hive/mcp.sock` — JSON-line, our
|
||||
//! broker-routed protocol. Unaffected by this module.
|
||||
//! - **MCP stdio** owned by this module — what claude actually speaks.
|
||||
//! - **MCP over HTTP** owned by this module — what claude actually speaks.
|
||||
//!
|
||||
//! One `AgentServer { socket }` struct for all roles.
|
||||
//! Tool access is gated upstream by `--allowedTools` (derived from the
|
||||
|
|
@ -17,10 +18,7 @@ use std::future::Future;
|
|||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::Result;
|
||||
use rmcp::{
|
||||
ServerHandler, ServiceExt, handler::server::wrapper::Parameters, tool, tool_handler,
|
||||
tool_router, transport::stdio,
|
||||
};
|
||||
use rmcp::{ServerHandler, handler::server::wrapper::Parameters, tool, tool_handler, tool_router};
|
||||
|
||||
use crate::client;
|
||||
|
||||
|
|
@ -1011,24 +1009,10 @@ impl AgentServer {
|
|||
)]
|
||||
impl ServerHandler for AgentServer {}
|
||||
|
||||
/// Run the MCP server over stdio. Used by all roles. Returns when the client
|
||||
/// disconnects.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns an error if the MCP server fails to initialize or the transport
|
||||
/// encounters a fatal error.
|
||||
pub async fn serve_agent_stdio(socket: PathBuf) -> Result<()> {
|
||||
let server = AgentServer::new(socket);
|
||||
let service = server.serve(stdio()).await?;
|
||||
service.waiting().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Run the MCP server over HTTP (rmcp streamable-http transport) on `addr`.
|
||||
///
|
||||
/// Unlike [`serve_agent_stdio`] — a fresh stdio child claude respawns every turn —
|
||||
/// this is meant to run as a long-lived in-container daemon. claude reconnects
|
||||
/// This is the sole transport for the built-in hyperhive surface. It runs as a
|
||||
/// long-lived in-container daemon. claude reconnects
|
||||
/// to the stable URL each turn instead of respawning and re-registering a stdio
|
||||
/// subprocess, which removes the per-turn MCP registration race that can strand
|
||||
/// an agent when the async `initialize`/`tools/list` loses to claude's first
|
||||
|
|
|
|||
Loading…
Reference in a new issue