objectiveai_sdk/mcp/server.rs
1//! Types for the proxy-local `servers/list` aggregate — enumerating the
2//! upstream MCP servers the proxy has connected for a completion, with each
3//! server's initialize metadata. This is NOT a standard MCP method; the proxy
4//! answers it from its in-memory connection set.
5
6use schemars::JsonSchema;
7use serde::{Deserialize, Serialize};
8
9/// The proxy's connected upstream MCP servers and their metadata.
10#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
11#[schemars(rename = "mcp.ListServersResult")]
12pub struct ListServersResult {
13 pub servers: Vec<Server>,
14}
15
16/// One connected upstream MCP server.
17#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
18#[schemars(rename = "mcp.Server")]
19pub struct Server {
20 /// The proxy's routing prefix for this server (matches the `<prefix>_`
21 /// prepended to its tools/resources in the aggregated surface).
22 pub name: String,
23 /// The upstream server's URL.
24 pub url: String,
25 /// The server's `initialize` response: capabilities, `server_info`
26 /// (name, version, title, description), instructions, protocol version.
27 pub initialize_result: super::initialize_result::InitializeResult,
28 /// Set only when this upstream is genuinely a laboratory — i.e. a
29 /// client (websocket) laboratory today. Non-laboratory servers (plain
30 /// HTTP, the primary `objectiveai` MCP, plugins) leave this `None`.
31 #[serde(skip_serializing_if = "Option::is_none")]
32 #[schemars(extend("omitempty" = true))]
33 pub laboratory: Option<crate::laboratories::Laboratory>,
34 /// Set only when this upstream is a plugin-hosted MCP server. Other
35 /// servers (plain HTTP, the primary `objectiveai` MCP, laboratories)
36 /// leave this `None`.
37 #[serde(skip_serializing_if = "Option::is_none")]
38 #[schemars(extend("omitempty" = true))]
39 pub plugin: Option<Plugin>,
40}
41
42/// A plugin-hosted MCP server's identity — the four coordinates that name
43/// a plugin's MCP (mirrors `McpKind::Plugin`).
44#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
45#[schemars(rename = "mcp.Plugin")]
46pub struct Plugin {
47 pub owner: String,
48 pub name: String,
49 pub version: String,
50 pub mcp: String,
51}