Expand description
Agentic discovery emitters (issue #552).
Coordinates three modern agentic-discovery protocol files alongside
the existing robots.txt / sitemap.xml family:
agents.txt— arobots.txt-shaped plain-text spec listing AI agent identifiers and allow/disallow rules. Emitted at/agents.txt..well-known/ai-plugin.json— theOpenAIplugin manifest spec (still the de-facto plugin descriptor across agent runtimes in 2026). Emitted at/.well-known/ai-plugin.json.- MCP registry (
/.well-known/mcp.json) — Model Context Protocol registry listing exposedresources,tools, andpromptsover HTTP transport (the default delivery channel).
Each emitter is opt-in per the [agents] section of ssg.toml.
When [agents] is absent (or every flag is false), this plugin is
a no-op — none of the three files are written. This preserves the
“you didn’t ask for it” guarantee.
§Configuration shape
[agents]
agents_txt = true
ai_plugin = true
[agents.mcp]
enabled = true
transport = "http"
auto_resources = true # walk content sidecars and emit MCP
# resources for every public page
# Per-agent overrides for agents.txt (robots.txt style)
[agents.rules.gptbot]
allow = ["/blog/*"]
disallow = ["/"]Per-page frontmatter may also carry an agents.disallow list (read
from .meta.json sidecars by the MCP emitter), which causes the
page to be skipped when populating MCP resources.
Structs§
- Agent
Rule - A single
User-agent: …block foragents.txt. Mirrors therobots.txtgrammar but is also reachable from per-page frontmatter (via theagents:key on a.meta.jsonsidecar). - Agentic
Discovery Plugin - Coordinator plugin that fans out to the three agentic-discovery
emitters. Registered once in
register_default_pluginsand runs inafter_compile. - Agents
Config - The
[agents]section ofssg.toml. Every field is optional; absent values fall back to safe “off” defaults so that omitting the section produces no new files. - McpConfig
- MCP registry settings. Mirrors the JSON shape consumed by clients
(Claude Desktop, IDE integrations, …) but expressed in TOML so site
authors can edit it alongside the rest of
ssg.toml. - McpPrompt
Decl - Static MCP prompt declaration.
- McpResource
- One MCP
resourceentry. Public so integration tests can construct instances directly and so consumers of the library can fan their own resources in via post-emit hooks. - McpTool
Decl - Static MCP tool declaration. The emitter passes these through verbatim to the registry JSON — schema validation is the consumer’s problem.
Functions§
- build_
manifest - Pure-function manifest builder — split from
write_ai_plugin_jsonso unit tests can assert the JSON shape without touching the filesystem. - build_
registry - Pure-function registry builder, callable from tests without I/O.
- collect_
mcp_ resources - Walk
.meta.jsonsidecars underctx.site_dir(with the samebuild_dir/.metafallback used by RSS/Atom/JSON-Feed) and produce one MCP resource per public page. - render_
agents_ txt - Pure-function renderer kept separate from I/O so unit tests can assert the exact byte layout without touching the filesystem.
- write_
agents_ txt - Render and write the
agents.txtfile underctx.site_dir. - write_
ai_ plugin_ json - Render and write
.well-known/ai-plugin.jsonunderctx.site_dir. - write_
mcp_ registry - Render and write
.well-known/mcp.jsonunderctx.site_dir.