Skip to main content

standing

Function standing 

Source
pub fn standing(root: &Path, config: &str) -> McpClientStanding
Expand description

Where a client configuration stands: read from the file, never from a list of who is expected to be wired.

use majordomus_cli::capability::builtin::mcp::{standing, McpClientStanding};
let dir = std::env::temp_dir().join(format!("mj-mcp-standing-{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
assert_eq!(standing(&dir, ".mcp.json"), McpClientStanding::Absent);
std::fs::write(dir.join(".mcp.json"), r#"{"mcpServers":{"other":{"command":"x"}}}"#).unwrap();
assert_eq!(standing(&dir, ".mcp.json"), McpClientStanding::Foreign);
std::fs::write(dir.join(".mcp.json"), r#"{"mcpServers":{"majordomus":{"command":"bin/majordomus-mcp"}}}"#).unwrap();
assert_eq!(standing(&dir, ".mcp.json"), McpClientStanding::Wired);
std::fs::remove_dir_all(&dir).unwrap();