Skip to main content
Glama
MiguelAlvRed

Store Scraper MCP

by MiguelAlvRed

reviews

Retrieve app reviews from App Store and Google Play Store with pagination, sorting options, and country-specific data for analysis and monitoring.

Instructions

Get app reviews with pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoiTunes trackId of the app
appIdNoBundle ID of the app
countryNoTwo-letter country code (default: us)us
pageNoPage number (1-10, default: 1)
sortNoSort order: mostRecent or mostHelpfulmostRecent

Implementation Reference

  • Main execution handler for the 'reviews' tool. Builds reviews URL, fetches JSON RSS feed, parses reviews, and returns structured JSON response with pagination.
    async function handleReviews(args) {
      try {
        const {
          id,
          appId,
          country = 'us',
          page = 1,
          sort = 'mostRecent',
        } = args;
    
        if (!id && !appId) {
          throw new Error('Either id or appId must be provided');
        }
    
        const url = buildReviewsUrl({ id, appId, country, page, sort });
        const data = await fetchJSON(url);
        const reviews = parseReviews(data);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                page,
                reviews,
                count: reviews.length,
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ error: error.message }, null, 2),
            },
          ],
          isError: true,
        };
      }
    }
  • Tool schema definition including name, description, and input schema for validation in ListTools response.
      name: 'reviews',
      description: 'Get app reviews with pagination',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'number',
            description: 'iTunes trackId of the app',
          },
          appId: {
            type: 'string',
            description: 'Bundle ID of the app',
          },
          country: {
            type: 'string',
            description: 'Two-letter country code (default: us)',
            default: 'us',
          },
          page: {
            type: 'number',
            description: 'Page number (1-10, default: 1)',
            default: 1,
          },
          sort: {
            type: 'string',
            description: 'Sort order: mostRecent or mostHelpful',
            default: 'mostRecent',
            enum: ['mostRecent', 'mostHelpful'],
          },
        },
      },
    },
  • Registration of the 'reviews' tool handler in the CallToolRequestSchema switch dispatcher.
    case 'reviews':
      return await handleReviews(args);
  • Helper parser that normalizes iTunes RSS feed reviews into a structured array of review objects.
    export function parseReviews(data) {
      if (!data || !data.feed || !data.feed.entry) {
        return [];
      }
    
      // First entry is app metadata, skip it
      const reviews = Array.isArray(data.feed.entry) 
        ? data.feed.entry.slice(1) 
        : [];
    
      return reviews.map(entry => {
        const author = entry.author?.[0] || entry.author || {};
        const rating = entry['im:rating']?.label || entry['im:rating'] || '0';
        const version = entry['im:version']?.label || entry['im:version'] || null;
        const title = entry.title?.label || entry.title || null;
        const content = entry.content?.label || entry.content?.[0]?.label || entry.content || null;
        const updated = entry.updated?.label || entry.updated || null;
        const id = entry.id?.label || entry.id || null;
    
        // Extract user ID from author URI if available
        let userId = null;
        let userUrl = null;
        if (author.uri?.label || author.uri) {
          const uri = author.uri.label || author.uri;
          const match = uri.match(/\/id(\d+)/);
          if (match) {
            userId = match[1];
            userUrl = uri;
          }
        }
    
        return {
          id: id || null,
          userName: author.name?.label || author.name || 'Anonymous',
          userUrl: userUrl || null,
          version: version,
          score: parseInt(rating, 10) || 0,
          title: title,
          text: content,
          updated: updated,
          url: entry.link?.[0]?.attributes?.href || entry.link?.attributes?.href || null,
        };
      });
    }
  • Helper function to construct the App Store reviews RSS feed URL with pagination and sorting.
    export function buildReviewsUrl(params) {
      const { id, appId, country = 'us', page = 1, sort = 'mostRecent' } = params;
      
      if (!id && !appId) {
        throw new Error('Either id or appId must be provided');
      }
      
      const appIdParam = id || appId;
      const pageNum = Math.min(page, 10); // Max 10 pages
      const sortParam = sort === 'mostHelpful' ? 'mostHelpful' : 'mostRecent';
      
      return `${ITUNES_BASE}/${country}/rss/customerreviews/page=${pageNum}/id=${appIdParam}/sortby=${sortParam}/json`;
    }

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/MiguelAlvRed/mobile-store-scraper-mcp'

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