Skip to main content
Glama

Superprecio MCP Server

by bunkerapps
supermarkets.ts2.76 kB
/** * MCP Resources: Supermarket Information * Provides access to supermarket data as resources */ import type { SuperPrecioApiClient } from '../client/superPrecioApi.js'; export const supermarketResources = { list: { uri: 'supermarket://list', name: 'Supermarket List', description: 'List of all available supermarkets in Argentina (expanding to Latin America)', mimeType: 'application/json', }, }; /** * Get list of all supermarkets */ export async function getSupermarketList(client: SuperPrecioApiClient) { try { // Make a dummy search to get the list of markets const response = await client.searchProducts({ search: 'test', maxResults: 1, order: 'OrderByTopSaleDESC', }); const supermarkets = response.markets.map((market) => ({ id: market.id, name: market.name, url: market.url, logo: market.logo, show: market.show !== false, })); return { contents: [ { uri: 'supermarket://list', mimeType: 'application/json', text: JSON.stringify( { total: supermarkets.length, supermarkets: supermarkets, metadata: { country: 'Argentina', currency: 'ARS', expansion: 'Latin America', lastUpdated: new Date().toISOString(), }, }, null, 2 ), }, ], }; } catch (error: any) { throw new Error(`Failed to fetch supermarket list: ${error.message}`); } } /** * Get information about a specific supermarket */ export async function getSupermarketInfo(client: SuperPrecioApiClient, marketId: string) { try { const response = await client.searchProducts({ search: 'test', maxResults: 1, order: 'OrderByTopSaleDESC', }); const market = response.markets.find((m) => m.id.toString() === marketId); if (!market) { throw new Error(`Supermarket with ID ${marketId} not found`); } return { contents: [ { uri: `supermarket://${marketId}/info`, mimeType: 'application/json', text: JSON.stringify( { id: market.id, name: market.name, url: market.url, logo: market.logo, show: market.show !== false, metadata: { country: 'Argentina', currency: 'ARS', expansion: 'Latin America', }, }, null, 2 ), }, ], }; } catch (error: any) { throw new Error(`Failed to fetch supermarket info: ${error.message}`); } }

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/bunkerapps/superprecio_mcp'

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