e15f284228
New Advanced page covering serving a card, publishing on a brand domain, static publishing, discovery and connect, ETag revalidation, and the security model (advisory cards, endpoint-keyed dedup, host scoped consent, SSRF policy defaults). Tutorials are pyright-checked docs_src modules proved against the real SDK by tests/docs_src/test_server_cards.py.
17 lines
457 B
Python
17 lines
457 B
Python
from pathlib import Path
|
|
|
|
from mcp.shared.experimental.server_card import Remote, ServerCard
|
|
|
|
card = ServerCard(
|
|
name="com.example/weather",
|
|
version="1.4.0",
|
|
description="Hourly forecasts.",
|
|
title="Weather",
|
|
website_url="https://example.com",
|
|
remotes=[Remote(type="streamable-http", url="https://mcp.example.com/mcp")],
|
|
)
|
|
|
|
|
|
def publish(path: Path) -> None:
|
|
path.write_text(card.model_dump_json(by_alias=True, exclude_none=True))
|