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§
Provided Methods§
Sourcefn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
Optional plugin description
Plugin author/maintainer
Sourcefn min_mcp_version(&self) -> Option<&str>
fn min_mcp_version(&self) -> Option<&str>
Minimum mcp-kit version required
Sourcefn register_tools(&self) -> Vec<ToolDefinition>
fn register_tools(&self) -> Vec<ToolDefinition>
Register tools provided by this plugin
Sourcefn register_resources(&self) -> Vec<ResourceDefinition>
fn register_resources(&self) -> Vec<ResourceDefinition>
Register resources provided by this plugin
Sourcefn register_prompts(&self) -> Vec<PromptDefinition>
fn register_prompts(&self) -> Vec<PromptDefinition>
Register prompts provided by this plugin
Sourcefn on_load(&mut self, _config: &PluginConfig) -> McpResult<()>
fn on_load(&mut self, _config: &PluginConfig) -> McpResult<()>
Called when plugin is loaded
Sourcefn can_unload(&self) -> bool
fn can_unload(&self) -> bool
Called to check if plugin can be safely unloaded