Commit Graph

809 Commits

Author SHA1 Message Date
Michael Bolin
5f83da6046 merge commit for archive created by Sapling 2025-05-06 17:32:32 -07:00
Michael Bolin
6da5631a7c chore: introduce codex-common crate 2025-05-06 17:32:28 -07:00
Michael Bolin
a0a7e0a7f0 merge commit for archive created by Sapling 2025-05-06 17:28:34 -07:00
Michael Bolin
d82a893b35 chore: introduce codex-common crate 2025-05-06 17:28:28 -07:00
Michael Bolin
98168f0cae merge commit for archive created by Sapling 2025-05-06 17:16:36 -07:00
Michael Bolin
a648355cae chore: introduce codex-common crate 2025-05-06 17:16:28 -07:00
Michael Bolin
15d8356af4 merge commit for archive created by Sapling 2025-05-06 17:09:56 -07:00
Michael Bolin
bf30f991b0 chore: introduce codex-common crate 2025-05-06 17:07:33 -07:00
Michael Bolin
7d8b38b37b feat: show MCP tool calls in codex exec subcommand (#841)
This is analogous to the change for the TUI in
https://github.com/openai/codex/pull/836, but for `codex exec`.

To test, I ran:

```
cargo run --bin codex-exec -- 'what is the weather in wellesley ma tomorrow'
```

and saw:


![image](https://github.com/user-attachments/assets/5714e07f-88c7-4dd9-aa0d-be54c1670533)
2025-05-06 16:52:43 -07:00
Michael Bolin
9945874de7 Merge 81fc840604 into sapling-pr-archive-bolinfest 2025-05-06 16:40:52 -07:00
Michael Bolin
81fc840604 feat: show MCP tool calls in codex exec subcommand 2025-05-06 16:40:49 -07:00
Michael Bolin
932498589d Merge c714c40710 into sapling-pr-archive-bolinfest 2025-05-06 16:37:36 -07:00
Michael Bolin
c714c40710 feat: show MCP tool calls in codex exec subcommand 2025-05-06 16:36:34 -07:00
Michael Bolin
6f87f4c69f feat: drop support for q in the Rust TUI since we already support ctrl+d (#799)
Out of the box, we will make `/` the only official "escape sequence" for
commands in the Rust TUI. We will look to support `q` (or any string you
want to use as a "macro") via a plugin, but not make it part of the
default experience.

Existing `q` users will have to get by with `ctrl+d` for now.
2025-05-06 16:34:17 -07:00
Michael Bolin
aa36a15f9f fix: make all fields of Session struct private again (#840)
https://github.com/openai/codex/pull/829 noted it introduced a circular
dep between `codex.rs` and `mcp_tool_call.rs`. This attempts to clean
things up: the circular dep still exists, but at least all the fields of
`Session` are private again.
2025-05-06 16:21:35 -07:00
Michael Bolin
aad3f6b1ac Merge 22d4a97349 into sapling-pr-archive-bolinfest 2025-05-06 16:12:59 -07:00
Michael Bolin
22d4a97349 fix: make all fields of Session struct private again 2025-05-06 16:12:49 -07:00
Michael Bolin
88e7ca5f2b feat: show MCP tool calls in TUI (#836)
Adds logic for the `McpToolCallBegin` and `McpToolCallEnd` events in
`codex-rs/tui/src/chatwidget.rs` so they get entries in the conversation
history in the TUI.

Building on top of https://github.com/openai/codex/pull/829, here is the
result of running:

```
cargo run --bin codex -- 'what is the weather in san francisco tomorrow'
```


![image](https://github.com/user-attachments/assets/db4a79bb-4988-46cb-acb2-446d5ba9e058)
2025-05-06 16:12:15 -07:00
Michael Bolin
0b0d618680 Merge a8b5dd88f7 into sapling-pr-archive-bolinfest 2025-05-06 15:58:27 -07:00
Michael Bolin
a8b5dd88f7 feat: show MCP tool calls in TUI 2025-05-06 15:58:24 -07:00
Michael Bolin
9bd8921af4 merge commit for archive created by Sapling 2025-05-06 15:55:31 -07:00
Michael Bolin
d97cc8ec8c feat: show MCP tool calls in TUI 2025-05-06 15:54:59 -07:00
Michael Bolin
147a940449 feat: support mcp_servers in config.toml (#829)
This adds initial support for MCP servers in the style of Claude Desktop
and Cursor. Note this PR is the bare minimum to get things working end
to end: all configured MCP servers are launched every time Codex is run,
there is no recovery for MCP servers that crash, etc.

(Also, I took some shortcuts to change some fields of `Session` to be
`pub(crate)`, which also means there are circular deps between
`codex.rs` and `mcp_tool_call.rs`, but I will clean that up in a
subsequent PR.)

`codex-rs/README.md` is updated as part of this PR to explain how to use
this feature. There is a bit of plumbing to route the new settings from
`Config` to the business logic in `codex.rs`. The most significant
chunks for new code are in `mcp_connection_manager.rs` (which defines
the `McpConnectionManager` struct) and `mcp_tool_call.rs`, which is
responsible for tool calls.

This PR also introduces new `McpToolCallBegin` and `McpToolCallEnd`
event types to the protocol, but does not add any handlers for them.
(See https://github.com/openai/codex/pull/836 for initial usage.)

To test, I added the following to my `~/.codex/config.toml`:

```toml
# Local build of https://github.com/hideya/mcp-server-weather-js
[mcp_servers.weather]
command = "/Users/mbolin/code/mcp-server-weather-js/dist/index.js"
args = []
```

And then I ran the following:

```
codex-rs$ cargo run --bin codex exec 'what is the weather in san francisco'
[2025-05-06T22:40:05] Task started: 1
[2025-05-06T22:40:18] Agent message: Here’s the latest National Weather Service forecast for San Francisco (downtown, near 37.77° N, 122.42° W):

This Afternoon (Tue):
• Sunny, high near 69 °F
• West-southwest wind around 12 mph

Tonight:
• Partly cloudy, low around 52 °F
• SW wind 7–10 mph
...
```

Note that Codex itself is not able to make network calls, so it would
not normally be able to get live weather information like this. However,
the weather MCP is [currently] not run under the Codex sandbox, so it is
able to hit `api.weather.gov` and fetch current weather information.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/829).
* #836
* __->__ #829
2025-05-06 15:47:59 -07:00
Michael Bolin
e6af355312 merge commit for archive created by Sapling 2025-05-06 15:38:56 -07:00
Michael Bolin
e9b4217ea1 feat: show MCP tool calls in TUI 2025-05-06 15:38:51 -07:00
Michael Bolin
54e382e2a9 feat: support mcp_servers in config.toml 2025-05-06 15:38:51 -07:00
Michael Bolin
00dd6fe2e1 merge commit for archive created by Sapling 2025-05-06 15:37:28 -07:00
Michael Bolin
8ed9aff351 feat: show MCP tool calls in TUI 2025-05-06 15:37:23 -07:00
Michael Bolin
007c0a3984 feat: support mcp_servers in config.toml 2025-05-06 15:37:23 -07:00
Michael Bolin
ff52475646 merge commit for archive created by Sapling 2025-05-06 15:36:22 -07:00
Michael Bolin
e812b4ffeb feat: show MCP tool calls in TUI 2025-05-06 15:36:17 -07:00
Michael Bolin
9f6c4c5167 feat: support mcp_servers in config.toml 2025-05-06 15:36:17 -07:00
Michael Bolin
9ac3c96671 merge commit for archive created by Sapling 2025-05-06 15:25:46 -07:00
Michael Bolin
1d5bfb96a8 feat: show MCP tool calls in TUI 2025-05-06 15:25:40 -07:00
Michael Bolin
851afb5366 feat: support mcp_servers in config.toml 2025-05-06 15:25:40 -07:00
Michael Bolin
bb3775e451 merge commit for archive created by Sapling 2025-05-06 15:24:42 -07:00
Michael Bolin
4a6f2aa574 feat: show MCP tool calls in TUI 2025-05-06 15:24:35 -07:00
Michael Bolin
4917413b73 feat: support mcp_servers in config.toml 2025-05-06 15:24:35 -07:00
Michael Bolin
53deb3f16b merge commit for archive created by Sapling 2025-05-06 15:17:24 -07:00
Michael Bolin
306219c1d1 feat: show MCP tool calls in TUI 2025-05-06 15:17:18 -07:00
Michael Bolin
a0a79fa3a5 feat: support mcp_servers in config.toml 2025-05-06 15:17:18 -07:00
Michael Bolin
3dd7140148 merge commit for archive created by Sapling 2025-05-06 15:13:08 -07:00
Michael Bolin
c9f5d3e9b2 feat: show MCP tool calls in TUI 2025-05-06 15:13:02 -07:00
Michael Bolin
14c37c20eb merge commit for archive created by Sapling 2025-05-06 15:12:46 -07:00
Michael Bolin
c443dcb4d9 feat: support mcp_servers in config.toml 2025-05-06 15:12:40 -07:00
Michael Bolin
1068433c04 feat: show MCP tool calls in TUI 2025-05-06 15:12:40 -07:00
Michael Bolin
a2ba35b720 merge commit for archive created by Sapling 2025-05-06 15:08:28 -07:00
Michael Bolin
550f674ca2 feat: show MCP tool calls in TUI 2025-05-06 15:08:17 -07:00
Michael Bolin
b103e58895 feat: support mcp_servers in config.toml 2025-05-06 15:08:17 -07:00
Michael Bolin
b06a148fd0 merge commit for archive created by Sapling 2025-05-06 15:02:33 -07:00