Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6a8e743

Browse files
initial mcp add interface (openai#3543)
Adds `codex mcp add`, `codex mcp list`, `codex mcp remove`. Currently writes to global config.
1 parent a797051 commit 6a8e743

File tree

9 files changed

+849
-5
lines changed

9 files changed

+849
-5
lines changed

codex-rs/Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codex-rs/cli/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,9 @@ tokio = { version = "1", features = [
3838
tracing = "0.1.41"
3939
tracing-subscriber = "0.3.19"
4040
codex-protocol-ts = { path = "../protocol-ts" }
41+
42+
[dev-dependencies]
43+
assert_cmd = "2"
44+
predicates = "3"
45+
pretty_assertions = "1"
46+
tempfile = "3"

codex-rs/cli/src/main.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ use codex_exec::Cli as ExecCli;
1717
use codex_tui::Cli as TuiCli;
1818
use std::path::PathBuf;
1919

20+
mod mcp_cmd;
21+
22+
use crate::mcp_cmd::McpCli;
2023
use crate::proto::ProtoCli;
2124

2225
/// Codex CLI
@@ -56,8 +59,8 @@ enum Subcommand {
5659
/// Remove stored authentication credentials.
5760
Logout(LogoutCommand),
5861

59-
/// Experimental: run Codex as an MCP server.
60-
Mcp,
62+
/// [experimental] Run Codex as an MCP server and manage MCP servers.
63+
Mcp(McpCli),
6164

6265
/// Run the Protocol stream via stdin/stdout
6366
#[clap(visible_alias = "p")]
@@ -182,9 +185,10 @@ async fn cli_main(codex_linux_sandbox_exe: Option<PathBuf>) -> anyhow::Result<()
182185
);
183186
codex_exec::run_main(exec_cli, codex_linux_sandbox_exe).await?;
184187
}
185-
Some(Subcommand::Mcp) => {
186-
codex_mcp_server::run_main(codex_linux_sandbox_exe, root_config_overrides.clone())
187-
.await?;
188+
Some(Subcommand::Mcp(mut mcp_cli)) => {
189+
// Propagate any root-level config overrides (e.g. `-c key=value`).
190+
prepend_config_flags(&mut mcp_cli.config_overrides, root_config_overrides.clone());
191+
mcp_cli.run(codex_linux_sandbox_exe).await?;
188192
}
189193
Some(Subcommand::Resume(ResumeCommand { session_id, last })) => {
190194
// Start with the parsed interactive CLI so resume shares the same

0 commit comments

Comments
 (0)