mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-11 03:40:05 +00:00
- Rename 20 crate directories lib/crates/arc-* → fabro-* - Update all Cargo.toml: crate names, dep paths, feature flags, bin name - Rename arc_server module → fabro_server in fabro-llm - ArcError → FabroError across 30+ files - ARC_VERSION/ARC_GIT_SHA/ARC_BUILD_DATE → FABRO_* constants - All use/qualified paths: arc_agent:: → fabro_agent::, etc. (~1500 occurrences) - Env vars ARC_* → FABRO_* in string literals and shell scripts - String literals: X-Arc-Demo, arc-bot, arc@local, arc-web, arc-mcp, etc. - Path strings: .arc/ → .fabro/, arc.toml → fabro.toml, refs/arc/ → refs/fabro/ - arc-api.yaml → fabro-api.yaml (OpenAPI spec) - skills/arc-create-workflow → fabro-create-workflow - trycmd fixtures: $ arc → $ fabro - Inline snapshots (insta) updated - CI, Docker, install.sh, scripts, CLAUDE.md, AGENTS.md - TypeScript app: env vars, headers, JWT issuer - Docs: page slugs, git refs, config paths, sandbox names, repo URLs - Repo references: brynary/arc → fabro-sh/fabro Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
77 lines
2.3 KiB
Rust
77 lines
2.3 KiB
Rust
use std::collections::HashMap;
|
|
use std::time::Duration;
|
|
|
|
use fabro_mcp::client::McpClient;
|
|
use fabro_mcp::config::{McpServerConfig, McpTransport};
|
|
use fabro_mcp::connection_manager::call_result_to_string;
|
|
|
|
fn test_server_config() -> McpServerConfig {
|
|
let test_server = format!("{}/tests/test_mcp_server.py", env!("CARGO_MANIFEST_DIR"));
|
|
McpServerConfig {
|
|
name: "test-echo".into(),
|
|
transport: McpTransport::Stdio {
|
|
command: vec!["python3".into(), test_server],
|
|
env: HashMap::new(),
|
|
},
|
|
startup_timeout_secs: 10,
|
|
tool_timeout_secs: 30,
|
|
}
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn stdio_client_initialize_and_list_tools() {
|
|
let config = test_server_config();
|
|
let client = McpClient::new(&config).unwrap();
|
|
client.initialize(config.startup_timeout()).await.unwrap();
|
|
|
|
let tools = client.list_tools().await.unwrap();
|
|
assert_eq!(tools.len(), 1);
|
|
assert_eq!(tools[0].0, "echo");
|
|
assert_eq!(tools[0].1, "Echo back the message");
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn stdio_client_call_tool_echo() {
|
|
let config = test_server_config();
|
|
let client = McpClient::new(&config).unwrap();
|
|
client.initialize(config.startup_timeout()).await.unwrap();
|
|
|
|
let result = client
|
|
.call_tool(
|
|
"echo",
|
|
serde_json::json!({"message": "hello from rust"}),
|
|
Duration::from_secs(10),
|
|
)
|
|
.await
|
|
.unwrap();
|
|
|
|
let text = call_result_to_string(&result).unwrap();
|
|
assert_eq!(text, "hello from rust");
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn connection_manager_stdio_roundtrip() {
|
|
let config = test_server_config();
|
|
let mut mgr = fabro_mcp::connection_manager::McpConnectionManager::new();
|
|
let results = mgr.start_servers(&[config]).await;
|
|
|
|
assert_eq!(results.len(), 1);
|
|
let (name, tool_count) = &results[0];
|
|
assert_eq!(name, "test-echo");
|
|
assert_eq!(*tool_count.as_ref().unwrap(), 1);
|
|
|
|
let tools = mgr.all_tools();
|
|
assert!(tools.contains_key("mcp__test_echo__echo"));
|
|
|
|
let result = mgr
|
|
.call_tool(
|
|
"mcp__test_echo__echo",
|
|
serde_json::json!({"message": "roundtrip"}),
|
|
Duration::from_secs(10),
|
|
)
|
|
.await
|
|
.unwrap();
|
|
|
|
let text = call_result_to_string(&result).unwrap();
|
|
assert_eq!(text, "roundtrip");
|
|
}
|