Skip to main content

Sitemap MCP is a Model Context Protocol (MCP) server for fetching, parsing, analyzing, and visualizing website sitemaps

Project description

Sitemap MCP Server

Model Context Protocol (MCP) Server for sitemap analysis and visualization

License PyPI Python Version Status

The Sitemap MCP Server provides AI agents and MCP clients with powerful tools for fetching, parsing, analyzing, and visualizing website sitemaps. It handles all standard sitemap formats including XML, Google News, and plain text sitemaps.

For Developers: If you're interested in contributing to this project or setting up a development environment, please see DEVELOPERS.md for development guidelines.

Installation

Make sure uv is installed.

Claude Desktop & Cursor

Add this entry to your claude_desktop_config.json, Cursor settings, etc.:

{
  "mcpServers": {
    "sitemap": {
      "command": "uvx",
      "args": ["sitemap-mcp-server"],
      "env": { "TRANSPORT": "stdio" }
    }
  }
}

Restart Claude if it's running. For Cursor simply press refresh and/or enable the MCP Server in the settings.

SSE Transport

If you want to use the SSE transport, follow these steps:

  1. Start the server:
uvx sitemap-mcp-server
  1. Configure your MCP Client, e.g. Cursor:
{
  "mcpServers": {
    "sitemap": {
      "transport": "sse",
      "url": "http://localhost:8050/sse"
    }
  }
}

Local Development

For instructions on building and running the project from source, please refer to the DEVELOPERS.md guide.

Usage

Tools

The following tools are available via the MCP server:

  • get_sitemap_tree - Fetch and parse the sitemap tree from a website URL

    • Arguments: url (website URL), include_pages (optional, boolean)
    • Returns: JSON representation of the sitemap tree structure
  • get_sitemap_pages - Get all pages from a website's sitemap with filtering options

    • Arguments: url (website URL), limit (optional), include_metadata (optional), route (optional), sitemap_url (optional), cursor (optional)
    • Returns: JSON list of pages with pagination metadata
  • get_sitemap_stats - Get statistics about a website's sitemap

    • Arguments: url (website URL)
    • Returns: JSON object with sitemap statistics including page counts, modification dates, and subsitemap details
  • parse_sitemap_content - Parse a sitemap directly from its XML or text content

    • Arguments: content (sitemap XML content), include_pages (optional, boolean)
    • Returns: JSON representation of the parsed sitemap

Prompts

The server includes ready-to-use prompts that appear as templates in Claude Desktop. After installing the server, you'll see these templates in the "Templates" menu (click the + icon next to the message input):

  • Analyze Sitemap: Provides comprehensive structure analysis of a website's sitemap
  • Check Sitemap Health: Evaluates SEO and health metrics of a sitemap
  • Extract URLs from Sitemap: Extracts and filters specific URLs from a sitemap
  • Find Missing Content in Sitemap: Identifies content gaps in a website's sitemap
  • Visualize Sitemap Structure: Creates a Mermaid.js diagram visualization of sitemap structure

To use these prompts:

  1. Click the + icon next to the message input in Claude Desktop
  2. Select the desired template from the list
  3. Fill in the website URL when prompted
  4. Claude will execute the appropriate sitemap analysis

Examples

Fetch a Complete Sitemap

{
  "name": "get_sitemap_tree",
  "arguments": {
    "url": "https://example.com",
    "include_pages": true
  }
}

Get Pages with Filtering and Pagination

Filter by Route
{
  "name": "get_sitemap_pages",
  "arguments": {
    "url": "https://example.com",
    "limit": 100,
    "include_metadata": true,
    "route": "/blog/"
  }
}
Filter by Specific Subsitemap
{
  "name": "get_sitemap_pages",
  "arguments": {
    "url": "https://example.com",
    "limit": 100,
    "include_metadata": true,
    "sitemap_url": "https://example.com/blog-sitemap.xml"
  }
}
Cursor-Based Pagination

The server implements MCP cursor-based pagination to handle large sitemaps efficiently:

Initial Request:

{
  "name": "get_sitemap_pages",
  "arguments": {
    "url": "https://example.com",
    "limit": 50
  }
}

Response with Pagination:

{
  "base_url": "https://example.com",
  "pages": [...],  // First batch of pages
  "limit": 50,
  "nextCursor": "eyJwYWdlIjoxfQ=="
}

Subsequent Request with Cursor:

{
  "name": "get_sitemap_pages",
  "arguments": {
    "url": "https://example.com",
    "limit": 50,
    "cursor": "eyJwYWdlIjoxfQ=="
  }
}

When there are no more results, the nextCursor field will be absent from the response.

Get Sitemap Statistics

{
  "name": "get_sitemap_stats",
  "arguments": {
    "url": "https://example.com"
  }
}

The response includes both total statistics and detailed stats for each subsitemap:

{
  "total": {
    "url": "https://example.com",
    "page_count": 150,
    "sitemap_count": 3,
    "sitemap_types": ["WebsiteSitemap", "NewsSitemap"],
    "priority_stats": {
      "min": 0.1,
      "max": 1.0,
      "avg": 0.65
    },
    "last_modified_count": 120
  },
  "subsitemaps": [
    {
      "url": "https://example.com/sitemap.xml",
      "type": "WebsiteSitemap",
      "page_count": 100,
      "priority_stats": {
        "min": 0.3,
        "max": 1.0,
        "avg": 0.7
      },
      "last_modified_count": 80
    },
    {
      "url": "https://example.com/blog/sitemap.xml",
      "type": "WebsiteSitemap",
      "page_count": 50,
      "priority_stats": {
        "min": 0.1,
        "max": 0.9,
        "avg": 0.5
      },
      "last_modified_count": 40
    }
  ]
}

This allows MCP clients to understand which subsitemaps might be of interest for further investigation. You can then use the sitemap_url parameter in get_sitemap_pages to filter pages from a specific subsitemap.

Parse Sitemap Content Directly

{
  "name": "parse_sitemap_content",
  "arguments": {
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"><url><loc>https://example.com/</loc></url></urlset>",
    "include_pages": true
  }
}

Acknowledgements

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sitemap_mcp_server-0.1.1.tar.gz (54.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sitemap_mcp_server-0.1.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file sitemap_mcp_server-0.1.1.tar.gz.

File metadata

  • Download URL: sitemap_mcp_server-0.1.1.tar.gz
  • Upload date:
  • Size: 54.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for sitemap_mcp_server-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1366a313b1b2c306d63c9bdfb1f1f5b2b2c50d75fa9ddeb44e192b91d3f95b83
MD5 1b1929f157c7377ad0d4d3ec2b4135b3
BLAKE2b-256 524cc90a03be813735835dd1f2db5d38992338e32815483d2ff8578b8aaea8de

See more details on using hashes here.

File details

Details for the file sitemap_mcp_server-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sitemap_mcp_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aaa4a95a1e160da3c9110791a020054d95f726237468f7346c6919ce21c60f35
MD5 7abdd2a799375653099258a7ecff9709
BLAKE2b-256 fddc449dd7816703b8d2d57a742d24465cb0bf4ba86423a9161c6a72f32aad1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page