diff --git a/terminator-cli/src/main.rs b/terminator-cli/src/main.rs index 4d51168c..cb9ca21e 100644 --- a/terminator-cli/src/main.rs +++ b/terminator-cli/src/main.rs @@ -1323,9 +1323,13 @@ async fn run_workflow(transport: mcp_client::Transport, args: McpRunArgs) -> any info!("Executing workflow with {steps_count} steps via MCP"); - // For local files, use file:// URL to avoid verbose logging - let workflow_str = if resolved_type == InputType::File { - info!("Using file:// URL for local file"); + // Check if we're using a remote HTTP transport + let is_remote_http = matches!(transport, mcp_client::Transport::Http(_)); + + // For local files with stdio transport, use file:// URL to avoid verbose logging + // For remote HTTP transport, send the workflow content directly + let workflow_str = if resolved_type == InputType::File && !is_remote_http { + info!("Using file:// URL for local file with stdio transport"); // Convert to absolute path and create file:// URL let abs_path = std::fs::canonicalize(&args.input) @@ -1621,9 +1625,13 @@ async fn run_workflow_once( } } + // Check if we're using a remote HTTP transport + let is_remote_http = matches!(transport, mcp_client::Transport::Http(_)); + // For cron jobs, use simple execution to avoid connection spam - // For local files, use file:// URL to avoid verbose logging - let workflow_str = if resolved_type == InputType::File { + // For local files with stdio transport, use file:// URL to avoid verbose logging + // For remote HTTP transport, send the workflow content directly + let workflow_str = if resolved_type == InputType::File && !is_remote_http { // Convert to absolute path and create file:// URL let abs_path = std::fs::canonicalize(&args.input) .with_context(|| format!("Failed to resolve path: {}", args.input))?; diff --git a/terminator-mcp-agent/src/server_sequence.rs b/terminator-mcp-agent/src/server_sequence.rs index 0d50837e..1da0c525 100644 --- a/terminator-mcp-agent/src/server_sequence.rs +++ b/terminator-mcp-agent/src/server_sequence.rs @@ -144,8 +144,8 @@ impl DesktopWrapper { if let Some(url) = &args.url { info!("Fetching workflow from URL: {}", url); - let workflow_content = if url.starts_with("file://") { - // Handle local file URLs + let workflow_content = if url.starts_with("file://") || (!url.starts_with("http://") && !url.starts_with("https://")) { + // Handle local file URLs and plain file paths let file_path = url.strip_prefix("file://").unwrap_or(url); info!("Reading file from path: {}", file_path); @@ -188,8 +188,10 @@ impl DesktopWrapper { ) })? } else { + // This branch should never be reached due to the condition above, + // but kept for safety return Err(McpError::invalid_params( - "URL must start with http://, https://, or file://".to_string(), + "URL must be a file path, file:// URL, or http(s):// URL".to_string(), Some(json!({"url": url})), )); }; diff --git a/terminator-mcp-agent/src/utils.rs b/terminator-mcp-agent/src/utils.rs index d2232be6..31b6558f 100644 --- a/terminator-mcp-agent/src/utils.rs +++ b/terminator-mcp-agent/src/utils.rs @@ -788,7 +788,7 @@ pub struct SequenceStep { #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, Default, JsonSchema)] pub struct ExecuteSequenceArgs { #[schemars( - description = "Optional URL to fetch workflow definition from (HTTP/HTTPS or file:// supported)." + description = "Optional URL or file path to fetch workflow definition from. Supports: plain file paths (e.g., 'workflow.yml'), file:// URLs, and HTTP/HTTPS URLs." )] pub url: Option, #[schemars(