Skip to main content
Glama
sharozdawa

indexnow-mcp

by sharozdawa

indexnow_submit_sitemap

Submit sitemap URLs to IndexNow for instant search engine indexing. Extracts URLs from XML sitemaps and sends them to search engines like Bing and Yandex.

Instructions

Fetch a sitemap XML, extract all URLs, and submit them to IndexNow for instant indexing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sitemap_urlYesURL of the XML sitemap to process
api_keyYesYour IndexNow API key
hostYesYour website hostname (e.g., example.com)
enginesNoSearch engines to submit to (default: all)
limitNoMax URLs to submit (default: all)

Implementation Reference

  • Handler function for 'indexnow_submit_sitemap' tool which fetches a sitemap, parses it, and submits URLs to IndexNow.
    async ({ sitemap_url, api_key, host, engines, limit }) => {
      try {
        const response = await fetch(sitemap_url, {
          signal: AbortSignal.timeout(30000),
        });
    
        if (!response.ok) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Error: Failed to fetch sitemap (HTTP ${response.status})`,
              },
            ],
          };
        }
    
        const xml = await response.text();
        let urls = parseSitemap(xml);
    
        if (urls.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: "Error: No URLs found in sitemap. Make sure it's a valid XML sitemap with <loc> tags.",
              },
            ],
          };
        }
    
        const totalFound = urls.length;
        if (limit && limit > 0) {
          urls = urls.slice(0, limit);
        }
        if (urls.length > 10000) {
          urls = urls.slice(0, 10000);
        }
    
        const results = await submitToIndexNow(urls, api_key, host, undefined, engines);
        const successful = results.filter((r) => r.success).length;
    
        let output = `## Sitemap IndexNow Submission\n\n`;
        output += `**Sitemap:** ${sitemap_url}\n`;
        output += `**URLs found:** ${totalFound}\n`;
        output += `**URLs submitted:** ${urls.length}\n`;
        output += `**Engines successful:** ${successful}/${results.length}\n\n`;
    
        output += `| Engine | Status | Result |\n|--------|--------|--------|\n`;
        for (const r of results) {
          output += `| ${r.engine} | ${r.status} | ${r.success ? "Success" : "Failed"} - ${r.message} |\n`;
        }
    
        return { content: [{ type: "text" as const, text: output }] };
      } catch (error) {
        return {
          content: [
            {
  • src/index.ts:307-319 (registration)
    Registration of the 'indexnow_submit_sitemap' tool using server.tool.
    server.tool(
      "indexnow_submit_sitemap",
      "Fetch a sitemap XML, extract all URLs, and submit them to IndexNow for instant indexing.",
      {
        sitemap_url: z.string().url().describe("URL of the XML sitemap to process"),
        api_key: z.string().describe("Your IndexNow API key"),
        host: z.string().describe("Your website hostname (e.g., example.com)"),
        engines: z
          .array(z.enum(["bing", "yandex", "naver", "seznam", "indexnow"]))
          .optional()
          .describe("Search engines to submit to (default: all)"),
        limit: z.number().optional().describe("Max URLs to submit (default: all)"),
      },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sharozdawa/indexnow-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server