Skip to main content
Glama

mcp-appstore

by appreply-co
reviews.js1.74 kB
'use strict'; const R = require('ramda'); const common = require('./common'); const app = require('./app'); const c = require('./constants'); function ensureArray (value) { if (!value) { return []; } if (Array.isArray(value)) { return value; } return [value]; } function cleanList (results) { const reviews = ensureArray(results.feed.entry); return reviews.map((review) => ({ id: review.id.label, userName: review.author.name.label, userUrl: review.author.uri.label, version: review['im:version'].label, score: parseInt(review['im:rating'].label), title: review.title.label, text: review.content.label, url: review.link.attributes.href })); } const reviews = (opts) => new Promise((resolve) => { validate(opts); if (opts.id) { resolve(opts.id); } else if (opts.appId) { resolve(app(opts).then(app => app.id)); } }) .then((id) => { opts = opts || {}; opts.sort = opts.sort || c.sort.RECENT; opts.page = opts.page || 1; opts.country = opts.country || 'us'; const url = `https://itunes.apple.com/${opts.country}/rss/customerreviews/page=${opts.page}/id=${id}/sortby=${opts.sort}/json`; return common.request(url, {}, opts.requestOptions); }) .then(JSON.parse) .then(cleanList); function validate (opts) { if (!opts.id && !opts.appId) { throw Error('Either id or appId is required'); } if (opts.sort && !R.contains(opts.sort, R.values(c.sort))) { throw new Error('Invalid sort ' + opts.sort); } if (opts.page && opts.page < 1) { throw new Error('Page cannot be lower than 1'); } if (opts.page && opts.page > 10) { throw new Error('Page cannot be greater than 10'); } } module.exports = reviews;

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/appreply-co/mcp-appstore'

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