Skip to main content

Module agentic_discovery

Module agentic_discovery 

Source
Expand description

Agentic discovery emitters (issue #552).

Coordinates three modern agentic-discovery protocol files alongside the existing robots.txt / sitemap.xml family:

  1. agents.txt — a robots.txt-shaped plain-text spec listing AI agent identifiers and allow/disallow rules. Emitted at /agents.txt.
  2. .well-known/ai-plugin.json — the OpenAI plugin manifest spec (still the de-facto plugin descriptor across agent runtimes in 2026). Emitted at /.well-known/ai-plugin.json.
  3. MCP registry (/.well-known/mcp.json) — Model Context Protocol registry listing exposed resources, tools, and prompts over 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§

AgentRule
A single User-agent: … block for agents.txt. Mirrors the robots.txt grammar but is also reachable from per-page frontmatter (via the agents: key on a .meta.json sidecar).
AgenticDiscoveryPlugin
Coordinator plugin that fans out to the three agentic-discovery emitters. Registered once in register_default_plugins and runs in after_compile.
AgentsConfig
The [agents] section of ssg.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.
McpPromptDecl
Static MCP prompt declaration.
McpResource
One MCP resource entry. Public so integration tests can construct instances directly and so consumers of the library can fan their own resources in via post-emit hooks.
McpToolDecl
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_json so 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.json sidecars under ctx.site_dir (with the same build_dir/.meta fallback 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.txt file under ctx.site_dir.
write_ai_plugin_json
Render and write .well-known/ai-plugin.json under ctx.site_dir.
write_mcp_registry
Render and write .well-known/mcp.json under ctx.site_dir.