MCPcopy Create free account
hub / github.com/dallay/agentsync / test_server_to_json_stdio

Function test_server_to_json_stdio

src/mcp.rs:2389–2409  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2387
2388 #[test]
2389 fn test_server_to_json_stdio() {
2390 let server = McpServerConfig {
2391 command: Some("npx".to_string()),
2392 args: vec!["-y".to_string(), "server".to_string()],
2393 env: BTreeMap::from([("DEBUG".to_string(), "true".to_string())]),
2394 url: None,
2395 headers: BTreeMap::new(),
2396 transport_type: Some("stdio".to_string()),
2397 disabled: false,
2398 };
2399
2400 let json = server_to_json(&server);
2401
2402 assert_eq!(json.get("command").unwrap().as_str().unwrap(), "npx");
2403 assert!(json.get("args").unwrap().as_array().is_some());
2404 assert!(json.get("env").unwrap().as_object().is_some());
2405 assert_eq!(json.get("type").unwrap().as_str().unwrap(), "stdio");
2406 // Empty fields should not be present
2407 assert!(json.get("url").is_none());
2408 assert!(json.get("headers").is_none());
2409 }
2410
2411 #[test]
2412 fn test_server_to_json_http() {

Callers

nothing calls this directly

Calls 1

server_to_jsonFunction · 0.85

Tested by

no test coverage detected