use serde::Serialize;
use crate::output::CliReport;
use crate::output::human::{Human, Table};
#[derive(Serialize)]
pub struct McpRegistryRow {
pub name: String,
pub version: String,
pub install: String,
pub description: String,
}
#[derive(Serialize)]
pub struct McpRegistryReport {
pub servers: Vec<McpRegistryRow>,
pub from_cache: bool,
}
impl CliReport for McpRegistryReport {
fn render(&self, h: &mut Human<'_>) -> std::io::Result<()> {
let mut t = Table::new(["NAME", "VERSION", "INSTALL", "DESCRIPTION"]);
for s in &self.servers {
t.push([
s.name.clone(),
s.version.clone(),
s.install.clone(),
s.description.clone(),
]);
}
h.table(&t)?;
h.line("")?;
h.line(" add a server with: bitrouter mcp add <name>")?;
Ok(())
}
}
#[derive(Serialize)]
pub struct McpAddReport {
pub name: String,
pub id: String,
pub yaml: String,
}
impl CliReport for McpAddReport {
fn render(&self, h: &mut Human<'_>) -> std::io::Result<()> {
for line in self.yaml.lines() {
h.line(line)?;
}
Ok(())
}
}