mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Expose MCP server info as part of server status (#24698)
# Summary Expose MCP server info via App Server (when available) so apps can render a richer MCP experience
This commit is contained in:
@@ -20,6 +20,7 @@ use codex_core::config::set_project_trust_level;
|
||||
use codex_protocol::config_types::TrustLevel;
|
||||
use pretty_assertions::assert_eq;
|
||||
use rmcp::handler::server::ServerHandler;
|
||||
use rmcp::model::Implementation;
|
||||
use rmcp::model::JsonObject;
|
||||
use rmcp::model::ListResourceTemplatesResult;
|
||||
use rmcp::model::ListResourcesResult;
|
||||
@@ -99,6 +100,13 @@ url = "{mcp_server_url}/mcp"
|
||||
.map(|tool| tool.name.as_str()),
|
||||
Some("look-up.raw")
|
||||
);
|
||||
assert_eq!(
|
||||
status
|
||||
.server_info
|
||||
.as_ref()
|
||||
.and_then(|info| info.title.as_deref()),
|
||||
Some("Lookup Server")
|
||||
);
|
||||
|
||||
mcp_server_handle.abort();
|
||||
let _ = mcp_server_handle.await;
|
||||
@@ -205,7 +213,9 @@ struct McpStatusServer {
|
||||
|
||||
impl ServerHandler for McpStatusServer {
|
||||
fn get_info(&self) -> ServerInfo {
|
||||
ServerInfo::new(ServerCapabilities::builder().enable_tools().build())
|
||||
ServerInfo::new(ServerCapabilities::builder().enable_tools().build()).with_server_info(
|
||||
Implementation::new("lookup-server", "1.0.0").with_title("Lookup Server"),
|
||||
)
|
||||
}
|
||||
|
||||
async fn list_tools(
|
||||
|
||||
Reference in New Issue
Block a user