Build a Review Analytics MCP Server with TypeScript, Rules, LLMs, and Vector Search
From the publisher’s feed, collected in the ZeroLabs newsroom.
A production-grade AI pipeline that turns messy app reviews into structured product intelligence using rules, LLM routing, and vector search.IntroductionApp reviews are one of the richest sources of product feedback, but they are also one of the hardest to operationalize. A few thousand reviews can contain urgent bugs, payment failures, broken login flows, feature requests, and noise all mixed together.In this tutorial, we’ll build the kind of system that turns that raw review stream into structured product intelligence.The system described here is implemented in the open-source project ReviewRadar, a TypeScript MCP server for analyzing app reviews.By the end, you’ll understand how to build a system that can:Import reviews from CSV, JSON, or app-store scrapingRedact sensitive data before any model callClassify reviews into issue types, feature areas, severity, and sentimentRoute only uncertain or high-risk reviews to an LLMStore reviews in a vector index for semantic searchGenerate PM-ready outputs like top issues, spikes, and weekly reportsExpose the whole system as MCP tools for Cursor, Claude Desktop, or any MCP clientGitHub RepositoryThe complete implementation for this tutorial is available in the open-source repository below.https://github.com/abhishekdubey331/ReviewRadarYou can run the MCP server locally, import reviews, and experiment with the analytics tools described in this article.Final ResultThe finished system is an MCP server that sits behind an IDE agent and exposes tools such as:reviews_importreviews_analyzereviews_searchreviews_top_issuesreviews_weekly_reportInstead of manually reading reviews, a PM can simply ask:What are the biggest customer pain points this week?And the server can return ranked issue clusters, severity breakdowns, spikes, and supporting review evidence.Quick DemoBelow is an example of the ReviewRadar MCP server analyzing reviews and surfacing top issues.Demo: ReviewRadar MCP tools analyzing app reviews and surfacing top issuesArchitectureThe core pipeline looks like this:This pipeline transforms raw review text into structured signals that product and engineering teams can analyze.Here’s how the components fit together:Ingestion layerLoads and normalizes reviews from files or scraped datasets.Privacy layerRedacts PII locally before any model interaction.Classification engineRuns deterministic rules first, then selectively calls the LLM.Vector storeIndexes reviews for semantic search.Analytics layerComputes top issues, trends, segment breakdowns, and reports.MCP layerExposes everything as callable tools over stdio.That separation is the main reason the project works well: every layer has a focused responsibility.Step 1: Define the Taxonomy and ContractsBefore building the pipeline, define what the system should produce.ReviewRadar starts with Zod enums and schemas.export const IssueTypeEnum = z.enum([ "Bug", "Performance", "UX", "Feature Request", "Account/Auth", "Payments/Transactions", "Billing/Pricing", "Trust/Fraud", "Support/Service", "Cancellation/Retention", "Data/Sync", "Safety Concern", "Praise", "Spam / Bot / Irrelevant"]);export const FeatureAreaEnum = z.enum([ "Crash Detection", "Driving Reports", "Family Location", "SOS", "Card Controls", "Allowance/Chores", "Savings/Investing", "Bank Linking", "Notifications", "Onboarding", "Login/OTP", "Other", "Unknown"]);export const SeverityEnum = z.enum(["P0", "P1", "P2", "FYI"]);This step matters because it:Defines the issue taxonomy onceMakes validation explicitAligns rules, prompts, analytics, and outputsPrevents the LLM from inventing categoriesIf you skip this step, the system becomes inconsistent very quickly.Step 2: Import and Normalize ReviewsNext, we convert raw reviews into a clean internal format.The ingestion layer normalizes reviews from CSV, JSON, or scraped app-store datasets into a single internal schema.Example ingestion logic:for (const raw of rawReviews) { const normalized = normalizeReview(raw); const parsed = ReviewInputSchema.safeParse(normalized); if (!parsed.success) continue; const review = parsed.data; if (!reviewsMap.has(review.review_id)) { reviewsMap.set(review.review_id, review); }}This step ensures:Inconsistent fields are normalizedRows are validated with ZodMalformed rows are droppedDuplicate reviews are removedStep 3: Add a Privacy Layer Before Any LLM CallBefore sending data to any model, ReviewRadar redacts sensitive information locally.export function redactPII(content: string): string { const emailRegex = /[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/gi; const phoneRegex = /(?:\+?\d{1,3}[ \-.]?)?\(?\d{3}\)?[ \-.]?\d{3}[ \-.]?\d{4}/g; const coordRegex = /[-+]?\d{1,2}\.?\d*,\s*[-+]?\d{1,3}\.?\d*/g; return content .replace(emailRegex, "[REDACTED]") .replace(phoneRegex, "[REDACTED]") .replace(coordRegex, "[REDACTED]");}This ensures:Emails, phone numbers, and coordinates are scrubbed locallyPrivacy is enforced automaticallyLLM calls never accidentally leak PIIStep 4: Build the Hybrid Classification EngineThe classification engine first runs deterministic rules.Example spam filter:if (alphaCount return { issue_type: "Spam / Bot / Irrelevant", feature_area: "Other", severity: "FYI", sentiment: "Neutral", confidence_score: 1.0, classification_source: "rule_engine", is_spam: true };}Then the system decides whether the review should be escalated to an LLM.export function isLlmRequired(result: RuleResult): boolean { if (result.confidence_score if (result.feature_area === "Unknown") return true; if (result.severity === "P0" || result.severity === "P1") return true; return false;}Hybrid classification flow:const redacted = redactPII(review.content);const rulesRes = evaluateRules(redacted, review.score);if (!isLlmRequired(rulesRes)) { return rulesRes;}const prompt = "Classify this app review into the existing product taxonomy...";const llmResp = await llmClient.processPrompt(prompt);Benefits of this design:Rules handle the majority of reviewsOnly ambiguous or critical cases use the LLMCosts stay low and results stay explainableStep 5: Add Reliability and Batch ProcessingOnce LLMs enter the pipeline, reliability becomes critical.ReviewRadar adds:Concurrency limitsRetry logicCircuit breakersBatch metricsRule-engine fallbackExample circuit breaker:if (this.state.consecutiveFailures >= 10) { this.isTripped = true; throw new CircuitBreakerError();}Batch processing example:const settledResults = await Promise.allSettled( rawInputReviews.map((review) => { const cachedTask = analysisCache.getOrCreate( review, () => processingLimit(() => processSingleReview(...)) ); return cachedTask.promise; }));This ensures:Model calls stay within limitsFailures don’t crash the systemDuplicate reviews reuse cached resultsStep 6: Add Vector SearchOnce reviews are classified, we can enable semantic search.Embeddings example:const response = await openai.embeddings.create({ model: "text-embedding-3-large", input, dimensions: 1536});Search combines:Semantic vector similarityLexical keyword matchingconst semanticResults = buildSemanticSearchRecords(...);const lexicalResults = buildLexicalSearchRecords(...);return mergeSearchRecords(semanticResults, lexicalResults);Hybrid retrieval works especially well for review data, where exact phrases (“OTP not received”) matter just as much as semantic similarity.Step 7: Generate Analytics and MCP ToolsOnce reviews are structured, analytics becomes straightforward.Example aggregation:const key = `${issueType}::${featureArea}`;row.review_count += 1;row.severity_breakdown[sev] += 1;Tools exposed via MCP:reviews_importreviews_analyzereviews_searchreviews_top_issuesreviews_weekly_reportServer tool registration:server.setRequestHandler(CallToolRequestSchema, async (request) => { return dispatchToolCall( request.params.name, request.params.arguments, runtimeDeps );});This transforms the system into reusable infrastructure rather than a single script.Key Design DecisionsSeveral architectural choices make this system strong:Rules before LLMCheaper, faster, and easier to debug.PII redaction in the pipelinePrivacy is enforced by default.Hybrid searchSemantic + lexical retrieval improves results.Structured analytics after classificationReporting becomes deterministic and reliable.MCP tool boundaryMakes the system easily usable by IDE agents.Common PitfallsIf you build a similar system, avoid these mistakes:Sending every review to the LLMSkipping a taxonomy definitionTreating privacy as an application-layer concernBuilding reports directly from raw textIgnoring degraded-mode behavior when models failConclusionReviewRadar shows how to build a practical AI backend without overusing AI.A practical build order looks like this:Define taxonomy and response contractsIngest and normalize reviewsRedact PIIBuild deterministic rulesRoute uncertain reviews to the LLMAdd reliability controlsIndex reviews for semantic searchCompute analytics on structured outputsExpose capabilities as MCP toolsThe real power of this system is not one clever prompt.It comes from combining schemas, rules, selective model usage, search, and analytics into a clean pipeline.Further ImprovementsFuture enhancements could include:Release-aware regression detection by app versionIncremental indexing instead of batch importsAutomatic summary extractionMultiple embedding providersA dashboard UI on top of the MCP serverHistorical trend tracking for month-over-month analysisIf you build something similar, remember the core principle:Use the LLM as a high-value component inside a well-structured system — not as the system itself.Build a Review Analytics MCP Server with TypeScript, Rules, LLMs, and Vector Search was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.