<?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"><channel><title><![CDATA[Recipe for Agents]]></title><description><![CDATA[Recipe for Agents]]></description><link>https://recipeforagents.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6af8c77a4e81e7c84b2bd847/5fb26ffa-b4e3-4db4-b3d1-0bce7f5232a0.png</url><title>Recipe for Agents</title><link>https://recipeforagents.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Nov 2026 21:12:19 GMT</lastBuildDate><atom:link href="https://recipeforagents.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to serve MCP's old and new protocol from one stateless handler]]></title><description><![CDATA[The 2026-07-28 MCP spec removed initialize and sessions. How one stateless handler serves both eras, and what 2,163 real requests showed.]]></description><link>https://recipeforagents.hashnode.dev/how-to-serve-mcp-s-old-and-new-protocol-from-one-stateless-handler</link><guid isPermaLink="true">https://recipeforagents.hashnode.dev/how-to-serve-mcp-s-old-and-new-protocol-from-one-stateless-handler</guid><category><![CDATA[mcp]]></category><category><![CDATA[Python]]></category><category><![CDATA[ai agents]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Recipe for Agents]]></dc:creator><pubDate>Mon, 16 Nov 2026 10:10:23 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6af8c77a4e81e7c84b2bd847/bda8a2fd-9af2-4587-a02e-e4dbf4b75659.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The 2026-07-28 revision of the Model Context Protocol removed the <code>initialize</code> handshake and protocol-level sessions. Every request now carries its own protocol version and client capabilities in <code>_meta</code>, and servers answer a new <code>server/discover</code> method instead. For a read-only server that is good news: there was never any state worth keeping.</p>
<p>The catch is that clients don't all move on the same day. In its first three days in the official MCP Registry, the free, read-only MCP server I maintain for Recipe for Agents received 1,101 <code>initialize</code> requests and 98 <code>server/discover</code> requests. Roughly one opening request in twelve was in the new style. So the server speaks both, from one handler, in about 450 lines of standard-library Python. This is how, and what the traffic looked like.</p>
<p>(Disclosure: Recipe for Agents is our site. I drafted this with an AI assistant and checked each protocol detail against the specification's changelogs for 2025-11-25 and 2026-07-28 and against our own code.)</p>
<h2>Pick the era per request, not per connection</h2>
<p>Without sessions there is nothing to remember about a client, so the decision is made on each message. If <code>params._meta</code> carries a protocol version that isn't one of the old ones, the request is modern; otherwise it is legacy.</p>
<pre><code class="language-python">LEGACY = ["2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"]
MODERN = ["2026-07-28"]
VERSION_KEY = "io.modelcontextprotocol/protocolVersion"

meta = params.get("_meta") if isinstance(params.get("_meta"), dict) else {}
if VERSION_KEY in meta and meta[VERSION_KEY] not in LEGACY:
    result = handle_modern(method, params, meta, headers)
else:
    result = handle_legacy(method, params, headers)
</code></pre>
<p>Because neither path stores anything between calls, any process behind the load balancer can answer any request, which is the point of the new spec.</p>
<h2>What the modern path has to check</h2>
<p>The 2026-07-28 revision moves a lot of validation onto the server:</p>
<ul>
<li><strong>The version.</strong> If <code>_meta</code> names a version you don't support, answer <code>UnsupportedProtocolVersion</code> (code <code>-32022</code>) and list the versions you do support, so the client can retry.</li>
<li><strong>Client capabilities.</strong> <code>io.modelcontextprotocol/clientCapabilities</code> must be present in <code>_meta</code>. A request without it is invalid.</li>
<li><strong>Headers that mirror the body.</strong> Streamable HTTP requests now carry <code>MCP-Protocol-Version</code>, <code>Mcp-Method</code> and, for <code>tools/call</code>, <code>Mcp-Name</code>. They must match the JSON body; if they don't, answer <code>HeaderMismatch</code> (<code>-32020</code>) with HTTP 400. Header values can arrive base64-encoded as <code>=?base64?...?=</code>, so decode before comparing.</li>
<li><strong>The result shape.</strong> Every result carries <code>resultType: "complete"</code> (the other value, <code>"input_required"</code>, belongs to multi round-trip requests, which a read-only server never needs), and the server identifies itself in the result's <code>_meta</code>.</li>
<li><strong>Cache hints.</strong> <code>tools/list</code> results now need <code>ttlMs</code> and <code>cacheScope</code>. Our tool list changes only when we deploy, so it says one hour and <code>"public"</code>.</li>
</ul>
<p><code>server/discover</code> itself is small: supported versions, capabilities, instructions and the same cache hints.</p>
<h2>What the legacy path still needs</h2>
<p>Older clients still open with <code>initialize</code>. Echo their requested version if you support it, otherwise answer with your newest legacy version. Sessions were always optional, so we never mint an <code>Mcp-Session-Id</code>, and requests are served exactly as they are on the modern path.</p>
<p>Beyond that, the old path needs <code>ping</code>, <code>tools/list</code> and <code>tools/call</code>. Notifications such as <code>notifications/initialized</code> get HTTP 202 with no body. We also answer <code>resources/list</code> and <code>prompts/list</code> with empty lists rather than an error, which costs nothing. JSON-RPC batches (allowed in 2025-03-26, dropped in 2025-06-18) are still accepted, capped at 20 messages.</p>
<h2>Transport details that bite</h2>
<ul>
<li><strong>JSON first.</strong> Reply with one JSON object unless the client accepts only <code>text/event-stream</code>; then send exactly one SSE event. A read-only answer has nothing to stream.</li>
<li><strong>No GET stream.</strong> A GET asking for an event stream gets 405. The 2026 revision replaced that endpoint with <code>subscriptions/listen</code>, and a server with no change notifications has nothing to send on either.</li>
<li><strong>No DELETE.</strong> Session termination gets 405, because there are no sessions to end.</li>
<li><strong>Limits up front.</strong> Bodies over 64 KB get 413. More than 12 requests in flight in one process get 503 with <code>Retry-After: 2</code>, and nginx in front adds a per-client rate limit and a 20-second read timeout.</li>
</ul>
<h2>Errors the model can fix</h2>
<p>Since 2025-11-25 the spec says input validation errors should come back as tool execution errors, not protocol errors, so the model can read them and correct the call. Our tools return <code>isError: true</code> with a plain sentence ("Invalid arguments: query is longer than 200 characters"). A call to a tool that doesn't exist stays a protocol error that lists the real tool names.</p>
<h2>What three days of traffic looked like</h2>
<p>Counts per UTC day, from the moment the server went live on 13 November (16:36 UTC) and was listed in the registry the same day. Our own uptime monitor is excluded by its User-Agent.</p>
<table>
<thead>
<tr>
<th>Day</th>
<th><code>initialize</code></th>
<th><code>server/discover</code></th>
<th><code>tools/list</code></th>
<th>Tool calls</th>
</tr>
</thead>
<tbody><tr>
<td>13 Nov (from 16:36)</td>
<td>96</td>
<td>22</td>
<td>85</td>
<td>9</td>
</tr>
<tr>
<td>14 Nov</td>
<td>572</td>
<td>41</td>
<td>499</td>
<td>12</td>
</tr>
<tr>
<td>15 Nov</td>
<td>433</td>
<td>35</td>
<td>348</td>
<td>11</td>
</tr>
<tr>
<td>Total</td>
<td>1,101</td>
<td>98</td>
<td>932</td>
<td>32</td>
</tr>
</tbody></table>
<p>Of the 2,163 requests we count, 32 were tool calls. The rest were handshakes and tool-list reads, clients and directories checking what the server offers, most of them still in the old style. Three things follow from that:</p>
<ol>
<li><strong>Make <code>tools/list</code> cheap and stable.</strong> It is the request you will serve most. Build it once, return the tools in a fixed order (the 2026 spec asks for deterministic order so clients and model prompt caches can reuse it) and set a real <code>ttlMs</code>.</li>
<li><strong>Don't drop the legacy path yet.</strong> 92% of opening requests still used <code>initialize</code>.</li>
<li><strong>Count your own traffic separately.</strong> Without excluding our monitor, a five-minute health check would have looked like real users.</li>
</ol>
<h2>Try it</h2>
<p>The server is public, keyless and read-only, so you can point any client at it and watch both paths work: the setup for eight clients is at <a href="https://recipeforagents.com/connect/">recipeforagents.com/connect</a>. The changelogs I checked against are on modelcontextprotocol.io under the 2025-11-25 and 2026-07-28 specifications.</p>
]]></content:encoded></item><item><title><![CDATA[One MCP server, eight clients: the config differences that break the setup]]></title><description><![CDATA[Claude Code, Cursor, VS Code, Codex, Gemini CLI, ChatGPT and n8n take one remote MCP server differently: the keys and limits that break setups.]]></description><link>https://recipeforagents.hashnode.dev/mcp-server-config-eight-clients</link><guid isPermaLink="true">https://recipeforagents.hashnode.dev/mcp-server-config-eight-clients</guid><category><![CDATA[mcp]]></category><category><![CDATA[ai agents]]></category><category><![CDATA[Developer Tools]]></category><category><![CDATA[claude]]></category><dc:creator><![CDATA[Recipe for Agents]]></dc:creator><pubDate>Sat, 14 Nov 2026 20:48:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6af8c77a4e81e7c84b2bd847/56bf3910-3562-489c-8252-706d0ab33d72.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The promise of MCP is that one server works in every client. It mostly does. What differs is the paperwork: the file the config goes in, the name of one key, the word for the transport, how long the client waits. Almost every "the server is added but I see no tools" report I have read comes down to one of a handful of those differences.</p>
<p>So here they are in one place, checked against each client's own documentation on 14 November 2026. To make it concrete, every example adds the same server: the free, read-only MCP server of <a href="https://recipeforagents.com/connect/">Recipe for Agents</a>, which I maintain. It needs no account and no key, so you can paste any snippet below and see the tools appear. Swap in your own URL afterwards.</p>
<h2>The same URL, eight shapes</h2>
<table>
<thead>
<tr>
<th>Client</th>
<th>Where the config lives</th>
<th>What you write</th>
</tr>
</thead>
<tbody><tr>
<td>Claude Code</td>
<td>command, or <code>.mcp.json</code> for project scope</td>
<td><code>claude mcp add --transport http &lt;name&gt; &lt;url&gt;</code></td>
</tr>
<tr>
<td>Claude Desktop / <a href="http://claude.ai">claude.ai</a></td>
<td>Customize &gt; Connectors &gt; + Add &gt; Add custom connector</td>
<td>name + URL in a form</td>
</tr>
<tr>
<td>Cursor</td>
<td><code>~/.cursor/mcp.json</code> or <code>.cursor/mcp.json</code></td>
<td><code>mcpServers</code> &gt; <code>url</code></td>
</tr>
<tr>
<td>VS Code</td>
<td><code>.vscode/mcp.json</code></td>
<td><code>servers</code> &gt; <code>"type": "http"</code> + <code>url</code></td>
</tr>
<tr>
<td>Codex CLI</td>
<td><code>~/.codex/config.toml</code></td>
<td><code>[mcp_servers.&lt;name&gt;]</code> + <code>url</code></td>
</tr>
<tr>
<td>Gemini CLI</td>
<td>command, saved in <code>settings.json</code></td>
<td><code>gemini mcp add -t http &lt;name&gt; &lt;url&gt;</code> (<code>httpUrl</code> in the file)</td>
</tr>
<tr>
<td>ChatGPT</td>
<td>Plugins &gt; + &gt; Add custom MCP server</td>
<td>URL + authentication in a form</td>
</tr>
<tr>
<td>n8n</td>
<td>MCP Client Tool node on an AI Agent</td>
<td>Server Transport: HTTP Streamable, Endpoint</td>
</tr>
</tbody></table>
<p>For the example server that means:</p>
<pre><code class="language-bash">claude mcp add --transport http recipe-for-agents https://recipeforagents.com/mcp-server
gemini mcp add -t http recipe-for-agents https://recipeforagents.com/mcp-server
</code></pre>
<pre><code class="language-jsonc">// Cursor: ~/.cursor/mcp.json
{ "mcpServers": { "recipe-for-agents": { "url": "https://recipeforagents.com/mcp-server" } } }

