mirror of
https://github.com/openai/codex.git
synced 2026-11-22 15:15:18 +00:00
Support per-server MCP OAuth callback ports (#38448)
## What changed - Add `oauth.callback_port` to MCP server configuration and preserve it when serializing configuration edits. - Accept `oauth.callbackPort` from plugin MCP declarations and skill dependency metadata. - Prefer the server-specific callback port over `mcp_oauth_callback_port` for CLI login, app-server, plugin installation, executor, and skill dependency OAuth flows. ## Testing - Cover configuration parsing, serialization, and fallback behavior. - Verify plugin, executor, and skill OAuth registrations use their configured callback ports instead of the global port. GitOrigin-RevId: 7f65e5e7869358307e49779f1b75e8672b607736
This commit is contained in:
1 parent
ca83f7908c
commit
1da59ad257
22 files changed
+205
-37
No files matched your search
@@ -7449,6 +7449,7 @@ async fn replace_mcp_servers_streamable_http_serializes_oauth_resource() -> anyh
|
||||
scopes: None,
|
||||
oauth: Some(McpServerOAuthConfig {
|
||||
client_id: Some("eci-prd-pub-codex-123".to_string()),
|
||||
callback_port: None,
|
||||
}),
|
||||
oauth_resource: Some("https://resource.example.com".to_string()),
|
||||
tools: HashMap::new(),
|
||||
|
||||
@@ -147,14 +147,20 @@ fn serialize_mcp_server_table(config: &McpServerConfig) -> TomlTable {
|
||||
{
|
||||
entry["scopes"] = array_from_iter(scopes.iter().cloned());
|
||||
}
|
||||
if let Some(oauth) = &config.oauth
|
||||
&& let Some(client_id) = &oauth.client_id
|
||||
&& !client_id.is_empty()
|
||||
{
|
||||
if let Some(oauth) = &config.oauth {
|
||||
let mut oauth_table = TomlTable::new();
|
||||
oauth_table.set_implicit(false);
|
||||
oauth_table["client_id"] = value(client_id.clone());
|
||||
entry["oauth"] = TomlItem::Table(oauth_table);
|
||||
if let Some(client_id) = &oauth.client_id
|
||||
&& !client_id.is_empty()
|
||||
{
|
||||
oauth_table["client_id"] = value(client_id.clone());
|
||||
}
|
||||
if let Some(callback_port) = oauth.callback_port {
|
||||
oauth_table["callback_port"] = value(i64::from(callback_port));
|
||||
}
|
||||
if !oauth_table.is_empty() {
|
||||
entry["oauth"] = TomlItem::Table(oauth_table);
|
||||
}
|
||||
}
|
||||
if let Some(resource) = &config.oauth_resource
|
||||
&& !resource.is_empty()
|
||||
|
||||
@@ -1056,6 +1056,7 @@ fn blocking_replace_mcp_servers_round_trips() {
|
||||
scopes: None,
|
||||
oauth: Some(McpServerOAuthConfig {
|
||||
client_id: Some("eci-prd-pub-codex-123".to_string()),
|
||||
callback_port: Some(9876),
|
||||
}),
|
||||
oauth_resource: Some("https://resource.example.com".to_string()),
|
||||
tools: HashMap::new(),
|
||||
@@ -1084,6 +1085,7 @@ Z-Header = \"z\"
|
||||
|
||||
[mcp_servers.http.oauth]
|
||||
client_id = \"eci-prd-pub-codex-123\"
|
||||
callback_port = 9876
|
||||
|
||||
[mcp_servers.stdio]
|
||||
command = \"cmd\"
|
||||
|
||||
Reference in new issue
Block a user