<?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[Kunavo Engineering Notes]]></title><description><![CDATA[Kunavo Engineering Notes]]></description><link>https://kunavo.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 20:46:44 GMT</lastBuildDate><atom:link href="https://kunavo.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Three MCP configuration mistakes you can reproduce without a server or API key]]></title><description><![CDATA[Reproduce three Claude Code MCP configuration mistakes with synthetic JSON. Learn what static checks catch and what still needs a real connection.]]></description><link>https://kunavo.hashnode.dev/three-mcp-configuration-mistakes-you-can-reproduce-without-a-server-or-api-key</link><guid isPermaLink="true">https://kunavo.hashnode.dev/three-mcp-configuration-mistakes-you-can-reproduce-without-a-server-or-api-key</guid><category><![CDATA[mcp]]></category><category><![CDATA[claude-code]]></category><dc:creator><![CDATA[Kunavo]]></dc:creator><pubDate>Fri, 27 Nov 2026 09:38:36 GMT</pubDate><content:encoded><![CDATA[<p>A <code>.mcp.json</code> file can parse successfully and still contain a configuration mistake. The examples below separate problems visible in the file from problems that require a real connection.</p>
<p>Disclosure: I operate Kunavo, which hosts the free checker used here. This article was prepared with AI assistance. The examples use placeholder endpoints and no real credentials.</p>
<p>Open the <a href="https://kunavo.com/workflows/claude-code-mcp-checker?utm_source=hashnode&amp;utm_medium=community&amp;utm_campaign=mcp_checker_20261127">Claude Code MCP Config Checker</a>. You can try these examples without a Kunavo account or API key. Paste one example at a time, leave the optional environment-name field empty initially, and select <strong>Check configuration</strong>.</p>
<h3>1. A remote URL needs an explicit transport</h3>
<p>Try:</p>
<pre><code class="language-json">{
  "mcpServers": {
    "docs": {
      "url": "https://mcp.example.com/mcp"
    }
  }
}
</code></pre>
<p>The checker reports zero recognized servers and points out that <code>docs</code> has a URL but no type. Add <code>"type": "http"</code> inside the <code>docs</code> object and check again: it recognizes <code>docs (http)</code> and reports a static pass.</p>
<p>That distinction comes from the client contract. Claude Code treats an omitted type as stdio and rejects a URL-only entry without a type. Use the transport your actual server documents; this example only illustrates an HTTP-shaped entry. <a href="https://code.claude.com/docs/en/mcp#option-1-add-a-remote-http-server">Official MCP configuration documentation</a>.</p>
<h3>2. An environment reference needs a separate environment check</h3>
<p>Now try:</p>
<pre><code class="language-json">{
  "mcpServers": {
    "docs": {
      "type": "http",
      "url": "https://mcp.example.com/mcp",
      "headers": {
        "Authorization": "Bearer ${DOCS_MCP_TOKEN}"
      }
    }
  }
}
</code></pre>
<p>The checker recognizes the HTTP entry and asks you to confirm that <code>DOCS_MCP_TOKEN</code> is available to the Claude Code process.</p>
<p>For this exercise, put only <code>DOCS_MCP_TOKEN</code> in <strong>Available environment variable names</strong> and run the check again. The reminder disappears. Nothing has been authenticated: you have only told the checker which name to expect. Never put a token value into that field.</p>
<p>In a real setup, check the process that starts the client. A name available in one terminal may be missing when an editor launches it. The client supports environment references in <code>.mcp.json</code>; the checker cannot inspect that environment. <a href="https://code.claude.com/docs/en/mcp#environment-variable-expansion-in-mcp-json">Official environment-variable documentation</a>.</p>
<h3>3. Valid JSON can still contain the wrong value types</h3>
<p>Clear the environment-name field and try:</p>
<pre><code class="language-json">{
  "mcpServers": {
    "local": {
      "command": "node",
      "args": "./demo-mcp.mjs",
      "env": {
        "RETRY_COUNT": 3
      }
    }
  }
}
</code></pre>
<p>This is valid JSON. The checker still reports two problems: stdio arguments must be an array of strings, and environment values must be strings.</p>
<p>Change those fields to:</p>
<pre><code class="language-json">"args": ["./demo-mcp.mjs"],
"env": {
  "RETRY_COUNT": "3"
}
</code></pre>
<p>The checker then recognizes <code>local (stdio)</code> and reports a static pass. It has not checked whether Node is installed or whether that file exists. In this example, the filename is deliberately a placeholder.</p>
<h3>What a passing result tells you</h3>
<p>These checks can identify the three file-level mistakes above. They do not start an MCP process, contact the example endpoint, inspect your environment, complete OAuth, or confirm a working tool call.</p>
<p>The checker is also a limited set of checks, not a complete implementation of every Claude Code option. For example, current Claude Code documentation accepts <code>streamable-http</code> as an alias for <code>http</code>; the checker currently flags that alias. Check the official documentation if a valid client configuration disagrees with the tool.</p>
<p>For your real configuration, remove secrets before sharing diagnostics, confirm the effective server entry with <code>claude mcp get NAME</code>, and inspect its connection state in the client. Keep “the file passes these static checks” separate from “the server connected successfully.”</p>
]]></content:encoded></item><item><title><![CDATA[A moved API key should not rewrite yesterday's client bill]]></title><description><![CDATA[Reproduce a billing attribution bug in SQLite: stable group IDs, completed charges, revocation and six offline Python tests.]]></description><link>https://kunavo.hashnode.dev/a-moved-api-key-should-not-rewrite-yesterday-s-client-bill</link><guid isPermaLink="true">https://kunavo.hashnode.dev/a-moved-api-key-should-not-rewrite-yesterday-s-client-bill</guid><category><![CDATA[SQL]]></category><category><![CDATA[Python]]></category><dc:creator><![CDATA[Kunavo]]></dc:creator><pubDate>Thu, 26 Nov 2026 18:36:43 GMT</pubDate><content:encoded><![CDATA[<p>I operate Kunavo. This article and its code were prepared with AI assistance and checked against the runnable example below. The amounts and identifiers are synthetic, not customer bills. The example runs locally with Python's standard library; no API key or paid request is needed.</p>
<p>An API key changes owners. Yesterday it belonged to Client A; today it belongs to Client B. If your reporting query joins historical usage to the key's current group, yesterday's cost silently moves too.</p>
<p>The account total can remain perfectly correct while both client totals are wrong.</p>
<h2>A five-dollar example</h2>
<p>Consider three completed operations, in order:</p>
<ol>
<li>Key <code>key-1</code> records a completed $3 charge in Client A.</li>
<li>The operator moves the key into Client B.</li>
<li>The key records a completed $2 charge in Client B.</li>
</ol>
<p>The expected report is $3 for A and $2 for B. A tempting query instead reports $5 for B:</p>
<pre><code class="language-sql">SELECT k.group_id, SUM(c.cost_units)
FROM booked_costs c
JOIN api_keys k ON k.id = c.key_id
GROUP BY k.group_id;
</code></pre>
<p>The join answers a different question: how much historical cost belongs to keys that are in this group <em>now</em>? That can be useful for a current inventory report. It is the wrong basis for attributing completed charges to clients.</p>
<h2>Snapshot the attribution when you book the charge</h2>
<p>The small teaching schema in our example stores a group ID in two places:</p>
<ul>
<li><code>api_keys.group_id</code> is mutable membership for future work.</li>
<li><code>booked_costs.group_id</code> records the attribution of a particular completed charge.</li>
</ul>
<p>The booking operation copies membership in the same SQL statement that inserts the charge:</p>
<pre><code class="language-sql">INSERT INTO booked_costs(event_id, key_id, group_id, cost_units)
SELECT ?, id, group_id, ?
FROM api_keys
WHERE id = ? AND revoked = 0;
</code></pre>
<p>Then the historical report groups the ledger's own column:</p>
<pre><code class="language-sql">SELECT group_id, SUM(cost_units)
FROM booked_costs
GROUP BY group_id;
</code></pre>
<p>This does not make the rest of billing automatic. You still need to decide the attribution instant. For asynchronous jobs, submission and settlement may be minutes apart. This example captures membership at the booking operation; it makes no claim that submission-time and settlement-time attribution are equivalent.</p>
<h2>Run the regression locally</h2>
<p>The complete <a href="https://github.com/cooldk/kunavo-examples/tree/main/billing-attribution">billing-attribution example</a> contains a synthetic database, the deliberately wrong query, the corrected query and six tests. The code is MIT-licensed.</p>
<pre><code class="language-sh">git clone https://github.com/cooldk/kunavo-examples.git
cd kunavo-examples/billing-attribution
python3 demo.py
python3 -m unittest -v
</code></pre>
<p>The demo prints:</p>
<pre><code class="language-text">Wrong: current membership
  client-b: $5.00000000
Correct: booked group
  client-a: $3.00000000
  client-b: $2.00000000
</code></pre>
<p>All six offline tests passed on November 26, 2026. Beyond moving a key, they cover revocation, archiving a group and reusing its name, removing a key from its group, duplicate event IDs, and subcent precision.</p>
<p>The revocation test matters because a report that filters to active keys can lose legitimate historical charges. The reused-name case matters because names are labels: a new group called “Client A” should not inherit the old group's bill. Stable IDs keep those histories distinct.</p>
<p>For arithmetic, the example stores integers with 100,000,000 units per dollar and formats them with <code>Decimal</code>. Its smallest test charge is $0.00000001. This is a fixed-unit accounting demonstration, not a current model price or a benchmark.</p>
<h2>What this does and does not prove</h2>
<p>The tests validate an in-memory SQLite model. They do not validate a production service, concurrent settlement, refunds, tax treatment, authorization or spending caps. There is no balance debit in the example. In a real system, the ledger entry and corresponding balance change need an atomic transaction, and replay handling needs a deliberate contract.</p>
<p>Kunavo's current <a href="https://kunavo.com/docs/key-groups?utm_source=hashnode&amp;utm_medium=article&amp;utm_campaign=billing_attribution_20261126">key-group documentation</a> describes retained booked usage when keys move, group monthly limits and CSV exports. All groups draw on one account balance; they are not separate customer logins or wallets. The teaching schema above is independent of the service's implementation.</p>
<p>When reviewing your own reporting query, check which table supplies the grouping key. A correct grand total is not enough to prove that each client received the correct share.</p>
]]></content:encoded></item></channel></rss>