MCPcopy Create free account
hub / github.com/PowerShell/DSC / start_mcp_server_async

Function start_mcp_server_async

dsc/src/mcp/mod.rs:24–38  ·  view source on GitHub ↗

This function initializes and starts the MCP server, handling any errors that may occur. # Errors This function will return an error if the MCP server fails to start.

()

Source from the content-addressed store, hash-verified

22///
23/// This function will return an error if the MCP server fails to start.
24pub async fn start_mcp_server_async() -> Result<(), McpError> {
25 // Initialize the MCP server
26 let server = McpServer::new();
27
28 // Try to create the service with proper error handling
29 let service = server.serve(stdio()).await
30 .map_err(|err| McpError::internal_error(t!("mcp.mod.failedToInitialize", error = err.to_string()), None))?;
31
32 // Wait for the service to complete with proper error handling
33 service.waiting().await
34 .map_err(|err| McpError::internal_error(t!("mcp.mod.serverWaitFailed", error = err.to_string()), None))?;
35
36 tracing::info!("{}", t!("mcp.mod.serverStopped"));
37 Ok(())
38}
39
40/// Synchronous wrapper to start the MCP server
41///

Callers 1

start_mcp_serverFunction · 0.85

Calls 1

newFunction · 0.50

Tested by

no test coverage detected