This PR introduces support for `-c`/`--config` so users can override individual config values on the command line using `--config name=value`. Example: ``` codex --config model=o4-mini ``` Making it possible to set arbitrary config values on the command line results in a more flexible configuration scheme and makes it easier to provide single-line examples that can be copy-pasted from documentation. Effectively, it means there are four levels of configuration for some values: - Default value (e.g., `model` currently defaults to `o4-mini`) - Value in `config.toml` (e.g., user could override the default to be `model = "o3"` in their `config.toml`) - Specifying `-c` or `--config` to override `model` (e.g., user can include `-c model=o3` in their list of args to Codex) - If available, a config-specific flag can be used, which takes precedence over `-c` (e.g., user can specify `--model o3` in their list of args to Codex) Now that it is possible to specify anything that could be configured in `config.toml` on the command line using `-c`, we do not need to have a custom flag for every possible config option (which can clutter the output of `--help`). To that end, as part of this PR, we drop support for the `--disable-response-storage` flag, as users can now specify `-c disable_response_storage=true` to get the equivalent functionality. Under the hood, this works by loading the `config.toml` into a `toml::Value`. Then for each `key=value`, we create a small synthetic TOML file with `value` so that we can run the TOML parser to get the equivalent `toml::Value`. We then parse `key` to determine the point in the original `toml::Value` to do the insert/replace. Once all of the overrides from `-c` args have been applied, the `toml::Value` is deserialized into a `ConfigToml` and then the `ConfigOverrides` are applied, as before.
38 lines
769 B
TOML
38 lines
769 B
TOML
[package]
|
|
name = "codex-mcp-server"
|
|
version = { workspace = true }
|
|
edition = "2024"
|
|
|
|
[[bin]]
|
|
name = "codex-mcp-server"
|
|
path = "src/main.rs"
|
|
|
|
[lib]
|
|
name = "codex_mcp_server"
|
|
path = "src/lib.rs"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
anyhow = "1"
|
|
codex-core = { path = "../core" }
|
|
codex-linux-sandbox = { path = "../linux-sandbox" }
|
|
mcp-types = { path = "../mcp-types" }
|
|
schemars = "0.8.22"
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
toml = "0.8"
|
|
tracing = { version = "0.1.41", features = ["log"] }
|
|
tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] }
|
|
tokio = { version = "1", features = [
|
|
"io-std",
|
|
"macros",
|
|
"process",
|
|
"rt-multi-thread",
|
|
"signal",
|
|
] }
|
|
|
|
[dev-dependencies]
|
|
pretty_assertions = "1.4.1"
|