Skip to main content

McpPlugin

Trait McpPlugin 

Source
pub trait McpPlugin: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn version(&self) -> &str;

    // Provided methods
    fn description(&self) -> Option<&str> { ... }
    fn author(&self) -> Option<&str> { ... }
    fn min_mcp_version(&self) -> Option<&str> { ... }
    fn register_tools(&self) -> Vec<ToolDefinition> { ... }
    fn register_resources(&self) -> Vec<ResourceDefinition> { ... }
    fn register_prompts(&self) -> Vec<PromptDefinition> { ... }
    fn on_load(&mut self, _config: &PluginConfig) -> McpResult<()> { ... }
    fn on_unload(&mut self) -> McpResult<()> { ... }
    fn can_unload(&self) -> bool { ... }
}
Expand description

Core trait that all MCP plugins must implement.

A plugin can provide tools, resources, and/or prompts that will be registered with the MCP server.

Required Methods§

Source

fn name(&self) -> &str

Plugin identifier (unique name)

Source

fn version(&self) -> &str

Plugin version (semver)

Provided Methods§

Source

fn description(&self) -> Option<&str>

Optional plugin description

Source

fn author(&self) -> Option<&str>

Plugin author/maintainer

Source

fn min_mcp_version(&self) -> Option<&str>

Minimum mcp-kit version required

Source

fn register_tools(&self) -> Vec<ToolDefinition>

Register tools provided by this plugin

Source

fn register_resources(&self) -> Vec<ResourceDefinition>

Register resources provided by this plugin

Source

fn register_prompts(&self) -> Vec<PromptDefinition>

Register prompts provided by this plugin

Source

fn on_load(&mut self, _config: &PluginConfig) -> McpResult<()>

Called when plugin is loaded

Source

fn on_unload(&mut self) -> McpResult<()>

Called when plugin is unloaded

Source

fn can_unload(&self) -> bool

Called to check if plugin can be safely unloaded

Implementors§