mirror of
https://github.com/openai/codex.git
synced 2026-11-13 22:47:20 +00:00
Upgrade rmcp to 3.0.0 (#36001)
## What changed - Update the Rust MCP SDK from `3.0.0-beta.3` to `3.0.0` and adapt to its renamed metadata and server discovery types. - Accept discovery responses without server identity metadata, using the configured server name as a fallback, and rely on the SDK's native support for namespaced server identity metadata. - Preserve typed OAuth HTTP errors so transport failures, cross-origin redirects, and transient HTTP responses are reported instead of being treated as anonymous access. ## Testing - Cover modern discovery with namespaced or missing server identity over HTTP, SSE, and stdio. - Cover OAuth discovery error propagation for transport failures, redirects, and transient status codes. GitOrigin-RevId: 12c1e45136cca89ce4fb15986c2b5df14608682a
This commit is contained in:
1 parent
df326d31cd
commit
a05bcda3db
22 files changed
+274
-155
No files matched your search
@@ -898,7 +898,8 @@ async fn start_server_task(
|
||||
)
|
||||
.await
|
||||
.map_err(StartupOutcomeError::from)?;
|
||||
let server_info = mcp_server_info_from_implementation(initialize_result.server_info);
|
||||
let server_info =
|
||||
mcp_server_info_from_implementation(&server_name, initialize_result.server_info);
|
||||
let shared_tools = match (codex_apps_tools_cache_context.as_ref(), fetch_ticket) {
|
||||
(Some(cache_context), Some(fetch_ticket)) => cache_context.publish_if_newest_accepted(
|
||||
fetch_ticket,
|
||||
@@ -954,7 +955,11 @@ fn mcp_initialize_request_params(
|
||||
.with_protocol_version(ProtocolVersion::V_2025_06_18)
|
||||
}
|
||||
|
||||
fn mcp_server_info_from_implementation(server_info: Implementation) -> McpServerInfo {
|
||||
fn mcp_server_info_from_implementation(
|
||||
server_name: &str,
|
||||
server_info: Option<Implementation>,
|
||||
) -> McpServerInfo {
|
||||
let server_info = server_info.unwrap_or_else(|| Implementation::new(server_name, ""));
|
||||
McpServerInfo {
|
||||
name: server_info.name,
|
||||
title: server_info.title,
|
||||
@@ -1085,7 +1090,7 @@ mod tests {
|
||||
use super::*;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rmcp::model::JsonObject;
|
||||
use rmcp::model::Meta;
|
||||
use rmcp::model::MetaObject;
|
||||
use rmcp::transport::auth::AuthError;
|
||||
|
||||
#[test]
|
||||
@@ -1098,6 +1103,44 @@ mod tests {
|
||||
assert!(error.is_authentication_required());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_server_implementation_uses_configured_server_name() {
|
||||
assert_eq!(
|
||||
mcp_server_info_from_implementation("configured-server", /*server_info*/ None),
|
||||
McpServerInfo {
|
||||
name: "configured-server".to_string(),
|
||||
title: None,
|
||||
version: String::new(),
|
||||
description: None,
|
||||
icons: None,
|
||||
website_url: None,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn advertised_server_implementation_takes_precedence_over_configured_name() {
|
||||
assert_eq!(
|
||||
mcp_server_info_from_implementation(
|
||||
"configured-server",
|
||||
Some(
|
||||
Implementation::new("advertised-server", "1.2.3")
|
||||
.with_title("Advertised server")
|
||||
.with_description("Advertised description")
|
||||
.with_website_url("https://example.com"),
|
||||
),
|
||||
),
|
||||
McpServerInfo {
|
||||
name: "advertised-server".to_string(),
|
||||
title: Some("Advertised server".to_string()),
|
||||
version: "1.2.3".to_string(),
|
||||
description: Some("Advertised description".to_string()),
|
||||
icons: None,
|
||||
website_url: Some("https://example.com".to_string()),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mcp_initialize_advertises_openai_form_only_when_supported() {
|
||||
let unsupported = mcp_initialize_request_params(
|
||||
@@ -1125,7 +1168,7 @@ mod tests {
|
||||
"test tool",
|
||||
Arc::new(JsonObject::default()),
|
||||
)
|
||||
.with_meta(Meta(
|
||||
.with_meta(MetaObject(
|
||||
serde_json::json!({
|
||||
"connector_id": "connector_gmail",
|
||||
"connector_name": "Gmail",
|
||||
|
||||
Reference in new issue
Block a user