pub struct WorkflowServer { /* private fields */ }Expand description
Built-in MCP server for executing OxiFY workflows
This server exposes workflows as MCP tools, allowing external clients like Claude Desktop to invoke workflow executions.
§Features
- Auto-generates tool schemas from workflow metadata
- Supports custom input schemas per workflow
- Configurable tool naming prefix
- Thread-safe workflow registration
§Example
ⓘ
use oxify_mcp::servers::WorkflowServer;
use oxify_model::Workflow;
let server = WorkflowServer::new();
server.register_workflow(my_workflow).await;
// Server can now be used via MCP protocol
let tools = server.list_tools().await?;Implementations§
Source§impl WorkflowServer
impl WorkflowServer
Sourcepub fn with_config(config: WorkflowServerConfig) -> Self
pub fn with_config(config: WorkflowServerConfig) -> Self
Create a new workflow server with custom configuration
Sourcepub fn with_executor(self, executor: WorkflowExecutor) -> Self
pub fn with_executor(self, executor: WorkflowExecutor) -> Self
Set the workflow executor function
The executor is called when a workflow tool is invoked. It receives the workflow definition and input variables.
Sourcepub async fn register_workflow(&self, workflow: Workflow) -> Result<String>
pub async fn register_workflow(&self, workflow: Workflow) -> Result<String>
Register a workflow as an MCP tool
Sourcepub async fn register_workflow_with_schema(
&self,
workflow: Workflow,
input_schema: Value,
description: Option<String>,
) -> Result<String>
pub async fn register_workflow_with_schema( &self, workflow: Workflow, input_schema: Value, description: Option<String>, ) -> Result<String>
Register a workflow with custom schema
Sourcepub async fn unregister_workflow(&self, tool_name: &str) -> Result<()>
pub async fn unregister_workflow(&self, tool_name: &str) -> Result<()>
Unregister a workflow
Sourcepub async fn list_registered_tools(&self) -> Vec<String>
pub async fn list_registered_tools(&self) -> Vec<String>
Get list of registered tool names
Sourcepub async fn get_workflow(&self, tool_name: &str) -> Option<Workflow>
pub async fn get_workflow(&self, tool_name: &str) -> Option<Workflow>
Get workflow by tool name
Trait Implementations§
Source§impl Default for WorkflowServer
impl Default for WorkflowServer
Source§impl McpServer for WorkflowServer
impl McpServer for WorkflowServer
Auto Trait Implementations§
impl Freeze for WorkflowServer
impl !RefUnwindSafe for WorkflowServer
impl Send for WorkflowServer
impl Sync for WorkflowServer
impl Unpin for WorkflowServer
impl !UnwindSafe for WorkflowServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more