feat: mcp router extension discovery and install tool (#1995)

Co-authored-by: Alice Hau <ahau@squareup.com>
This commit is contained in:
Wendy Tang
2025-04-07 14:39:35 -07:00
committed by GitHub
parent 050a8f2f42
commit 7efe06096d
11 changed files with 401 additions and 104 deletions
+16
View File
@@ -63,6 +63,22 @@ impl ExtensionManager {
}))
}
pub fn get_config_by_name(name: &str) -> Result<Option<ExtensionConfig>> {
let config = Config::global();
// Try to get the extension entry
let extensions: HashMap<String, ExtensionEntry> = match config.get_param("extensions") {
Ok(exts) => exts,
Err(super::ConfigError::NotFound(_)) => HashMap::new(),
Err(_) => HashMap::new(),
};
Ok(extensions
.values()
.find(|entry| entry.config.name() == name)
.map(|entry| entry.config.clone()))
}
/// Set or update an extension configuration
pub fn set(entry: ExtensionEntry) -> Result<()> {
let config = Config::global();