mirror of
https://github.com/openai/codex.git
synced 2026-05-18 10:12:59 +00:00
## Summary - reduce public module visibility across Rust crates, preferring private or crate-private modules with explicit crate-root public exports - update external call sites and tests to use the intended public crate APIs instead of reaching through module trees - add the module visibility guideline to AGENTS.md ## Validation - `cargo check --workspace --all-targets --message-format=short` passed before the final fix/format pass - `just fix` completed successfully - `just fmt` completed successfully - `git diff --check` passed
42 lines
1.3 KiB
Rust
42 lines
1.3 KiB
Rust
use std::collections::HashMap;
|
|
use std::sync::Arc;
|
|
|
|
use crate::config::Config;
|
|
use crate::plugins::PluginsManager;
|
|
use codex_config::McpServerConfig;
|
|
use codex_login::CodexAuth;
|
|
use codex_mcp::ToolPluginProvenance;
|
|
use codex_mcp::configured_mcp_servers;
|
|
use codex_mcp::effective_mcp_servers;
|
|
use codex_mcp::tool_plugin_provenance as collect_tool_plugin_provenance;
|
|
|
|
#[derive(Clone)]
|
|
pub struct McpManager {
|
|
plugins_manager: Arc<PluginsManager>,
|
|
}
|
|
|
|
impl McpManager {
|
|
pub fn new(plugins_manager: Arc<PluginsManager>) -> Self {
|
|
Self { plugins_manager }
|
|
}
|
|
|
|
pub fn configured_servers(&self, config: &Config) -> HashMap<String, McpServerConfig> {
|
|
let mcp_config = config.to_mcp_config(self.plugins_manager.as_ref());
|
|
configured_mcp_servers(&mcp_config)
|
|
}
|
|
|
|
pub fn effective_servers(
|
|
&self,
|
|
config: &Config,
|
|
auth: Option<&CodexAuth>,
|
|
) -> HashMap<String, McpServerConfig> {
|
|
let mcp_config = config.to_mcp_config(self.plugins_manager.as_ref());
|
|
effective_mcp_servers(&mcp_config, auth)
|
|
}
|
|
|
|
pub fn tool_plugin_provenance(&self, config: &Config) -> ToolPluginProvenance {
|
|
let mcp_config = config.to_mcp_config(self.plugins_manager.as_ref());
|
|
collect_tool_plugin_provenance(&mcp_config)
|
|
}
|
|
}
|