Skip to main content

run_server_with_extensions

Function run_server_with_extensions 

Source
pub async fn run_server_with_extensions(
    config: &Config,
    extra_tools: Arc<ToolRegistry>,
    extra_profiles: Arc<ProfileRegistry>,
) -> Result<()>
Expand description

Starts the MCP server with custom Rust tool and profile extensions.

Like run_server, but accepts a ToolRegistry and ProfileRegistry containing custom extensions that will be served alongside built-in, TOML-defined, and Lua-scripted entries.

Custom tools appear in GET /tools/list and can be called via POST /tools/{name}. Custom profiles appear in GET /profiles/list and can be resolved via POST /profiles/{name}/prompt.

ยงExample

use context_harness::server::run_server_with_extensions;
use context_harness::traits::ToolRegistry;
use context_harness::profiles::ProfileRegistry;
use std::sync::Arc;

let tools = ToolRegistry::new();
let profiles = ProfileRegistry::new();
run_server_with_extensions(config, Arc::new(tools), Arc::new(profiles)).await?;