// VS Code: .vscode/mcp.json
{ "servers": { "recipe-for-agents": { "type": "http", "url": "https://recipeforagents.com/mcp-server" } } }
</code></pre>
<pre><code class="language-toml"># Codex CLI: ~/.codex/config.toml
[mcp_servers.recipe_for_agents]
url = "https://recipeforagents.com/mcp-server"
</code></pre>
<p>Now the places where it goes wrong.</p>
<h2>1. <code>mcpServers</code> in one editor, <code>servers</code> in the other</h2>
<p>Cursor, Claude's <code>.mcp.json</code> and most READMEs use a top-level <code>mcpServers</code> key. VS Code's <code>.vscode/mcp.json</code> uses <code>servers</code>, and a remote entry also wants <code>"type": "http"</code>. Paste a Cursor config into VS Code and nothing complains; the server just never shows up.</p>
<p>One more thing to know if you live in VS Code: its documentation now calls this setup the "Local harness" and says it is deprecated and will be removed in February 2027. The replacement is the Copilot format, which uses the portable <code>mcpServers</code> key in <code>~/.copilot/mcp-config.json</code> or a workspace <code>.mcp.json</code>. So the odd one out is slowly coming back into line.</p>
<h2>2. <code>httpUrl</code> and <code>url</code> mean different transports in Gemini CLI</h2>
<p>In Gemini CLI's <code>settings.json</code>, <code>httpUrl</code> is a streamable HTTP endpoint and <code>url</code> is an SSE endpoint. Write <code>url</code> for a server that only speaks streamable HTTP and Gemini CLI tries the wrong protocol: the server is listed, the tools are not. Adding the server with <code>gemini mcp add -t http</code> writes the right key for you. Two smaller notes: without <code>-s user</code> the server goes into the project's <code>.gemini/settings.json</code>, not your global one, and a header you pass with <code>-H</code> (a bearer token, say) ends up in that file as plain text, so keep it out of version control.</p>
<h2>3. Codex gives a tool call 60 seconds</h2>
<p>Codex CLI's <code>tool_timeout_sec</code> defaults to 60 seconds, and <code>startup_timeout_sec</code> to 10. That is fine for a lookup and too short for anything that collects data for a minute or two: the call is abandoned while the work carries on at the other end. Raise it in the server's table:</p>
<pre><code class="language-toml">[mcp_servers.my_slow_server]
url = "https://example.com/mcp"
bearer_token_env_var = "MY_SERVER_TOKEN"
tool_timeout_sec = 300
</code></pre>
<p><code>bearer_token_env_var</code> names an environment variable instead of putting the token in the file, which is the habit worth keeping in every client that allows it.</p>
<h2>4. Claude Code cuts long tool output</h2>
<p>Claude Code warns when one tool result passes 10,000 tokens and stops at 25,000 by default. A server that returns a whole dataset in one answer hits that quickly. Start Claude Code with <code>MAX_MCP_OUTPUT_TOKENS=50000</code> (or whatever you need), or better, ask the server for fewer rows. Inside a session, <code>/mcp</code> shows each server's status and runs the OAuth sign-in for servers that need one.</p>
<h2>5. Claude's custom connectors call your server from Anthropic's cloud</h2>
<p>This one surprises people who test against a local server. A custom connector in Claude Desktop or <a href="http://claude.ai">claude.ai</a> is not reached from your computer: Anthropic's documentation says the connection comes from its cloud, so a server on <code>localhost</code>, on a private network or behind a VPN will not connect, even when your browser can open it. Use Claude Code (which runs on your machine) for local servers, or put the server somewhere public. The menu has also moved: it is Customize &gt; Connectors &gt; + Add &gt; Add custom connector.</p>
<h2>6. ChatGPT reads the tool list once</h2>
<p>In ChatGPT the place is now called Plugins: + then "Add custom MCP server", a URL, an authentication choice, and "Create as a plugin". ChatGPT discovers the tools at that moment. Change a tool's name, description or schema on the server and ChatGPT keeps the old list until you open the connection under Plugins and press Refresh. Availability depends on your plan and workspace settings, so if the option is missing, that is the first thing to check.</p>
<h2>7. n8n's docs and n8n's node disagree</h2>
<p>n8n's documentation page for the MCP Client Tool node still describes a single "SSE Endpoint" field. The node itself has a Server Transport option with HTTP Streamable (the default in recent versions) and Server-Sent Events, plus an Endpoint field. If your node only offers SSE, update n8n before blaming the server. Authentication options are None, Bearer, Header, Multiple Headers and OAuth2.</p>
<h2>8. Configs with <code>/sse</code> in the URL are living on borrowed time</h2>
<p>The MCP specification replaced the old HTTP+SSE transport with streamable HTTP in its 2025-03-26 revision: one endpoint that takes POST requests. Servers are dropping the old endpoints, and a config that ends in <code>/sse</code> is usually the reason an old setup "suddenly" stopped working. Point it at the server's current URL with the streamable HTTP transport.</p>
<h2>A two-minute check for any new server</h2>
<ol>
<li>Add it with the client's own command where one exists (Claude Code, Gemini CLI): the command writes the right keys.</li>
<li>Open the client's server list (<code>/mcp</code> in Claude Code and Gemini CLI, the MCP Logs output panel in Cursor) and confirm the tools are listed, not just the server.</li>
<li>Call the cheapest tool first. On the example server, ask "which tool gets me LinkedIn company headcounts?" and it answers from its catalogue without running anything.</li>
<li>Only then add secrets, and keep them in environment variables or the client's prompt-for-secret feature (VS Code's <code>inputs</code> with <code>"password": true</code>) rather than in a file you might commit.</li>
</ol>
<h2>Limits of this page</h2>
<p>Clients change their MCP support every few weeks, menus included. Everything above was checked against the official pages listed below on 14 November 2026, not against every client version in use. If something has moved, the vendor's page wins.</p>
<p>Sources: <a href="https://code.claude.com/docs/en/mcp">Claude Code MCP</a> · <a href="https://support.claude.com/en/articles/11175166-getting-started-with-custom-connectors-using-remote-mcp">Claude custom connectors</a> · <a href="https://cursor.com/docs/context/mcp">Cursor MCP</a> · <a href="https://code.visualstudio.com/docs/agents/reference/mcp-configuration">VS Code MCP configuration</a> · <a href="https://learn.chatgpt.com/docs/extend/mcp?surface=cli">Codex MCP</a> · <a href="https://geminicli.com/docs/tools/mcp-server/">Gemini CLI MCP servers</a> · <a href="https://developers.openai.com/apps-sdk/deploy/connect-chatgpt">ChatGPT: connect from ChatGPT</a> · <a href="https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolmcp/">n8n MCP Client Tool</a> · <a href="https://modelcontextprotocol.io/specification/2025-03-26/basic/transports">MCP transports, 2025-03-26</a></p>
<p><em>I run</em> <a href="https://recipeforagents.com/"><em>Recipe for Agents</em></a><em>, which collects MCP configs, n8n workflows and agent skills for live web data; the example server is ours. Drafted with AI assistance and checked line by line against the sources above.</em></p>
]]></content:encoded></item></channel></rss>