Skip to main content

collect_mcp_resources

Function collect_mcp_resources 

Source
pub fn collect_mcp_resources(
    ctx: &PluginContext,
    cfg: &SsgConfig,
) -> Vec<McpResource>
Expand description

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.

Public = published != "false" AND draft != "true" AND agents.disallow doesn’t contain "*" or "mcp".

§Examples

use ssg::cmd::SsgConfig;
use ssg::plugin::PluginContext;
use ssg::postprocess::agentic_discovery::collect_mcp_resources;
let tmp = tempfile::tempdir().unwrap();
let cfg = SsgConfig::builder()
    .site_name("Example".into())
    .base_url("https://example.com".into())
    .build()
    .unwrap();
let ctx = PluginContext::new(tmp.path(), tmp.path(), tmp.path(), tmp.path());
// Empty dir, no sidecars -> empty result.
assert!(collect_mcp_resources(&ctx, &cfg).is_empty());