pub trait Plugin: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn on_load(&mut self, config: &JsonValue) -> Result<()>;
fn transform_canon(&self, canon: &mut Canon) -> Result<()>;
fn transform_output(
&self,
target: &str,
value: &mut JsonValue,
) -> Result<()>;
}Expand description
Trait for MCP-Sync plugins.
Plugins can hook into various stages of the sync process to transform configurations.
Required Methods§
Sourcefn on_load(&mut self, config: &JsonValue) -> Result<()>
fn on_load(&mut self, config: &JsonValue) -> Result<()>
Called when the plugin is loaded with its configuration.
§Arguments
config- Plugin-specific configuration frommcp.yaml
Sourcefn transform_canon(&self, canon: &mut Canon) -> Result<()>
fn transform_canon(&self, canon: &mut Canon) -> Result<()>
Transforms the canonical configuration before syncing to targets.
This hook is called once per sync operation, before any target sync.
§Arguments
canon- Mutable reference to the canonical configuration
Sourcefn transform_output(&self, target: &str, value: &mut JsonValue) -> Result<()>
fn transform_output(&self, target: &str, value: &mut JsonValue) -> Result<()>
Transforms the output for a specific target before writing.
This hook is called for each target file that will be written.
§Arguments
target- Name of the target (e.g., “Antigravity”, “Claude”)value- Mutable reference to the JSON value being written