MCP Examples

Explore these example applications to see how Model Context Protocol can be used in different scenarios.

E-commerce Shopping Assistant

A personalized shopping assistant that remembers user preferences, compares products, and makes tailored recommendations. This example demonstrates how to use MCP for:

  • User preference tracking and personalization

  • Product catalog integration via tools

  • Long-term memory for improved recommendations over time

// E-commerce Assistant MCP Context
import { MCPContext } from '@modl/mcp';

const shoppingAssistant = new MCPContext({
  systemInstruction: "You are a helpful shopping assistant for a fashion retailer.",
  userGoal: "Find stylish, waterproof sneakers under €150",
  userProfile: {
    name: "Alex",
    style: ["minimalist", "neutral", "casual-elegant"],
    shoeSize: "EU 42",
    pastPurchases: ["Nike Air Max", "Common Projects", "Vans Old Skool"],
    preferredPriceRange: "100-150 EUR"
  },
  tools: [
    {
      name: "searchProducts",
      description: "Search the product catalog",
      parameters: {
        query: "string",
        filters: "object",
        limit: "number"
      }
    },
    {
      name: "getProductDetails",
      description: "Get detailed information about a product",
      parameters: {
        productId: "string"
      }
    },
    {
      name: "checkInventory",
      description: "Check if a product is in stock",
      parameters: {
        productId: "string",
        size: "string"
      }
    }
  ],
  memory: {
    shortTerm: [],
    longTerm: {
      stylePreferences: "modern minimalist, neutral colors",
      purchaseBehavior: "researches thoroughly before buying"
    }
  }
});

export default shoppingAssistant;

Customer Support Agent

A customer support agent that can access knowledge bases, user history, and support tools to resolve issues efficiently. This example demonstrates:

  • Knowledge base integration with RAG

  • Customer history and context awareness

  • Support ticket management tools

Developer Copilot

A coding assistant that understands your codebase, development patterns, and can access APIs and documentation. This example demonstrates:

  • Code repository integration

  • Documentation search and retrieval

  • Code generation with project-specific context

More Examples

Explore our GitHub repository for more examples and starter templates using Model Context Protocol.