Skip to main content

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    /// The laboratory's ASSISTANT-FACING composite id —
35    /// `{machineID}/{base62(state)}/{base62(laboratoryID)}`
36    /// ([`ClientLaboratory::composite_id`](crate::laboratories::ClientLaboratory::composite_id)),
37    /// what `laboratory_transfer` takes as `source`/`destination`.
38    /// Present exactly when `laboratory` is (and its marker carries
39    /// the machine pair).
40    #[serde(default, skip_serializing_if = "Option::is_none")]
41    #[schemars(extend("omitempty" = true))]
42    pub laboratory_id: Option<String>,
43    /// Set only when this upstream is a plugin-hosted MCP server. Other
44    /// servers (plain HTTP, the primary `objectiveai` MCP, laboratories)
45    /// leave this `None`.
46    #[serde(skip_serializing_if = "Option::is_none")]
47    #[schemars(extend("omitempty" = true))]
48    pub plugin: Option<Plugin>,
49}
50
51/// A plugin-hosted MCP server's identity — the four coordinates that name
52/// a plugin's MCP (mirrors `McpKind::Plugin`).
53#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
54#[schemars(rename = "mcp.Plugin")]
55pub struct Plugin {
56    pub owner: String,
57    pub name: String,
58    pub version: String,
59    pub mcp: String,
60}