<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Josep Camps Miró</title>
    <description>The latest articles on DEV Community by Josep Camps Miró (@campsjos).</description>
    <link>https://dev.to/campsjos</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F577333%2F2268d0d4-245a-4813-bdb5-5edfca0639d3.jpeg</url>
      <title>DEV Community: Josep Camps Miró</title>
      <link>https://dev.to/campsjos</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/campsjos"/>
    <language>en</language>
    <item>
      <title>Algolia MCP Supermarket Assistant</title>
      <dc:creator>Josep Camps Miró</dc:creator>
      <pubDate>Sun, 27 Jul 2025 19:12:49 +0000</pubDate>
      <link>https://dev.to/campsjos/algolia-mcp-supermarket-assistant-3g9h</link>
      <guid>https://dev.to/campsjos/algolia-mcp-supermarket-assistant-3g9h</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/algolia-2025-07-09"&gt;Algolia MCP Server Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;A shopping bot that gets it. Say "I'm making tacos" and it finds tortillas, beef, cheese automatically. No keyword searching.&lt;/p&gt;

&lt;p&gt;Built with Node.js + OpenAI Agents + Algolia MCP. Conversation memory, smart result limiting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Repo:&lt;/strong&gt; &lt;a href="https://github.com/campsjos/algolia-mcp-supermarket" rel="noopener noreferrer"&gt;campsjos/algolia-mcp-supermarket&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/uFwB4Re9BrQ"&gt;
  &lt;/iframe&gt;
&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST http://localhost:4242/api/chat &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"prompt": "I want to make chocolate cake"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Auto-searches when you mention food/recipes/weather. No explicit commands needed.&lt;/p&gt;

&lt;p&gt;OpenAI Agents call the Algolia MCP server automatically when users mention food/recipes/weather. &lt;/p&gt;

&lt;p&gt;Key parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Proactive triggers&lt;/strong&gt;: Recipe → ingredients, weather → appropriate products&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Result extraction&lt;/strong&gt;: Parse agent &lt;code&gt;_generatedItems&lt;/code&gt; to get Algolia hits&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart limiting&lt;/strong&gt;: 1 result per search if multiple, 4 if single&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Session memory&lt;/strong&gt;: Conversation context across requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The integration is seamless - users don't know they're hitting Algolia.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Main challenge:&lt;/strong&gt; AI is unpredictable. Sometimes "I want pasta" would just give recipes instead of searching for ingredients. Other times it would search for random stuff I didn't expect. Spent days tweaking the system prompt until I found the right balance of being explicit about when to use MCP tools without making responses feel robotic.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I learned:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Prompt engineering is crucial&lt;/strong&gt; - Generic prompts don't work. Had to be very specific about trigger words and search behavior&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent state parsing is messy&lt;/strong&gt; - OpenAI Agents structure responses differently each time. Needed multiple fallback strategies to reliably extract Algolia results&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User experience matters&lt;/strong&gt; - Raw search results overwhelm people. Smart limiting (1 per search vs 4) made conversations feel natural&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Debugging AI is different&lt;/strong&gt; - Added comprehensive logging because you can't just console.log your way through unpredictable AI behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Development process:&lt;/strong&gt;&lt;br&gt;
Started simple with basic chat, then added MCP integration. Hit the wall with inconsistent AI behavior - sometimes it would search, sometimes not. Realized I needed to treat the AI like a junior developer: give it very clear instructions about what to do and when. The breakthrough was crafting a system prompt that made proactive searching feel natural rather than forced.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Biggest surprise:&lt;/strong&gt; How seamless MCP servers make tool integration feel once you get the prompting right. The Algolia MCP server just works - all the complexity was in getting the AI to use it consistently.&lt;/p&gt;

&lt;p&gt;First time with MCP servers - they make AI tool integration feel natural.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>algoliachallenge</category>
      <category>webdev</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
