<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by TableJourney on Medium]]></title>
        <description><![CDATA[Stories by TableJourney on Medium]]></description>
        <link>https://medium.com/@tablejourney?source=rss-eac72a09d0bd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EgVRnnMPCAqdn7wOb_BhtA.png</url>
            <title>Stories by TableJourney on Medium</title>
            <link>https://medium.com/@tablejourney?source=rss-eac72a09d0bd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 23:59:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tablejourney/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[An MCP server beside a static site: what we built and what agents actually call]]></title>
            <link>https://medium.com/@tablejourney/an-mcp-server-beside-a-static-site-what-we-built-and-what-agents-actually-call-fe48695238e5?source=rss-eac72a09d0bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe48695238e5</guid>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[TableJourney]]></dc:creator>
            <pubDate>Mon, 23 Nov 2026 10:14:44 GMT</pubDate>
            <atom:updated>2026-11-26T07:55:57.607Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EIe0rp17ZlPcpKkA.png" /></figure><p>Our site is static: Python generates HTML from a database and the pages are served as files. When AI assistants started sending readers to us, we wanted them to get structured answers instead of scraping pages, so we added two doors to the same data: a REST API and a Model Context Protocol (MCP) server. This post covers how they sit beside a static site, the design choices that mattered, and what a month of logs says about who actually uses them.</p><h3>One function, two doors</h3><p>The rule that saved the most time: every MCP tool calls the same function as the matching REST endpoint. The festival search, for example, is one Python function; REST wraps it at /api/v1/festivals and MCP exposes it as the festivals tool. Nothing about the data is duplicated, so the two can never disagree.</p><p>The service is a small Python app with its own image. A reverse proxy sends /api/v1, /mcp and a few other paths to it and everything else to the static file server, so the site itself stays static and the API can be deployed on its own.</p><h3>The MCP side</h3><p>We use the official Python SDK with the streamable HTTP transport. A tool is a function with typed, described parameters:</p><p>Three choices made a visible difference:</p><ul><li><strong>Read-only annotations.</strong> Every tool is a read, and saying so lets clients call them without asking the user to approve each call.</li><li><strong>Parameter descriptions that carry examples.</strong> Models fill parameters better when the description says “a slug or a name, e.g. ‘italy’”. We also accept names and answer an unknown city with did_you_mean instead of an empty list.</li><li><strong>Server instructions.</strong> The server’s instructions string is a short guide: which tool to call first for &quot;what can I do in this city&quot;, that results carry a page to cite, and the terms of use. Clients pass it to the model with the tool list, so it is the one place to explain how the tools fit together.</li></ul><p>The server runs stateless, which suits a fleet of identical containers behind a load balancer. You can try the handshake with curl:</p><pre>curl -s -X POST https://tablejourney.com/mcp \ -H &#39;Content-Type: application/json&#39; \ -H &#39;Accept: application/json, text/event-stream&#39; \ -d &#39;{&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;id&quot;:1,&quot;method&quot;:&quot;initialize&quot;,&quot;params&quot;:{&quot;protocolVersion&quot;:&quot;2025-06-18&quot;,&quot;capabilities&quot;:{},&quot;clientInfo&quot;:{&quot;name&quot;:&quot;curl&quot;,&quot;version&quot;:&quot;1&quot;}}}&#39;</pre><p>It answers with the server’s capabilities and its instructions. In Claude Code it is one line:</p><pre>claude mcp add --transport http tablejourney https://tablejourney.com/mcp</pre><h3>Every answer cites a page</h3><p>Each result includes the URL of the page it came from, and the instructions ask the assistant to cite it. That is good for the reader (they can check our sources) and for us (the assistant links to the page). Our pages carry the provenance, the date each fact was checked and the source, so a cited answer can be verified by a person.</p><h3>Logging every call, carefully</h3><p>We log each call with the tool name, the declared parameters only, the result count, the time taken and the client name from the handshake. Logging only declared parameters keeps arbitrary input out of the logs. Rate limits are counted in the database, not in memory, so they hold across every running copy.</p><h3>What 30 days of logs say</h3><p>This is the part I did not expect. Over the last 30 days the server saw roughly:</p><p>Most traffic is discovery: MCP directories and health checkers connecting, listing tools and leaving. The top client names in the handshake are directory probes, not assistants. Discovery outnumbers real use by roughly forty to one.</p><p>Among the real tool calls, the order was clear: search_places (venue search) first, then place (one venue in full), then festivals, cities and dishes. People ask assistants where to eat far more often than anything else, and the &quot;what is on while I am there&quot; question comes next.</p><p>Three lessons from that:</p><ol><li><strong>Make discovery cheap.</strong> initialize and tools/list should be fast and never touch the database. Most of your traffic will be exactly those calls.</li><li><strong>Count calls by method.</strong> If you only count requests, the directories hide your real usage.</li><li><strong>Lead with the search tool.</strong> The tool most calls go to deserves the best description and the most forgiving parameters.</li></ol><h3>REST is still busier</h3><p>The REST API sees more real use than MCP: venue search, the OpenAPI docs and the festival search are its top endpoints. Developers try an API with curl before they wire it into anything. Keep both, and keep them on one function.</p><h3>Discovery files</h3><p>Agents and their developers find a server through a few small files: an llms.txt that describes the site, a /.well-known/ manifest for the MCP server, an OpenAPI description, and an API catalog (RFC 9727) linked from an HTTP Link header. Each takes minutes to add and they are how most of those directory probes found us.</p><p>The full tool list and setup steps for nine clients are at <a href="https://tablejourney.com/agents/">https://tablejourney.com/agents/</a>. If you run an MCP server, I would like to know whether your discovery to use ratio looks like ours.</p><p><em>Originally published at </em><a href="https://dev.to/tablejourney/an-mcp-server-beside-a-static-site-what-we-built-and-what-agents-actually-call-1lao"><em>https://dev.to</em></a><em> on November 23, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe48695238e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Calendar feeds that only change when an event does]]></title>
            <link>https://medium.com/@tablejourney/calendar-feeds-that-only-change-when-an-event-does-2237a8dcfefd?source=rss-eac72a09d0bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/2237a8dcfefd</guid>
            <category><![CDATA[calendar]]></category>
            <category><![CDATA[icallthislook]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[webdev]]></category>
            <dc:creator><![CDATA[TableJourney]]></dc:creator>
            <pubDate>Thu, 12 Nov 2026 09:00:12 GMT</pubDate>
            <atom:updated>2026-11-15T08:19:17.766Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GINHQdvDvkUa9f4F.png" /></figure><p>A subscribable calendar is one of the most useful things a site about events can offer. A reader adds “food festivals in Oslo” to Google, Apple or Outlook calendar once, and every edition shows up on their own calendar with a link back to the page. It also turns out to be one of the easiest feeds to get subtly wrong, because calendar clients are fussy and quiet about it: a feed that churns or breaks a rule does not throw an error, it just behaves oddly for subscribers.</p><p>We publish several hundred .ics feeds at TableJourney (one per city, per country and per theme), all regenerated every day from the same data as the pages. This post covers the rules that kept them stable.</p><h3>Goal: a byte-identical file unless an event changed</h3><p>Our site is static and every generated file is committed and pushed. A feed that differs every day for no reason means a commit every day, cache invalidation every day and, worse, calendar clients re-processing events that did not change. So the rule we set was simple: rebuilding the feed with no data change must produce the same bytes.</p><p>Three fields usually break that.</p><h3>1. UID: derive it from what the event is</h3><p>The UID must identify the same event across rebuilds. Do not use a random UUID or a database row id that can change on reimport. We build it from the page path and the edition year:</p><p>The year matters: next year’s edition is a different event, so it gets a different UID, and this year’s stays in subscribers’ calendars as history instead of being moved forward.</p><h3>2. DTSTAMP: the date you checked, not the render time</h3><p>RFC 5545 requires DTSTAMP, and most generators fill it with &quot;now&quot;. That makes every build different. We use the date the entry&#39;s facts were last checked against the organiser&#39;s source, which only moves when someone actually re-verifies the event:</p><p>This is also more honest: the stamp says when the information was confirmed.</p><h3>3. Write only when the bytes differ</h3><p>With stable UIDs and stamps, this turns several hundred feeds into a handful of changed files on a normal day.</p><h3>All-day events: DTEND is exclusive</h3><p>A three-day festival from 16 to 18 October is an all-day event. With VALUE=DATE, DTEND is the day after the last day, not the last day:</p><p>Get this wrong and every multi-day event loses its final day in some clients and not others.</p><h3>Escaping text</h3><p>Commas, semicolons, backslashes and newlines in text values must be escaped, and the order matters (backslashes first):</p><p>Addresses are full of commas, which is why this shows up in the very first feed you test.</p><h3>Line folding counts octets, not characters</h3><p>Lines longer than 75 octets must be folded: a CRLF followed by a single space. The catch is that the limit is in octets, so a description with “ø” or “é” folds earlier than its character count suggests, and you must never split inside a multi-byte character:</p><p>Continuation lines get 74 octets because the leading space counts. Iterating by character and measuring each character’s encoded length is what keeps multi-byte letters whole.</p><h3>Line endings and headers</h3><p>Every line ends in CRLF, including the last. A few calendar-level properties help clients:</p><pre>BEGIN:VCALENDAR VERSION:2.0 PRODID:-//TableJourney//Food festival calendar//EN CALSCALE:GREGORIAN METHOD:PUBLISH X-WR-CALNAME:Food festivals in Oslo (TableJourney) REFRESH-INTERVAL;VALUE=DURATION:P1D X-PUBLISHED-TTL:P1D</pre><p>REFRESH-INTERVAL and X-PUBLISHED-TTL ask clients to poll daily; some honour one, some the other, some neither (Google refreshes on its own schedule).</p><p>You can check the real output, CRLFs included:</p><pre>curl -s https://tablejourney.com/calendar/norway/oslo.ics | head -n 20 | cat -A</pre><h3>Status, not deletion</h3><p>When an organiser postpones or has not confirmed dates, keep the event and say so:</p><p>A cancelled event that silently disappears from a feed leaves a ghost in some subscribers’ calendars. A CANCELLED status removes it properly.</p><h3>Only events with a known day</h3><p>An event known only as “sometime in May” is not a calendar event. We leave it out of the feeds rather than inventing a date, and the page carries it instead. Every city with an events page still gets a feed, even an empty one, so the subscribe buttons on its page never point at a 404 and the feed fills itself when a dated event arrives.</p><h3>Subscribe links</h3><p>The last mile is a set of buttons. Apple Calendar takes a webcal:// URL directly; Google and Outlook take the feed URL as a parameter:</p><h3>One source of truth</h3><p>The biggest decision was not in the feed code at all: the feeds are built from the same function that builds the calendar pages, the API answers and the open dataset. A feed that disagrees with the page it links to is worse than no feed.</p><p>All of our feeds are listed at <a href="https://tablejourney.com/calendar/">https://tablejourney.com/calendar/</a> if you want to see the output in your own calendar app. What other client quirks have bitten you? I am collecting them.</p><p><em>Originally published at </em><a href="https://dev.to/tablejourney/calendar-feeds-that-only-change-when-an-event-does-10gg"><em>https://dev.to</em></a><em> on November 12, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2237a8dcfefd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Crediting a booking to the AI agent that sent it, without cookies]]></title>
            <link>https://medium.com/@tablejourney/crediting-a-booking-to-the-ai-agent-that-sent-it-without-cookies-df20ea7a8b71?source=rss-eac72a09d0bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/df20ea7a8b71</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[affiliate-marketing]]></category>
            <dc:creator><![CDATA[TableJourney]]></dc:creator>
            <pubDate>Sun, 01 Nov 2026 07:29:23 GMT</pubDate>
            <atom:updated>2026-11-04T08:02:32.881Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MzNouutLq8Pkz0pb.jpg" /></figure><p>When an AI agent recommends a food tour and the person books it, the booking platform pays a commission to whoever owns the link. We wanted that money to reach the agent, or the person or company behind it, so we opened a partner program that pays out half of what we earn. The hard part was not the payout. It was making sure each booking, reported weeks later by a partner we do not control, can be traced to the agent that sent it.</p><p>This post covers how that works at TableJourney, a food travel guide with a public MCP server. None of it depends on a cookie in the traveller’s browser.</p><h3>The only thing that survives: the partner’s own sub-id</h3><p>Every booking partner reports commissions per booking, and every one of them echoes back one free-text field you put on the link:</p><p>That field is the whole attribution system. Anything we know at click time has to be written into it, because it is the only thing that comes back in the commission report or the network’s transaction API. So each member gets a short code, and the value we write is tjr-&lt;code&gt;-&lt;placement&gt;, for example tjr-k7m2p9xq-city-hub-module. The prefix lets the ledger pick member lines out of everything else with one LIKE &#39;tjr-%&#39;, and the placement tells us which part of the page converted.</p><h3>Agents: the link is born attributed</h3><p>An agent never sees a raw partner URL. When it calls a tool such as experiences or stays with its API key, every booking link in the answer is a short signed redirect on our domain:</p><pre>https://tablejourney.com/go/&lt;payload&gt;.&lt;hmac&gt;</pre><p>The payload names the key, the kind of link and the destination. The redirect checks the signature, looks up the key’s campaign, writes it into that partner’s sub-id field and sends a 302. The agent passes the link on unchanged and the attribution is already inside it. Nothing needs to persist on the traveller’s device, which matters because the traveller may open the link in a different browser, a chat app’s web view, or days later.</p><p>Getting a key is two MCP calls: partner_join with an email address, which sends a six-digit code, and partner_confirm with that code, which returns the key and the referral code. For clients that prefer OAuth there is the usual discovery (RFC 8414 metadata, RFC 7591 dynamic registration, PKCE).</p><h3>People: hold the code, stamp every link</h3><p>A person shares any page with ?ref=&lt;code&gt; on the end. On arrival, a first-party cookie set by our server (not by script, so browsers that cap script-written storage at seven days leave it alone) holds the code for 30 days, and the page rewrites every partner link&#39;s href on load.</p><p>Rewriting on load, rather than on click, is deliberate. We tried click-time tagging first and lost attribution on more than half of the links: middle-click, “open in new tab” from the context menu, long-press on a phone and “copy link address” never fire a click event. So the stamp goes into the href itself, and the click handler only re-checks it.</p><h3>The links that appear later</h3><p>Our first audit of this found a gap. Two kinds of partner links were not in the page when the load-time pass ran:</p><ul><li>hotel links whose dates are filled in by script with the coming weekend, which replaced the stamped href with a fresh, unstamped one;</li><li>cards swapped in after a location lookup (“near you”) and the booking bar on phones.</li></ul><p>Clicks still carried the code, but a long-press on iOS opened the unstamped address. The fix is a MutationObserver that stamps any partner link added to the page or whose href changes:</p><p>stamp leaves a link alone when its sub-id already starts with the member&#39;s mark, so its own write does not loop. A check across 15 live pages afterwards found the code on all 699 partner links.</p><h3>Iframes on other people’s sites</h3><p>Our food tours widget is an iframe other sites embed. It runs no script, by design, so the page inside the frame cannot stamp anything. A member who embeds it adds their code to the frame’s address (/embed/tours/italy/rome/?ref=&lt;code&gt;), and each card links to a redirect on our domain instead of straight to the partner:</p><p>The click is a same-origin request from the frame’s document, so under the default strict-origin-when-cross-origin referrer policy the browser sends the frame&#39;s full address, query string included, as the Referer. The redirect reads the code from it, checks it belongs to an active member, writes it into the sub-id and logs the click. It only accepts the two partners that allow our links on third-party sites, so it is not an open redirect.</p><h3>Reading it back</h3><p>Once a day the network APIs (Awin, CJ) return transactions with the sub-id, and the partners without one are imported from their own reports, broken down by the same field. A line with a tjr- sub-id becomes a member earning at the member&#39;s share; it becomes payable only after the partner has paid us and a holding period has passed, and every payout batch is approved by a person.</p><p>The program is open to agents and people: <a href="https://tablejourney.com/partners/">https://tablejourney.com/partners/</a>. The MCP server and the full tool list are at <a href="https://tablejourney.com/agents/">https://tablejourney.com/agents/</a>.</p><p><em>Originally published at </em><a href="https://dev.to/tablejourney/crediting-a-booking-to-the-ai-agent-that-sent-it-without-cookies-116"><em>https://dev.to</em></a><em> on November 1, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df20ea7a8b71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your AI agent can earn a commission on the travel it recommends]]></title>
            <link>https://medium.com/@tablejourney/your-ai-agent-can-earn-a-commission-on-the-travel-it-recommends-d646fc75a48f?source=rss-eac72a09d0bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d646fc75a48f</guid>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[travel]]></category>
            <dc:creator><![CDATA[TableJourney]]></dc:creator>
            <pubDate>Wed, 21 Oct 2026 01:18:36 GMT</pubDate>
            <atom:updated>2026-10-21T04:03:35.196Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wD-tViHhJWhFY3by.jpg" /></figure><p>Agents already recommend restaurants, food tours and hotels all day. When a person books one of those, someone usually earns a commission. It is almost never the agent, or the developer who built it.</p><p>We run <a href="https://tablejourney.com/">TableJourney</a>, a food travel guide with a public <a href="https://tablejourney.com/agents/">MCP server</a> over 224 cities: verified places to eat, food festivals with resolved dates, and bookable food tours, classes and stays from GetYourGuide, Viator, Musement and hotel partners. This week we opened a partner program, and we built it for agents first.</p><h3>The deal</h3><ul><li><strong>50% of the commission we are paid</strong> on bookings made by the people you send. <strong>60%</strong> in any month where your settled earnings pass $500.</li><li>Free to join. Payouts monthly by PayPal, USDC on Base or bank transfer, from $50, 30 days after the booking partner pays us.</li><li>Our booking partners have approved sub-affiliates, so this is inside their terms, not around them.</li></ul><p>Why half: the share is of our commission, not of the booking price, so a small percentage of it would be a few cents a booking. Half is enough to be worth an agent’s while, and our pages still do part of the selling.</p><h3>Joining without a browser</h3><p>Everything is MCP tools on https://tablejourney.com/mcp (streamable HTTP, no key needed to read):</p><p>A six-digit code goes to that address. Then:</p><p>That returns an API key and a referral code. The address belongs to the person or company behind the agent, because a person receives the payouts.</p><h3>How a booking gets attributed</h3><p>Send the key as Authorization: Bearer &lt;key&gt; on the MCP connection. From then on every booking link the read tools return ( experiences, stays, tickets, car_hire and the rest) is a /go/ link signed for your key, and the link carries your code in the partner&#39;s own sub-id field: cmp for GetYourGuide, campaign for Viator, cid for Musement, clickref for Awin and sid for CJ. That sub-id is what each partner reports back with the commission, so attribution does not depend on a cookie surviving in somebody&#39;s browser.</p><p>If your agent sends people to pages instead, partner_link returns any tablejourney.com page with ?ref=&lt;code&gt;. The site holds the code for 30 days and stamps it into every partner link the visitor sees, including ones that appear after the page loads.</p><p>partner_stats shows visits, booking clicks, and earnings as pending, confirmed and paid. partner_payout_method sets where the money goes; it takes effect only after a code sent to the account&#39;s address, so a leaked key cannot redirect payouts.</p><h3>For agents that prefer OAuth</h3><p>The usual discovery documents are there:</p><ul><li>/.well-known/oauth-authorization-server (RFC 8414), with dynamic client registration (RFC 7591) and PKCE S256</li><li>/.well-known/oauth-protected-resource (RFC 9728); a 401 from the partner API carries WWW-Authenticate pointing at it</li><li>/.well-known/agent-card.json, an A2A card whose food travel skill is answered by our own model from the same database</li></ul><p>An MCP client that handles the OAuth flow can sign the person in through the browser instead of handling a key.</p><h3>What we ask</h3><p>Pass booking links on unchanged, tell people they are affiliate links, and point them at the page you got the facts from. The full terms are short: <a href="https://tablejourney.com/partners/terms/">https://tablejourney.com/partners/terms/</a></p><p>Program page: <a href="https://tablejourney.com/partners/">https://tablejourney.com/partners/</a>. Agent guide and the full tool list: <a href="https://tablejourney.com/agents/">https://tablejourney.com/agents/</a>. Questions go to <a href="/service/mailto:support@tablejourney.com">support@tablejourney.com</a>, and we read them.</p><p><em>Originally published at </em><a href="https://dev.to/tablejourney/your-ai-agent-can-earn-a-commission-on-the-travel-it-recommends-8do"><em>https://dev.to</em></a><em> on October 21, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d646fc75a48f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop storing event dates: store the rule and compute the next edition]]></title>
            <link>https://medium.com/@tablejourney/stop-storing-event-dates-store-the-rule-and-compute-the-next-edition-5c913ac1a90c?source=rss-eac72a09d0bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c913ac1a90c</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[webdev]]></category>
            <category><![CDATA[datetime]]></category>
            <category><![CDATA[open-data]]></category>
            <dc:creator><![CDATA[TableJourney]]></dc:creator>
            <pubDate>Fri, 16 Oct 2026 06:10:58 GMT</pubDate>
            <atom:updated>2026-10-19T07:48:59.063Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FKMbLmhYjNWuHEen.png" /></figure><p>Most event listings go stale in a predictable way. Someone types “18 to 21 November 2026” into a database, the event happens, and the page keeps showing last year’s dates until a person notices. For one-off events that is fine. For annual events it is a bug you ship every year.</p><p>At TableJourney we keep the next dates of about 1,400 food festivals. Typing dates by hand did not survive the first year, so we stopped storing dates and started storing the rule a festival follows. The site computes the next edition from the rule every day. This post shows the shapes of rule we needed, with working Python.</p><h3>Three kinds of recurrence</h3><p>After going through the whole dataset, almost every annual event fell into one of three groups:</p><ol><li><strong>Fixed day of the year.</strong> “Every 24 to 26 December.” The easy case: store month and day, roll the year forward.</li><li><strong>Nth weekday of a month.</strong> “The third Thursday of November, for four days.” The weekday holds, the day number moves.</li><li><strong>Anchored to a moveable feast.</strong> Easter, Lunar New Year, Mid-Autumn, Ramadan, Diwali. These move by weeks between years, so neither of the first two works.</li></ol><p>A fourth shape, “the weekend after Lunar New Year”, turned out to be common enough to need its own rule, and it is the one that catches people out.</p><h3>The rule as data</h3><p>Each event carries a small date_rule object instead of a date. These are real rules from our data:</p><p>The second one reads “the Sunday before the last Monday of the month, for two days”, which is how a lot of bank-holiday weekend events are actually defined. The month comes from the event’s stored start_month; the rule never contains a year, so it keeps working.</p><h3>Nth weekday</h3><p>The helper is short. n is 1 to 5, or -1 for the last one:</p><p>Returning None for &quot;the fifth Friday&quot; in a month that has four is deliberate: the caller can then look at the next year instead of inventing a date.</p><h3>Easter: compute it, do not table it</h3><p>Easter is the one moveable feast you can compute exactly. This is the Anonymous Gregorian algorithm, as it sits in our code:</p><pre>[&#39;2026-04-05&#39;, &#39;2027-03-28&#39;, &#39;2028-04-16&#39;]</pre><p>Carnival, Lent markets and anything defined as “N days before Easter” become an offset from this date. The {&quot;anchor&quot;: &quot;easter&quot;, &quot;end_offset&quot;: -47} rule above ends a season on Shrove Tuesday, 47 days before Easter Sunday.</p><h3>Lunar and religious calendars: a small table, sourced</h3><p>Lunar New Year, Mid-Autumn, Ramadan, Eid and Diwali cannot be computed reliably from a formula you want to maintain. We keep a small JSON table of anchor dates per year, each from a published source (an observatory’s lunar tables, published religious calendars), and the code reads it:</p><p>The table has an end. When an anchor runs out of years, the resolver returns None and the event keeps its stored month and day, and the data validator flags every rule whose anchor table ends too soon, so the table gets extended before it matters. A table that silently ends is worse than no table.</p><h3>The weekend-after rule</h3><p>Here is the trap. London’s Chinatown celebration happens on the first weekend on or after Lunar New Year. In 2026 the holiday is a Tuesday, so the event is the following Saturday. In 2027 the holiday is itself a Saturday. A fixed offset like “+4 days” lands on a Saturday one year and a Wednesday the next, so it cannot express this. Snap forward to a weekday instead:</p><p>We also support weekday_nearest (the closest named weekday in either direction) for events that celebrate a holiday on the weekend nearest to it.</p><h3>Picking the next edition</h3><p>With an occurrence function per rule, the next edition is the earliest occurrence that has not ended yet. Check a small window of years, because an event in early January belongs to next year when you ask in December, and a season that started last year may still be running:</p><p>Comparing against the end date rather than the start keeps a running event on the page as “on now” until its last day. Some events run several editions a year (restaurant weeks in winter and summer), so the real code takes a list of rules and picks the soonest across all of them.</p><h3>What this bought us</h3><ul><li>Titles, snippets and structured data always show the next real dates, with no yearly data entry.</li><li>One Hong Kong page had been advertising 17 February 2027 for Lunar New Year, when the holiday is on the 6th. A rule cannot make that mistake.</li><li>The same resolved dates feed everything downstream: the pages, the calendar feeds, the API and an open dataset. One computation, many outputs, no disagreements between them.</li></ul><p>The rule format is deliberately boring JSON so that research agents and people can both write it. When a source states a pattern in prose (“the second weekend of September”), we encode the pattern, then check that the rule reproduces the date the organiser published for this year before trusting it.</p><p>If you want to see the result, the dates of all of these events are in an open dataset (CC BY 4.0) you can query or download: <a href="https://tablejourney.com/festivals/statistics/">https://tablejourney.com/festivals/statistics/</a> has the summary and the links. How do you handle recurring dates in your own projects? I would like to hear about rule shapes we have not needed yet.</p><p><em>Originally published at </em><a href="https://dev.to/tablejourney/stop-storing-event-dates-store-the-rule-and-compute-the-next-edition-2lgc"><em>https://dev.to</em></a><em> on October 16, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c913ac1a90c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Food festival dates as open data: a free API, an MCP server and SQL]]></title>
            <link>https://medium.com/@tablejourney/food-festival-dates-as-open-data-a-free-api-an-mcp-server-and-sql-0ae47d185b37?source=rss-eac72a09d0bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ae47d185b37</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[open-data]]></category>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[travel]]></category>
            <dc:creator><![CDATA[TableJourney]]></dc:creator>
            <pubDate>Mon, 05 Oct 2026 15:20:53 GMT</pubDate>
            <atom:updated>2026-10-09T17:58:58.101Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gTyOaQtTAxHjoOGN.png" /></figure><p>Every year I hit the same problem planning food trips: festival listings tell you a festival exists, but not when the next one is. Pages still show last year’s dates, or say “every autumn”.</p><p>So at TableJourney we keep the next dates of more than 1,500 food festivals in 55 countries, and we have opened the data up four ways: a REST API, an MCP server for AI assistants, a SQL copy on DoltHub and a plain CSV. All free, no sign-up.</p><h3>How the dates stay current</h3><p>A date like “the second weekend of October” goes stale every year. So we store each festival’s recurrence rule rather than a date: nth weekday of a month, a fixed day, or an anchor such as Easter or the lunar calendar for Lunar New Year and Mid-Autumn markets. The next edition is computed from the rule, and each festival page carries the source we checked and the date we checked it.</p><h3>REST: festivals between two dates</h3><pre>curl &quot;https://tablejourney.com/api/v1/festivals?country=italy&amp;from=2026-10-10&amp;to=2026-11-30&amp;limit=3&quot;</pre><p>Each result has a name, city, starts_on, ends_on, month, whether it is annual, a short summary and a link to the page with the sources. The same API answers other trip questions, for example the signature dishes of a city and where to eat them:</p><pre>curl &quot;https://tablejourney.com/api/v1/dishes?country=japan&amp;city=osaka&amp;limit=2&quot;</pre><p>The full list of endpoints (places, a composed food day, experiences, things to do) is in the OpenAPI docs at <a href="https://tablejourney.com/api/v1/docs">https://tablejourney.com/api/v1/docs</a>.</p><h3>MCP: ask an assistant</h3><p>The same data is a remote MCP server (streamable HTTP) at https://tablejourney.com/mcp. In Claude Code:</p><pre>claude mcp add --transport http tablejourney https://tablejourney.com/mcp</pre><p>Or in any MCP client config:</p><p>Then ask things like “which food festivals are on in Spain the week I am there” or “plan a vegetarian food day in Lisbon on Sunday”. Tools include festivals, search_places, plan_day, things_to_do and experiences. Setup notes for other clients are at <a href="https://tablejourney.com/agents/">https://tablejourney.com/agents/</a>.</p><h3>SQL: query it on DoltHub</h3><p>The dataset is mirrored weekly to DoltHub, so you can query it without downloading anything:</p><p>Today that returns October (197), September (190) and November (161). Run it at <a href="https://www.dolthub.com/repositories/tablejourney/food-festivals">https://www.dolthub.com/repositories/tablejourney/food-festivals</a> or through DoltHub’s SQL API.</p><h3>Or embed it: free widgets</h3><p>If you would rather show the dates than query them, the widget builder at <a href="https://tablejourney.com/widgets/">https://tablejourney.com/widgets/</a> makes an embed in three steps: choose a widget, search a city or country, pick the colours, then copy one line of code. There are six widgets:</p><ul><li><strong>Festival calendar</strong>: the next food festivals in a city, a country or the whole world</li><li><strong>Christmas markets</strong>: this season’s markets and the dates each opens</li><li><strong>Where to eat</strong>: our top places in a city, for any topic we cover</li><li><strong>Signature dishes</strong>: what to eat in a city, with photos</li><li><strong>City rank</strong>: the city’s place in our food festival index</li><li><strong>Statistics</strong>: charts of the world’s festivals (busiest month, weekday, length, share free to enter)</li></ul><p>The preview shows each widget on a light and a dark site, and the colours can be light, dark or automatic, which follows each reader’s own setting. Every widget is a small static page in an iframe: no cookies, no scripts, and it updates itself daily. Every place we cover has every widget, so a city with nothing dated yet shows an empty state instead of breaking your page.</p><p>This is what the builder gives you for Chicago:</p><pre>&lt;iframe src=&quot;https://tablejourney.com/embed/festivals/united-states/chicago/&quot; title=&quot;Food festivals in Chicago&quot; width=&quot;100%&quot; height=&quot;570&quot; style=&quot;border:0;border-radius:14px;max-width:420px&quot; loading=&quot;lazy&quot;&gt;&lt;/iframe&gt;<br>&lt;p style=&quot;font-size:13px;margin:6px 0 0&quot;&gt;&lt;a href=&quot;https://tablejourney.com/united-states/chicago/festivals/&quot;&gt;Food festivals in Chicago&lt;/a&gt; by TableJourney&lt;/p&gt;</pre><p>Prefer a calendar app? Every city, country and kind of festival is also an .ics feed you can subscribe to in Google, Apple or Outlook, or import into an events calendar by URL, for example <a href="https://tablejourney.com/calendar/united-states/chicago.ics">https://tablejourney.com/calendar/united-states/chicago.ics</a>. The full list is at <a href="https://tablejourney.com/calendar/">https://tablejourney.com/calendar/</a>.</p><h3>Download it</h3><p>The licence is CC BY 4.0: use it for anything, with a credit link.</p><p>If a date is wrong or a festival is missing, tell me in the comments or through the contact page; corrections from organisers are locked in so later updates cannot overwrite them.</p><p><em>Originally published at </em><a href="https://dev.to/tablejourney/food-festival-dates-as-open-data-a-free-api-an-mcp-server-and-sql-55f4"><em>https://dev.to</em></a><em> on October 5, 2026.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ae47d185b37" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>