MCIP — the Machine Customer Interaction Protocol — is a universal standard that enables AI agents to participate in commerce as first-class customers. It defines how machine customers search, browse, add to cart, check out, and track orders across any e-commerce platform through a single protocol interface. Built on a three-layer NestJS architecture with MCP (Model Context Protocol) at its core, the system currently implements intelligent product discovery as its first module — powered by LangGraph agentic workflows and Qdrant hybrid vector search
A machine customer is an AI agent that acts on behalf of a human to discover, evaluate, and purchase products. Think of it as giving your AI assistant a credit card and sending it shopping. Today, AI agents can answer questions and write code — but when it comes to commerce, they hit a wall. Every e-commerce platform has different APIs, different schemas, different authentication, and different capabilities.
MCIP solves this by defining a universal protocol for machine customers. Just as HTTP standardized how browsers request web pages, MCIP standardizes how AI agents interact with stores. The protocol covers the entire commerce lifecycle:
Product discovery is the first implemented module — because you can’t buy what you can’t find. The architecture described below supports the full lifecycle, with each new module plugging into the same three-layer design and MCP protocol interface.
MCIP operates as the protocol layer between machine customers and commerce platforms. Unlike traditional API gateways that simply route requests, MCIP provides a standardized interface (via MCP — Model Context Protocol), adds semantic intelligence through LangGraph agentic workflows, and translates between the protocol’s unified schema and each platform’s native API.
The system context below shows how MCIP sits at the center of the machine customer ecosystem. AI agents communicate through the MCP protocol, MCIP handles the intelligence and translation, and e-commerce platforms serve products through their native APIs. Currently, the product discovery module is active — the same architecture supports cart, checkout, and order modules as the protocol grows.
AI Services power our semantic understanding:
Infrastructure Services ensure reliability:
MCIP's architecture follows a clean three-layer design implemented as NestJS modules. Each layer has clear responsibilities and communicates through well-defined interfaces.
Handles protocol translation and request routing:
GET /search)GET /hard-filtering/search) — triggers the full LangGraph workflow@rekog/mcp-nest with Zod validation for type-safe tool definitions (currently: search_product)Orchestrates business logic and coordinates domain services:
Contains core business logic and external system integrations:
text-embedding-3-smallProduct discovery is MCIP’s first protocol module — and arguably the most important. Before a machine customer can add items to a cart or check out, it needs to find the right products. This module transforms how AI agents search by combining semantic understanding with intelligent filtering.
MCIP provides two complementary search approaches within the product discovery module, each optimized for different query types:
Endpoint: GET /search?q={query}&take={limit}&skip={offset}
Best for: Straightforward queries where speed matters most.
Direct vector similarity search in Qdrant. No LLM calls — pure embedding generation followed by cosine similarity matching. Fast, low-latency, and effective for clear queries.
curl "http://localhost:8080/search?q=laptop"Endpoint: GET /hard-filtering/search?q={query}&take={limit}&skip={offset}
Best for: Complex natural language queries with implicit filters (brand, price, category).
Full LangGraph agentic workflow with 4 stages — parallel filter extraction, brand validation, hybrid search, and LLM verification. Intelligent, precise, and designed for queries like "Nike shoes under $100 but not running shoes."
curl "http://localhost:8080/hard-filtering/search?q=nike+shoes+under+100"| Aspect | Simple Vector Search | Agentic Hard-Filtered Search |
|---|---|---|
| Latency | ~300ms | ~500ms |
| LLM Calls | 0 (embedding only) | 4+ (extraction, verification) |
| Filter Extraction | None | Automatic (brand, price, category) |
| Brand Validation | No | Yes (Qdrant facet search) |
| Result Verification | No | Yes (LLM semantic check) |
| Best For | Simple, direct queries | Complex natural language queries |
The agentic search flow is the product discovery module’s core intelligence — a 4-stage LangGraph state machine that transforms natural language queries into precisely filtered, verified product results.
Three LLM calls run in parallel using LangGraph's parallel execution:
All three use Zod schemas for type-safe structured output parsing from GPT-4o-mini.
Queries Qdrant's facet search to get all available brands in the product catalog. If the user asked for a brand that doesn't exist in the store, MCIP returns empty results immediately — no point searching for products that aren't there.
Combines two search strategies in Qdrant simultaneously:
This hybrid approach gives you the best of both worlds — semantic understanding with precise filtering.
Passes the search results through GPT-4o-mini for a final semantic check. The LLM verifies that results actually match the user's intent, filtering out false positives. Returns the top 5 verified products.
| Category | Technology | Version | Purpose |
|---|---|---|---|
| Framework | NestJS | 11.0.1 | Application framework with DI |
| Language | TypeScript | 5.7+ | Type safety across the codebase |
| Agentic Workflows | LangGraph | 1.0.15 | State machine workflows with parallel execution |
| AI Orchestration | LangChain | 1.1.15 | LLM abstractions and structured output |
| LLM Provider | OpenAI GPT-4o-mini | — | Filter extraction and result verification |
| Embeddings | OpenAI | 6.9.1 | text-embedding-3-small (1536 dimensions) |
| Vector DB | Qdrant | 1.16.0 | Hybrid search + payload filtering + facets |
| MCP Protocol | @modelcontextprotocol/sdk | 1.25.2 | AI agent communication standard |
| MCP Integration | @rekog/mcp-nest | 1.8.4 | NestJS MCP binding with decorators |
| Queue | BullMQ | 5.63.2 | Async job processing with retry logic |
| Cache/Queue Backend | Redis | Alpine | Queue backend and session storage |
| Validation | Zod | 3.25.76 | Schema validation + LLM structured output parsing |
We chose NestJS over Express or Fastify for several critical reasons:
@rekog/mcp-nest// MCP tool definition using @rekog/mcp-nest
import { Tool } from '@rekog/mcp-nest';
import { z } from 'zod';
const SearchProductSchema = z.object({
query: z.string().describe('Natural language search query'),
take: z.number().optional().default(10),
skip: z.number().optional().default(0),
});
@Tool({
name: 'search_product',
description: 'Search products with semantic understanding',
parameters: SearchProductSchema,
})
async searchProduct(params: z.infer<typeof SearchProductSchema>) {
return this.searchService.search(params);
}Our semantic search pipeline transforms queries through multiple stages:
Why 1536 dimensions? We use text-embedding-3-small at full precision (1536 dimensions) for excellent accuracy in e-commerce queries with native Qdrant support — no dimension reduction needed.
LangGraph Integration Benefits:
MCIP uses a manual synchronization model for product ingestion via BullMQ:
POST /admin/sync with admin API keySOURCE_URL)UnifiedProduct schema via adapters (VendureMapper or CustomAiMapper)text-embedding-3-small (1536 dimensions)# Trigger sync from configured source
curl -X POST http://localhost:8080/admin/sync \
-H "x-admin-api-key: your-secret-key"| Operation | P50 | P95 | P99 | Notes |
|---|---|---|---|---|
| Embedding Generation | 145ms | 189ms | 212ms | Per query, OpenAI API |
| Vector Search (Qdrant) | 238ms | 287ms | 342ms | With payload filtering |
| Feature Extraction | ~200ms | — | — | LangGraph parallel extraction |
| Total Search (Simple) | ~300ms | — | — | Vector search mode |
| Total Search (Agentic) | 421ms | 498ms | 587ms | Full LangGraph pipeline |
| Throughput | 1,247 requests/second | Under load | ||
| Product Ingestion | ~500ms/product | — | — | Including embedding generation |
Hybrid Search combines semantic and exact matching in Qdrant:
// Qdrant hybrid search with AI-extracted filters
const results = await qdrant.search('products', {
vector: queryEmbedding,
filter: {
must: [
{ key: 'price.amount', range: { lte: extractedFilters.maxPrice } },
{ key: 'brand', match: { value: extractedFilters.brand } }
]
},
limit: 10,
with_payload: true,
});Parallel Filter Extraction via LangGraph:
MCIP scales horizontally with stateless application servers:
Key decisions that shaped the current architecture:
| Decision | Rationale | Trade-offs | Status |
|---|---|---|---|
| NestJS Framework | Enterprise TypeScript framework, DI container, modular architecture | Learning curve, heavier than Express | Implemented |
| LangGraph Workflows | Declarative agent workflows, parallel execution, conditional routing | Additional complexity vs simple chains | Implemented |
| Qdrant Vector DB | Open-source, high performance, payload filtering, facet search | Self-hosted infrastructure required | Implemented |
| 1536-dim Vectors | Full precision from text-embedding-3-small, no truncation | Higher storage vs reduced dimensions | Implemented |
| BullMQ + Redis | Robust job queue, retry logic, job persistence, proven at scale | Additional infrastructure dependency | Implemented |
| MCP Protocol | Standardized AI agent communication, growing ecosystem | Currently Claude-focused, evolving spec | Implemented |
| Adapter Pattern | Pluggable platform integration, unified schema | Mapping complexity for each platform | Implemented |
| Zod Schemas | Type-safe validation, LLM structured output, runtime safety | Schema duplication with TypeScript interfaces | Implemented |
| Monolithic Architecture | Faster iteration, single deployment, lower complexity, no network hops | Must refactor for microservices at scale | Implemented |
Business Metrics:
Technical Metrics:
Health Indicators:
curl http://localhost:8080/health
# Response: {"status":"ok"}The architecture implements defense in depth across four layers:
x-admin-api-key)Container Security: Non-root user, multi-stage Docker builds, health checks.
MCIP's three-layer architecture is designed to grow from intelligent product search to full commerce lifecycle support:
MCIP's architecture provides well-defined extension points for growing the protocol beyond product discovery:
| Extension Point | Current | Future Capability | Implementation Path |
|---|---|---|---|
| Platform Adapters | Vendure only | Any e-commerce API | Implement IProductService interface |
| Search Methods | RAG + Agentic | Hybrid search strategies | Pluggable search strategies |
| AI Models | OpenAI only | Multiple providers | Abstract embedding service |
| Cart Storage | Redis only | Multiple backends | Storage adapter pattern |
| Protocol | MCP only | GraphQL, REST APIs | Protocol adapters |
| Commerce Modules | Product Discovery | Cart, Checkout, Orders | NestJS module per capability |
The IProductService interface defines the contract for future platform adapters:
// Future platform adapter contract
interface IProductService {
searchProducts(query: string, options?: SearchOptions): Promise<Product[]>;
getProduct(id: string): Promise<Product>;
getProductBySlug(slug: string): Promise<Product>;
}This interface will become the standard way to connect new e-commerce platforms (Shopify, WooCommerce, custom APIs) as MCIP evolves into a true multi-store protocol.
MCIP's architecture balances simplicity with sophistication to serve as a universal commerce protocol. Product discovery is the first implemented module — powered by LangGraph agentic workflows and Qdrant hybrid search — with the three-layer design ready to accommodate cart, checkout, and order tracking as the protocol evolves.
The key architectural insights:
By focusing on semantic understanding and clean product mapping as the first step, we've created an architecture that's maintainable, extensible, and ready to grow into a complete commerce protocol.