Crawl and analyze XML sitemaps with regex filtering via sitemap-mcp-server (npx)
sitemap-mcp-server is an MCP server for sitemap crawling and URL discovery. It exposes 3 tools: analyzesitemap (structure stats), fetchsitemap (fetch + regex/LLM filter), and detect_changes (diff against previous crawl). The regex filtering and analysis tools work credential-free; the LLM filtering mode requires env vars for a provider API key. Useful for agents that need to discover and navigate website structure, monitor content changes, or plan scraping workflows.
Recipe: Crawl and analyze XML sitemaps via sitemap-mcp-server (npx)
Package: sitemap-mcp-server v1.0.1 (npm) Transport: stdio (NDJSON framing) Launch: npx -y sitemap-mcp-server Auth: none (LLM filtering mode optional, requires PROVIDER/API_KEY/MODEL env vars) Cold-start: ~2s (npx install)
Server identity
serverInfo: { name: "sitemap-mcp-server", version: "1.0.0" }
capabilities: { tools: {} }Tool inventory (3 tools)
| Tool | Purpose |
|---|---|
analyze_sitemap | Parse sitemap.xml and return statistics: total URLs, priority distribution, pattern breakdown, degree-level categorization |
fetch_sitemap | Fetch URLs from sitemap with regex include/exclude patterns OR LLM-powered intent filtering. Returns structured URL objects with loc, lastmod, changefreq, priority |
detect_changes | Compare current sitemap against a previous crawl to find added/removed/changed URLs (keyed by university_key for state persistence) |
Verified trace (3 tool calls across 2 sitemaps)
1. analyze_sitemap — structure analysis on docs.anthropic.com (3,123 URLs)
→ {"jsonrpc":"2.0","id":10,"method":"tools/call","params":{"name":"analyze_sitemap","arguments":{"url":"https://docs.anthropic.com/sitemap.xml"}}}
← {
"total_urls": 3123,
"by_degree_level": { "postgraduate": 696, "undergraduate": 188, "unknown": 2239 },
"by_pattern": { "/docs/": 3122 },
"priority_stats": {
"avg": "0.81",
"distribution": { "0.5": 1, "0.7": 1331, "0.8": 122, "0.9": 1637, "1.0": 32 }
}
}2. fetch_sitemap — regex-filtered URL extraction
→ {"jsonrpc":"2.0","id":11,"method":"tools/call","params":{"name":"fetch_sitemap","arguments":{"url":"https://docs.anthropic.com/sitemap.xml","include_patterns":[".*tool-use.*"]}}}
← {
"total": 300,
"pg_count": 24, "ug_count": 12, "unknown_count": 264,
"urls": [
{ "loc": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview", "priority": 1 },
{ "loc": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/how-tool-use-works", "priority": 0.8 },
{ "loc": "https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools", "priority": 0.8 },
// ... 300 URLs across en/ja/ko locales
]
}Notes
- NDJSON framing (newline-delimited)
- The
degree_levelfield andby_degree_levelbreakdown appear university-oriented (pg/ug categorization heuristic built into the server) — these fields are present but not meaningful for non-university sitemaps fetch_sitemapsupports bothinclude_patternsandexclude_patternsas arrays of regex stringsdetect_changesrequires auniversity_keyfor state persistence between runs — useful for monitoring crawls- Works on any public sitemap.xml including sitemap index files
- The LLM filtering mode (
use_llm: true+user_intent) is powerful for semantic filtering but requires API credentials in environment variables
{ "server": "sitemap-mcp-server", "version": "1.0.1", "transport": "stdio", "framing": "ndjson", "launch": "npx -y sitemap-mcp-server", "tools_count": 3, "tools_exercised": ["analyze_sitemap", "fetch_sitemap"], "results": [ { "tool": "analyze_sitemap", "status": "ok", "target": "https://docs.anthropic.com/sitemap.xml", "total_urls": 3123, "priority_avg": 0.81 }, { "tool": "fetch_sitemap", "status": "ok", "target": "https://docs.anthropic.com/sitemap.xml", "filter": ".*tool-use.*", "matched_urls": 300 } ], "cold_start_s": 2, "all_succeeded": true }