Skip to main content

adk_tool/mcp/server/
card.rs

1//! MCP Server Cards (SEP-2127) and AI Catalog entries (spec 3.5 §4.4, §7.9).
2//!
3//! The types follow the Server Card extension's `schema.ts` at the snapshot SEP-2127 was
4//! accepted against (`modelcontextprotocol/experimental-ext-server-card@526201bb`), and the AI
5//! Catalog entry its `docs/discovery.md` describes.
6
7use std::collections::BTreeMap;
8
9use serde::{Deserialize, Serialize};
10use serde_json::{Map, Value};
11
12/// The `$schema` URI every Server Card carries (SEP-2127, schema `v1`).
13pub const SERVER_CARD_SCHEMA_URL: &str =
14    "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json";
15
16/// The media type of a Server Card document.
17pub const SERVER_CARD_MEDIA_TYPE: &str = "application/mcp-server-card+json";
18
19/// The media type of an AI Catalog document.
20pub const AI_CATALOG_MEDIA_TYPE: &str = "application/ai-catalog+json";
21
22/// The AI Catalog `specVersion` the catalog documents carry.
23pub const AI_CATALOG_SPEC_VERSION: &str = "1.0";
24
25/// The card's primary location, relative to the Streamable HTTP endpoint: SEP-2127 reserves
26/// `<streamable-http-url>/server-card`, and AI Catalog entries point there.
27pub const SERVER_CARD_ENDPOINT_SUFFIX: &str = "/server-card";
28
29/// The alias path spec 3.5 §7.9 names for the card on the agent edge.
30pub const SERVER_CARD_WELL_KNOWN_PATH: &str = "/.well-known/mcp/server-card.json";
31
32/// The well-known path of a domain's AI Catalog.
33pub const AI_CATALOG_WELL_KNOWN_PATH: &str = "/.well-known/ai-catalog.json";
34
35/// A static description of a remote MCP server for discovery before connecting (SEP-2127).
36///
37/// The card names the server, its version and how to reach it. It lists no tools: clients
38/// read those from `tools/list` once connected. [`McpServer::server_card`] builds the card
39/// from the same declaration that serves `initialize`, so the two agree.
40///
41/// [`McpServer::server_card`]: super::McpServer::server_card
42///
43/// # Example
44///
45/// ```rust
46/// use adk_tool::mcp::server::{SERVER_CARD_SCHEMA_URL, ServerCard};
47///
48/// let card: ServerCard = serde_json::from_value(serde_json::json!({
49///     "$schema": SERVER_CARD_SCHEMA_URL,
50///     "name": "com.example/shop",
51///     "version": "1.0.0",
52///     "description": "Quotes and bookings",
53/// }))?;
54/// assert_eq!(card.name, "com.example/shop");
55/// # Ok::<(), serde_json::Error>(())
56/// ```
57#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
58#[serde(rename_all = "camelCase")]
59#[non_exhaustive]
60pub struct ServerCard {
61    /// The schema URI, always [`SERVER_CARD_SCHEMA_URL`].
62    #[serde(rename = "$schema")]
63    pub schema: String,
64    /// Reverse-DNS name with exactly one `/`, such as `com.example/shop`.
65    pub name: String,
66    /// The server's version; matches `serverInfo.version`.
67    pub version: String,
68    /// What the server does, 1 to 100 characters.
69    pub description: String,
70    /// Display name, 1 to 100 characters.
71    #[serde(skip_serializing_if = "Option::is_none")]
72    pub title: Option<String>,
73    /// The server's homepage or documentation.
74    #[serde(skip_serializing_if = "Option::is_none")]
75    pub website_url: Option<String>,
76    /// Where the server's source code lives.
77    #[serde(skip_serializing_if = "Option::is_none")]
78    pub repository: Option<ServerCardRepository>,
79    /// Icons a client may display.
80    #[serde(skip_serializing_if = "Option::is_none")]
81    pub icons: Option<Vec<ServerCardIcon>>,
82    /// The endpoints a client connects to.
83    #[serde(skip_serializing_if = "Option::is_none")]
84    pub remotes: Option<Vec<ServerCardRemote>>,
85    /// Vendor metadata under reverse-DNS keys.
86    #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
87    pub meta: Option<Map<String, Value>>,
88}
89
90/// Repository metadata for a server's source code.
91///
92/// # Example
93///
94/// ```rust
95/// use adk_tool::mcp::server::ServerCardRepository;
96///
97/// let repo = ServerCardRepository::new("https://github.com/example/shop-mcp", "github")
98///     .with_subfolder("server");
99/// assert_eq!(repo.subfolder.as_deref(), Some("server"));
100/// ```
101#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
102#[serde(rename_all = "camelCase")]
103#[non_exhaustive]
104pub struct ServerCardRepository {
105    /// Repository URL for browsing and cloning.
106    pub url: String,
107    /// The hosting service, such as `github`.
108    pub source: String,
109    /// Path of the server within the repository.
110    #[serde(skip_serializing_if = "Option::is_none")]
111    pub subfolder: Option<String>,
112    /// The hosting service's stable repository identifier.
113    #[serde(skip_serializing_if = "Option::is_none")]
114    pub id: Option<String>,
115}
116
117impl ServerCardRepository {
118    /// Creates repository metadata for `url` hosted on `source`.
119    pub fn new(url: impl Into<String>, source: impl Into<String>) -> Self {
120        Self { url: url.into(), source: source.into(), subfolder: None, id: None }
121    }
122
123    /// Sets the server's path within the repository.
124    pub fn with_subfolder(mut self, subfolder: impl Into<String>) -> Self {
125        self.subfolder = Some(subfolder.into());
126        self
127    }
128
129    /// Sets the hosting service's repository identifier.
130    pub fn with_id(mut self, id: impl Into<String>) -> Self {
131        self.id = Some(id.into());
132        self
133    }
134}
135
136/// An icon a client may display for the server.
137///
138/// # Example
139///
140/// ```rust
141/// use adk_tool::mcp::server::{IconTheme, ServerCardIcon};
142///
143/// let icon = ServerCardIcon::new("https://example.com/icon.png")
144///     .with_mime_type("image/png")
145///     .with_sizes(["48x48"])
146///     .with_theme(IconTheme::Light);
147/// assert_eq!(icon.theme, Some(IconTheme::Light));
148/// ```
149#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
150#[serde(rename_all = "camelCase")]
151#[non_exhaustive]
152pub struct ServerCardIcon {
153    /// An `https:` URL or a `data:` URI.
154    pub src: String,
155    /// The image's MIME type when the source does not state it.
156    #[serde(skip_serializing_if = "Option::is_none")]
157    pub mime_type: Option<String>,
158    /// Sizes as `WxH` or `any`.
159    #[serde(skip_serializing_if = "Option::is_none")]
160    pub sizes: Option<Vec<String>>,
161    /// The background the icon is drawn for.
162    #[serde(skip_serializing_if = "Option::is_none")]
163    pub theme: Option<IconTheme>,
164}
165
166impl ServerCardIcon {
167    /// Creates an icon at `src`.
168    pub fn new(src: impl Into<String>) -> Self {
169        Self { src: src.into(), mime_type: None, sizes: None, theme: None }
170    }
171
172    /// Sets the MIME type.
173    pub fn with_mime_type(mut self, mime_type: impl Into<String>) -> Self {
174        self.mime_type = Some(mime_type.into());
175        self
176    }
177
178    /// Sets the sizes the icon fits.
179    pub fn with_sizes(mut self, sizes: impl IntoIterator<Item = impl Into<String>>) -> Self {
180        self.sizes = Some(sizes.into_iter().map(Into::into).collect());
181        self
182    }
183
184    /// Sets the background theme.
185    pub fn with_theme(mut self, theme: IconTheme) -> Self {
186        self.theme = Some(theme);
187        self
188    }
189}
190
191/// The background an icon is designed for.
192#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
193#[serde(rename_all = "lowercase")]
194pub enum IconTheme {
195    /// A light background.
196    Light,
197    /// A dark background.
198    Dark,
199}
200
201/// The transport a remote endpoint speaks.
202#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
203#[serde(rename_all = "kebab-case")]
204pub enum RemoteTransport {
205    /// MCP Streamable HTTP.
206    StreamableHttp,
207    /// The deprecated HTTP+SSE transport.
208    Sse,
209}
210
211/// One endpoint a client can connect to.
212///
213/// # Example
214///
215/// ```rust
216/// use adk_tool::mcp::server::{RemoteTransport, ServerCardHeader, ServerCardRemote};
217///
218/// let remote = ServerCardRemote::new(RemoteTransport::StreamableHttp, "https://agent.example.com/mcp")
219///     .with_header(ServerCardHeader::new("Authorization").required().secret())
220///     .with_protocol_versions(["2025-11-25"]);
221/// assert_eq!(remote.headers.as_ref().map(Vec::len), Some(1));
222/// ```
223#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
224#[serde(rename_all = "camelCase")]
225#[non_exhaustive]
226pub struct ServerCardRemote {
227    /// The transport.
228    #[serde(rename = "type")]
229    pub transport: RemoteTransport,
230    /// The endpoint URL, or a template whose `{variables}` are listed in `variables`.
231    pub url: String,
232    /// Headers the client sends.
233    #[serde(skip_serializing_if = "Option::is_none")]
234    pub headers: Option<Vec<ServerCardHeader>>,
235    /// Variables referenced from `url`.
236    #[serde(skip_serializing_if = "Option::is_none")]
237    pub variables: Option<BTreeMap<String, ServerCardInput>>,
238    /// MCP protocol versions the endpoint supports.
239    #[serde(skip_serializing_if = "Option::is_none")]
240    pub supported_protocol_versions: Option<Vec<String>>,
241}
242
243impl ServerCardRemote {
244    /// Creates an endpoint description.
245    pub fn new(transport: RemoteTransport, url: impl Into<String>) -> Self {
246        Self {
247            transport,
248            url: url.into(),
249            headers: None,
250            variables: None,
251            supported_protocol_versions: None,
252        }
253    }
254
255    /// Adds a header the client sends.
256    pub fn with_header(mut self, header: ServerCardHeader) -> Self {
257        self.headers.get_or_insert_with(Vec::new).push(header);
258        self
259    }
260
261    /// Adds a variable referenced from the URL.
262    pub fn with_variable(mut self, name: impl Into<String>, input: ServerCardInput) -> Self {
263        self.variables.get_or_insert_with(BTreeMap::new).insert(name.into(), input);
264        self
265    }
266
267    /// Sets the supported MCP protocol versions.
268    pub fn with_protocol_versions(
269        mut self,
270        versions: impl IntoIterator<Item = impl Into<String>>,
271    ) -> Self {
272        self.supported_protocol_versions = Some(versions.into_iter().map(Into::into).collect());
273        self
274    }
275}
276
277/// A value a client supplies or a card presets: a URL variable or a header value.
278///
279/// # Example
280///
281/// ```rust
282/// use adk_tool::mcp::server::ServerCardInput;
283///
284/// let tenant = ServerCardInput::new().with_description("Tenant subdomain").required();
285/// assert_eq!(tenant.is_required, Some(true));
286/// ```
287#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
288#[serde(rename_all = "camelCase")]
289#[non_exhaustive]
290pub struct ServerCardInput {
291    /// What the value is.
292    #[serde(skip_serializing_if = "Option::is_none")]
293    pub description: Option<String>,
294    /// Whether the connection needs it.
295    #[serde(skip_serializing_if = "Option::is_none")]
296    pub is_required: Option<bool>,
297    /// Whether the value is a secret.
298    #[serde(skip_serializing_if = "Option::is_none")]
299    pub is_secret: Option<bool>,
300    /// `string`, `number`, `boolean` or `filepath`.
301    #[serde(skip_serializing_if = "Option::is_none")]
302    pub format: Option<InputFormat>,
303    /// The default value.
304    #[serde(skip_serializing_if = "Option::is_none")]
305    pub default: Option<String>,
306    /// An example shown while configuring.
307    #[serde(skip_serializing_if = "Option::is_none")]
308    pub placeholder: Option<String>,
309    /// A preset value the user cannot change.
310    #[serde(skip_serializing_if = "Option::is_none")]
311    pub value: Option<String>,
312    /// The allowed values.
313    #[serde(skip_serializing_if = "Option::is_none")]
314    pub choices: Option<Vec<String>>,
315}
316
317impl ServerCardInput {
318    /// Creates an input with no properties set.
319    pub fn new() -> Self {
320        Self::default()
321    }
322
323    /// Sets the description.
324    pub fn with_description(mut self, description: impl Into<String>) -> Self {
325        self.description = Some(description.into());
326        self
327    }
328
329    /// Marks the input as required.
330    pub fn required(mut self) -> Self {
331        self.is_required = Some(true);
332        self
333    }
334
335    /// Marks the input as a secret.
336    pub fn secret(mut self) -> Self {
337        self.is_secret = Some(true);
338        self
339    }
340
341    /// Sets the preset value.
342    pub fn with_value(mut self, value: impl Into<String>) -> Self {
343        self.value = Some(value.into());
344        self
345    }
346}
347
348/// The format of a [`ServerCardInput`].
349#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
350#[serde(rename_all = "lowercase")]
351pub enum InputFormat {
352    /// A string.
353    String,
354    /// A decimal number.
355    Number,
356    /// `true` or `false`.
357    Boolean,
358    /// A path on the user's file system.
359    Filepath,
360}
361
362/// A header a client sends to a remote endpoint (`KeyValueInput` in SEP-2127).
363///
364/// # Example
365///
366/// ```rust
367/// use adk_tool::mcp::server::{ServerCardHeader, ServerCardInput};
368///
369/// let auth = ServerCardHeader::new("Authorization")
370///     .with_description("Bearer token issued by the site owner")
371///     .with_value("Bearer {token}")
372///     .with_variable("token", ServerCardInput::new().required().secret())
373///     .required()
374///     .secret();
375/// assert_eq!(auth.name, "Authorization");
376/// ```
377#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
378#[serde(rename_all = "camelCase")]
379#[non_exhaustive]
380pub struct ServerCardHeader {
381    /// The header name.
382    pub name: String,
383    /// The value's properties.
384    #[serde(flatten)]
385    pub input: ServerCardInput,
386    /// Variables referenced from `value`.
387    #[serde(skip_serializing_if = "Option::is_none")]
388    pub variables: Option<BTreeMap<String, ServerCardInput>>,
389}
390
391impl ServerCardHeader {
392    /// Creates a header description.
393    pub fn new(name: impl Into<String>) -> Self {
394        Self { name: name.into(), input: ServerCardInput::default(), variables: None }
395    }
396
397    /// Sets the description.
398    pub fn with_description(mut self, description: impl Into<String>) -> Self {
399        self.input.description = Some(description.into());
400        self
401    }
402
403    /// Sets the value, which may reference variables as `{name}`.
404    pub fn with_value(mut self, value: impl Into<String>) -> Self {
405        self.input.value = Some(value.into());
406        self
407    }
408
409    /// Adds a variable referenced from the value.
410    pub fn with_variable(mut self, name: impl Into<String>, input: ServerCardInput) -> Self {
411        self.variables.get_or_insert_with(BTreeMap::new).insert(name.into(), input);
412        self
413    }
414
415    /// Marks the header as required.
416    pub fn required(mut self) -> Self {
417        self.input.is_required = Some(true);
418        self
419    }
420
421    /// Marks the header's value as a secret.
422    pub fn secret(mut self) -> Self {
423        self.input.is_secret = Some(true);
424        self
425    }
426}
427
428/// An AI Catalog document (`application/ai-catalog+json`).
429///
430/// # Example
431///
432/// ```rust
433/// use adk_tool::mcp::server::{AiCatalog, AiCatalogEntry, AiCatalogHost};
434///
435/// let catalog = AiCatalog::new([AiCatalogEntry::server_card_url(
436///     "urn:air:example.com:mcp:shop",
437///     "https://agent.example.com/mcp/server-card",
438/// )])
439/// .with_host(AiCatalogHost::new("Example Solar"));
440/// let json = serde_json::to_value(&catalog)?;
441/// assert_eq!(json["specVersion"], "1.0");
442/// assert_eq!(json["entries"][0]["type"], "application/mcp-server-card+json");
443/// # Ok::<(), serde_json::Error>(())
444/// ```
445#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
446#[serde(rename_all = "camelCase")]
447#[non_exhaustive]
448pub struct AiCatalog {
449    /// The AI Catalog version, `1.0`.
450    pub spec_version: String,
451    /// Who operates the catalog.
452    #[serde(skip_serializing_if = "Option::is_none")]
453    pub host: Option<AiCatalogHost>,
454    /// The artifacts the catalog lists.
455    pub entries: Vec<AiCatalogEntry>,
456}
457
458impl AiCatalog {
459    /// Creates a catalog listing `entries`.
460    pub fn new(entries: impl IntoIterator<Item = AiCatalogEntry>) -> Self {
461        Self {
462            spec_version: AI_CATALOG_SPEC_VERSION.to_string(),
463            host: None,
464            entries: entries.into_iter().collect(),
465        }
466    }
467
468    /// Names the catalog's operator.
469    pub fn with_host(mut self, host: AiCatalogHost) -> Self {
470        self.host = Some(host);
471        self
472    }
473}
474
475/// The operator of an AI Catalog.
476///
477/// # Example
478///
479/// ```rust
480/// use adk_tool::mcp::server::AiCatalogHost;
481///
482/// let host = AiCatalogHost::new("Example Solar").with_identifier("did:web:example.com");
483/// assert_eq!(host.identifier.as_deref(), Some("did:web:example.com"));
484/// ```
485#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
486#[serde(rename_all = "camelCase")]
487#[non_exhaustive]
488pub struct AiCatalogHost {
489    /// The operator's name.
490    pub display_name: String,
491    /// A verifiable identifier, such as a DID or a domain.
492    #[serde(skip_serializing_if = "Option::is_none")]
493    pub identifier: Option<String>,
494    /// The operator's documentation.
495    #[serde(skip_serializing_if = "Option::is_none")]
496    pub documentation_url: Option<String>,
497    /// The operator's logo.
498    #[serde(skip_serializing_if = "Option::is_none")]
499    pub logo_url: Option<String>,
500}
501
502impl AiCatalogHost {
503    /// Creates host information for `display_name`.
504    pub fn new(display_name: impl Into<String>) -> Self {
505        Self {
506            display_name: display_name.into(),
507            identifier: None,
508            documentation_url: None,
509            logo_url: None,
510        }
511    }
512
513    /// Sets the verifiable identifier.
514    pub fn with_identifier(mut self, identifier: impl Into<String>) -> Self {
515        self.identifier = Some(identifier.into());
516        self
517    }
518
519    /// Sets the documentation URL.
520    pub fn with_documentation_url(mut self, url: impl Into<String>) -> Self {
521        self.documentation_url = Some(url.into());
522        self
523    }
524}
525
526/// One artifact in an AI Catalog: here, an MCP Server Card by URL or inline.
527///
528/// The card carries its own title, description and version, so the entry repeats none of
529/// them, as the SEP-2127 discovery document recommends.
530///
531/// # Example
532///
533/// ```rust
534/// use adk_tool::mcp::server::{AiCatalogContent, AiCatalogEntry};
535///
536/// let entry = AiCatalogEntry::server_card_url(
537///     "urn:air:example.com:mcp:shop",
538///     "https://agent.example.com/mcp/server-card",
539/// );
540/// assert!(matches!(entry.content, AiCatalogContent::Url(_)));
541/// ```
542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
543#[serde(rename_all = "camelCase")]
544#[non_exhaustive]
545pub struct AiCatalogEntry {
546    /// A stable identifier, `urn:air:{publisher}:{namespace}:{name}` for open systems.
547    pub identifier: String,
548    /// The artifact's type; [`SERVER_CARD_MEDIA_TYPE`] for a Server Card.
549    #[serde(rename = "type")]
550    pub artifact_type: String,
551    /// Where the artifact is, or the artifact itself.
552    #[serde(flatten)]
553    pub content: AiCatalogContent,
554    /// Keywords for filtering.
555    #[serde(skip_serializing_if = "Option::is_none")]
556    pub tags: Option<Vec<String>>,
557}
558
559impl AiCatalogEntry {
560    /// An entry pointing at the Server Card served at `url`.
561    pub fn server_card_url(identifier: impl Into<String>, url: impl Into<String>) -> Self {
562        Self {
563            identifier: identifier.into(),
564            artifact_type: SERVER_CARD_MEDIA_TYPE.to_string(),
565            content: AiCatalogContent::Url(url.into()),
566            tags: None,
567        }
568    }
569
570    /// An entry carrying `card` inline.
571    ///
572    /// # Errors
573    ///
574    /// Returns the serialisation error when `card` holds a value JSON cannot represent.
575    pub fn server_card_inline(
576        identifier: impl Into<String>,
577        card: &ServerCard,
578    ) -> serde_json::Result<Self> {
579        Ok(Self {
580            identifier: identifier.into(),
581            artifact_type: SERVER_CARD_MEDIA_TYPE.to_string(),
582            content: AiCatalogContent::Data(serde_json::to_value(card)?),
583            tags: None,
584        })
585    }
586
587    /// Sets the entry's tags.
588    pub fn with_tags(mut self, tags: impl IntoIterator<Item = impl Into<String>>) -> Self {
589        self.tags = Some(tags.into_iter().map(Into::into).collect());
590        self
591    }
592}
593
594/// Exactly one of an AI Catalog entry's `url` or `data` members.
595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
596#[serde(rename_all = "lowercase")]
597pub enum AiCatalogContent {
598    /// The artifact is served at this URL.
599    Url(String),
600    /// The artifact, inline.
601    Data(Value),
602}
603
604/// The AI Catalog identifier for a card named `namespace/name`:
605/// `urn:air:{reversed namespace}:mcp:{name}`, so `com.example/shop` becomes
606/// `urn:air:example.com:mcp:shop` as in the SEP-2127 discovery document.
607pub(crate) fn catalog_identifier(card_name: &str) -> String {
608    let (namespace, name) = card_name.split_once('/').unwrap_or(("", card_name));
609    let publisher: Vec<&str> = namespace.split('.').rev().collect();
610    format!("urn:air:{}:mcp:{name}", publisher.join("."))
611}
612
613#[cfg(test)]
614mod tests {
615    use super::*;
616    use serde_json::json;
617
618    #[test]
619    fn the_catalog_identifier_reverses_the_namespace() {
620        assert_eq!(catalog_identifier("com.example/weather"), "urn:air:example.com:mcp:weather");
621        assert_eq!(catalog_identifier("io.github.acme/shop"), "urn:air:acme.github.io:mcp:shop");
622    }
623
624    #[test]
625    fn a_header_flattens_its_input_properties() {
626        let header = ServerCardHeader::new("Authorization")
627            .with_value("Bearer {token}")
628            .with_variable("token", ServerCardInput::new().required().secret())
629            .required()
630            .secret();
631        assert_eq!(
632            serde_json::to_value(&header).unwrap(),
633            json!({
634                "name": "Authorization",
635                "isRequired": true,
636                "isSecret": true,
637                "value": "Bearer {token}",
638                "variables": { "token": { "isRequired": true, "isSecret": true } },
639            })
640        );
641    }
642
643    #[test]
644    fn an_entry_carries_exactly_one_of_url_or_data() {
645        let by_url = AiCatalogEntry::server_card_url("urn:air:example.com:mcp:shop", "https://x/y");
646        assert_eq!(
647            serde_json::to_value(&by_url).unwrap(),
648            json!({
649                "identifier": "urn:air:example.com:mcp:shop",
650                "type": SERVER_CARD_MEDIA_TYPE,
651                "url": "https://x/y",
652            })
653        );
654        let card = ServerCard {
655            schema: SERVER_CARD_SCHEMA_URL.into(),
656            name: "com.example/shop".into(),
657            version: "1.0.0".into(),
658            description: "Shop".into(),
659            title: None,
660            website_url: None,
661            repository: None,
662            icons: None,
663            remotes: None,
664            meta: None,
665        };
666        let inline =
667            AiCatalogEntry::server_card_inline("urn:air:example.com:mcp:shop", &card).unwrap();
668        let value = serde_json::to_value(&inline).unwrap();
669        assert_eq!(value["data"]["name"], "com.example/shop");
670        assert!(value.get("url").is_none());
671        let back: AiCatalogEntry = serde_json::from_value(value).unwrap();
672        assert_eq!(back, inline);
673    }
674}