Skip to main content
Glama

ACP Commerce MCP Server

ProductSearchService.ts1.06 kB
import { Product } from '../types/domain.js'; import { LookupItemsSchema } from '../utils/validation.js'; import { ProductFeedService } from './ProductFeedService.js'; interface SearchParams { query: string; limit?: number; category?: string; } export class ProductSearchService { constructor(private readonly feedService: ProductFeedService) {} async search(params: SearchParams): Promise<Product[]> { const validated = LookupItemsSchema.parse(params); const products = await this.feedService.getProducts(); const normalizedQuery = validated.query.toLowerCase(); const filtered = products.filter((product) => { const matchesQuery = product.name.toLowerCase().includes(normalizedQuery) || product.description.toLowerCase().includes(normalizedQuery); const matchesCategory = validated.category ? product.category.toLowerCase() === validated.category.toLowerCase() : true; return matchesQuery && matchesCategory; }); return filtered.slice(0, validated.limit ?? 10); } }

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/gratitude5dee/wzrdmcp'

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