-
Notifications
You must be signed in to change notification settings - Fork 10.9k
[5/6] Wire executor-backed MCP stdio #18212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c219aeb
2e197a8
7a72177
48ee483
a3abe00
ff0c5c2
4d1aeab
042feb9
7eb0c40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -274,6 +274,7 @@ use codex_login::default_client::set_default_client_residency_requirement; | |
| use codex_login::login_with_api_key; | ||
| use codex_login::request_device_code; | ||
| use codex_login::run_login_server; | ||
| use codex_mcp::McpRuntimeEnvironment; | ||
| use codex_mcp::McpServerStatusSnapshot; | ||
| use codex_mcp::McpSnapshotDetail; | ||
| use codex_mcp::collect_mcp_server_status_snapshot_with_detail; | ||
|
|
@@ -5648,10 +5649,40 @@ impl CodexMessageProcessor { | |
| .to_mcp_config(self.thread_manager.plugins_manager().as_ref()) | ||
| .await; | ||
| let auth = self.auth_manager.auth().await; | ||
| let runtime_environment = match self.thread_manager.environment_manager().current().await { | ||
| Ok(Some(environment)) => { | ||
| // Status listing has no turn cwd. This fallback is used only | ||
| // by executor-backed stdio MCPs whose config omits `cwd`. | ||
| McpRuntimeEnvironment::new(environment, config.cwd.to_path_buf()) | ||
| } | ||
| Ok(None) => McpRuntimeEnvironment::new( | ||
| Arc::new(codex_exec_server::Environment::default()), | ||
| config.cwd.to_path_buf(), | ||
| ), | ||
| Err(err) => { | ||
| // TODO(aibrahim): Investigate degrading MCP status listing when | ||
| // executor environment creation fails. | ||
| let error = JSONRPCErrorError { | ||
| code: INTERNAL_ERROR_CODE, | ||
| message: format!("failed to create environment: {err}"), | ||
| data: None, | ||
| }; | ||
| self.outgoing.send_error(request, error).await; | ||
| return; | ||
|
Comment on lines
+5662
to
+5671
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| } | ||
| }; | ||
|
|
||
| tokio::spawn(async move { | ||
| Self::list_mcp_server_status_task(outgoing, request, params, config, mcp_config, auth) | ||
| .await; | ||
| Self::list_mcp_server_status_task( | ||
| outgoing, | ||
| request, | ||
| params, | ||
| config, | ||
| mcp_config, | ||
| auth, | ||
| runtime_environment, | ||
| ) | ||
| .await; | ||
| }); | ||
| } | ||
|
|
||
|
|
@@ -5662,6 +5693,7 @@ impl CodexMessageProcessor { | |
| config: Config, | ||
| mcp_config: codex_mcp::McpConfig, | ||
| auth: Option<CodexAuth>, | ||
| runtime_environment: McpRuntimeEnvironment, | ||
| ) { | ||
| let detail = match params.detail.unwrap_or(McpServerStatusDetail::Full) { | ||
| McpServerStatusDetail::Full => McpSnapshotDetail::Full, | ||
|
|
@@ -5672,6 +5704,7 @@ impl CodexMessageProcessor { | |
| &mcp_config, | ||
| auth.as_ref(), | ||
| request_id.request_id.to_string(), | ||
| runtime_environment, | ||
| detail, | ||
| ) | ||
| .await; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, do we always start mcps in cwd?