<?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[CompsAPI]]></title><description><![CDATA[CompsAPI]]></description><link>https://compsapi.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 21 Nov 2026 16:39:00 GMT</lastBuildDate><atom:link href="https://compsapi.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Compare live asking prices with recent sold prices in Node.js (Reverb example)]]></title><description><![CDATA[A Node.js script that compares the median of live listings with the median of recent sales for any search, using one key and two requests.]]></description><link>https://compsapi.hashnode.dev/compare-live-asking-prices-with-recent-sold-prices-in-node-js-reverb-example</link><guid isPermaLink="true">https://compsapi.hashnode.dev/compare-live-asking-prices-with-recent-sold-prices-in-node-js-reverb-example</guid><category><![CDATA[Node.js]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[api]]></category><category><![CDATA[data analysis]]></category><category><![CDATA[reverb]]></category><dc:creator><![CDATA[Sam Smith]]></dc:creator><pubDate>Sat, 21 Nov 2026 12:45:25 GMT</pubDate><content:encoded><![CDATA[<p><em>Disclosure: we build CompsAPI, the sold-price API used in this tutorial. It was drafted with AI assistance, and the parameters were checked against CompsAPI's documentation. A free key needs no card.</em></p>
<p>A listing's asking price and what similar items actually sold for are different numbers. The distance between them is useful: it tells you how much haggling room a market has, and whether the going rate is above or below what sellers are asking right now.</p>
<p>This post builds a small Node.js script that compares the median of live listings with the median of recent sales for one search on one marketplace. It uses Reverb by default, since guitars and gear are a market where asking prices vary a lot.</p>
<h2>What you need</h2>
<ul>
<li>Node 18 or newer (it uses the built-in <code>fetch</code>, so nothing to install)</li>
<li>A free CompsAPI key (100 requests a month, no card), saved as an environment variable:</li>
</ul>
<pre><code class="language-bash">export COMPSAPI_KEY="your-key-here"
</code></pre>
<h2>The two endpoints</h2>
<p>CompsAPI has <code>/v1/sold</code> for completed sales and <code>/v1/active</code> for live listings. Both take <code>q</code> and <code>source</code>, and both accept <code>exclude=ai_junk</code>, which leaves out rows an AI model labels as lots, parts, accessories, empty boxes and the like. That matters here: a pile of cheap accessories pulls down both medians, and not by the same amount.</p>
<p>For scale, in CompsAPI's measurements on 18 November 2026, the Reverb search <code>fender stratocaster</code> over 30 days had a median of about $400 with the filter off and about $900 with it on, with about 1,130 of about 2,830 sales removed. The filter changes the answer a lot, so the script uses it on both sides.</p>
<h2>The script</h2>
<p>Save this as <code>gap.mjs</code>:</p>
<pre><code class="language-js">// gap.mjs: live asking-price median vs recent sold-price median for one search
const KEY = process.env.COMPSAPI_KEY;
const SOURCE = process.env.SOURCE ?? "reverb";
const QUERY = process.argv.slice(2).join(" ");

if (!QUERY) {
  console.error('usage: node gap.mjs "item name"');
  process.exit(1);
}

function median(values) {
  const s = [...values].sort((a, b) =&gt; a - b);
  const mid = Math.floor(s.length / 2);
  return s.length % 2 ? s[mid] : (s[mid - 1] + s[mid]) / 2;
}

async function prices(path, extra = {}) {
  const url = new URL(path, "https://api.compsapi.com");
  url.search = new URLSearchParams({
    q: QUERY,
    source: SOURCE,
    exclude: "ai_junk",
    ...extra,
  });
  const res = await fetch(url, { headers: { "X-API-Key": KEY } });
  if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
  const data = await res.json();
  return (data.items ?? []).map((row) =&gt; row.price);
}

const sold = await prices("/v1/sold", { days: "30" });
const active = await prices("/v1/active");

const usd = (x) =&gt; `$${x.toFixed(2)}`;
console.log(`${SOURCE}: ${QUERY}`);
if (sold.length &lt; 8 || active.length &lt; 8) {
  console.log(`Too thin to compare: ${sold.length} sales, ${active.length} live listings.`);
} else {
  const s = median(sold);
  const a = median(active);
  const gap = ((a - s) / s) * 100;
  console.log(`sold   (30 days): ${usd(s)} from ${sold.length} sales`);
  console.log(`asking (live)   : ${usd(a)} from ${active.length} listings`);
  console.log(`asking is ${gap.toFixed(1)}% ${gap &gt;= 0 ? "above" : "below"} sold`);
}
</code></pre>
<p>Run it with an item name:</p>
<pre><code class="language-bash">node gap.mjs "fender stratocaster"
</code></pre>
<p>Set <code>SOURCE=mercari</code> (or another marketplace) to compare somewhere else.</p>
<h2>How to read the output</h2>
<ol>
<li><strong>Check the counts first.</strong> The script refuses to compare when either side has fewer than 8 rows, because a median of a handful of rows is a direction, not a figure.</li>
<li><strong>A positive gap is normal.</strong> Sellers list high and sell lower. A large gap suggests room to negotiate.</li>
<li><strong>A negative gap is the interesting case.</strong> Live listings priced below recent sales can mean the market is softening, or that your search matches cheaper variants. Read a few listings before concluding anything.</li>
<li><strong>The two sides are not the same population.</strong> Live listings include items that will never sell at their asking price, so some gap is built in.</li>
</ol>
<h2>What it costs</h2>
<p>Two requests per search. On the free plan (100 requests a month, 10 a minute) that is 50 comparisons a month.</p>
<h2>Limits to know about</h2>
<ul>
<li><strong>Asking prices are not sale prices.</strong> The live median is a snapshot of what sellers want, not a forecast.</li>
<li><strong>The filter is not perfect.</strong> On marketplaces beyond eBay it agreed with CompsAPI's own labels on 97.7% of 600 test listings (Reverb 95.2%). On eBay it was about 92% of 690 listings. It does not detect counterfeits.</li>
<li><strong>Marketplaces have different histories.</strong> Reverb sales go back to 2014, Mercari and Poshmark from November 2025, and Vinted from 15 November 2026, so check a start date before widening <code>days</code>.</li>
<li><strong>I have not run this script against a live key.</strong> It follows the documented parameters and assumes both endpoints return rows under <code>items</code> with a <code>price</code> field. If it prints counts of zero, check the shape of the response first.</li>
</ul>
<p>CompsAPI is not affiliated with Reverb or the marketplaces named.</p>
<h2>Get a key</h2>
<p>A free key is enough to compare a few items you know well: <a href="https://compsapi.com/?utm_source=hashnode&amp;utm_medium=article&amp;utm_campaign=asking-vs-sold">get one here</a>. If the gap looks wrong for an item you know, tell us in the comments and we'll look.</p>
]]></content:encoded></item><item><title><![CDATA[Build a pricing function that says "not enough data" when it should (Node.js)]]></title><description><![CDATA[A short Node.js function that widens the date window before loosening the query, then returns a price, a range, a direction or no data.]]></description><link>https://compsapi.hashnode.dev/build-a-pricing-function-that-says-not-enough-data-when-it-should-node-js</link><guid isPermaLink="true">https://compsapi.hashnode.dev/build-a-pricing-function-that-says-not-enough-data-when-it-should-node-js</guid><category><![CDATA[Node.js]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[api]]></category><category><![CDATA[data analysis]]></category><category><![CDATA[ebay]]></category><dc:creator><![CDATA[Sam Smith]]></dc:creator><pubDate>Fri, 20 Nov 2026 10:23:51 GMT</pubDate><content:encoded><![CDATA[<p><em>Disclosure: we build CompsAPI, the sold-price API used in this tutorial. It was drafted with AI assistance, and the parameters and response fields were checked against CompsAPI's documentation. A free key needs no card.</em></p>
<p>Most pricing code has one failure mode in common: it returns a number whether or not there is anything behind it. A median of two sales looks exactly like a median of two hundred, and nothing downstream can tell them apart.</p>
<p>This post builds a small Node.js function that returns one of four honest answers for a search: a price, a range, a direction, or "not enough data". It widens the date window before it ever loosens the query, and it flags the one spread pattern that makes a median misleading.</p>
<h2>What you need</h2>
<ul>
<li>Node 18 or newer (it uses the built-in <code>fetch</code>, so nothing to install)</li>
<li>A free CompsAPI key (100 requests a month, no card), saved as an environment variable:</li>
</ul>
<pre><code class="language-bash">export COMPSAPI_KEY="your-key-here"
</code></pre>
<h2>The rules it follows</h2>
<p>These come from how thin markets behave, and they are worth writing down before any code:</p>
<ol>
<li><strong>An empty 90-day window is a measurement problem, not a price signal.</strong> Zero sales in 90 days means zero sales in 90 days. It says something about how often the item sells, not what it is worth.</li>
<li><strong>Widen the window before you loosen the query.</strong> Keep every filter and go from 90 days to 365, then to 1,095. If you drop the grade from a card search or the model suffix from a lens search, you are pricing a different item.</li>
<li><strong>How thin is too thin</strong> is a rule of thumb, not statistics: 0 to 2 clean sales is not a price, 3 to 7 is a direction (quote a range, never a figure), 8 to 20 is a usable median if the spread is tight, and 20 or more is a real distribution.</li>
<li><strong>A wide upper quartile is a warning.</strong> If the 75th percentile sits several times above the median, the search may be mixing two markets, for example a machine and its manual.</li>
</ol>
<h2>The function</h2>
<p>Save this as <code>thin.mjs</code>:</p>
<pre><code class="language-js">// thin.mjs: a price, a range, or "not enough data" for one eBay search
const KEY = process.env.COMPSAPI_KEY;
const BASE = process.env.COMPSAPI_BASE ?? "https://api.compsapi.com";
const QUERY = process.argv.slice(2).join(" ");
const WINDOWS = [90, 365, 1095]; // widen the window before you loosen the query
const ENOUGH = 8; // below this a median is a direction, not a figure
const TWO_MARKETS = 3; // my threshold: p75 this many times the median looks bimodal

if (!QUERY) {
  console.error('usage: node thin.mjs "item name"');
  process.exit(1);
}

async function statsFor(days) {
  const url = new URL("/v1/comps", BASE);
  url.search = new URLSearchParams({ q: QUERY, days: String(days), exclude: "ai_junk" });
  const res = await fetch(url, { headers: { "X-API-Key": KEY } });
  if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
  const data = await res.json();
  return data.stats ?? null;
}

function verdict(stats) {
  const n = stats?.used_for_stats ?? 0;
  if (n &lt;= 2) return { kind: "none", n };
  const band = { p25: stats.p25, p75: stats.p75 };
  if (n &lt; ENOUGH) return { kind: "direction", n, ...band };
  return {
    kind: n &gt;= 20 ? "distribution" : "usable",
    n,
    median: stats.median,
    ...band,
    twoMarkets: stats.p75 / stats.median &gt;= TWO_MARKETS,
  };
}

let result;
for (const days of WINDOWS) {
  result = { days, ...verdict(await statsFor(days)) };
  if (result.n &gt;= ENOUGH) break;
}

const usd = (x) =&gt; `$${x.toFixed(2)}`;
const { kind, days, n } = result;
if (kind === "none") {
  console.log(`Not a price: ${n} clean sales in ${days} days. Step to a comparable item.`);
} else if (kind === "direction") {
  console.log(`A direction, not a figure: ${usd(result.p25)} to ${usd(result.p75)} from ${n} sales in ${days} days.`);
} else {
  console.log(`Median ${usd(result.median)}, band ${usd(result.p25)} to ${usd(result.p75)}, from ${n} sales in ${days} days.`);
  if (result.twoMarkets) console.log("Warning: the upper quartile is far above the median. Look for two markets mixed together.");
}
</code></pre>
<p>Run it with an item name:</p>
<pre><code class="language-bash">node thin.mjs "panzer dragoon saga saturn"
</code></pre>
<h2>What each part does</h2>
<ul>
<li><code>/v1/comps</code> returns summary statistics for a search. The function reads <code>stats.used_for_stats</code> (the number of sales behind the numbers), <code>median</code>, <code>p25</code> and <code>p75</code>.</li>
<li><code>days</code> is the lookback. Every plan, including the free one, reads up to 1,095 days.</li>
<li><code>exclude=ai_junk</code> leaves out sales that an AI model labels as lots, parts, accessories, empty boxes and the like, so the count reflects the item, not the pile of add-ons around it.</li>
<li><strong>The loop</strong> tries 90, 365 and 1,095 days and stops at the first window with at least 8 clean sales. It never changes the query.</li>
<li><code>twoMarkets</code> is my own rule, not something the API reports: when the 75th percentile is three or more times the median, the function says so. It is a prompt to look at the cheap rows, not a verdict.</li>
</ul>
<h2>Why the spread check exists</h2>
<p>In a ten-item estate lot priced from completed sales, a Singer Featherweight sewing machine had a median of $39.99 but a 75th percentile of $237.50. The cheap end was a record book, a bobbin and an instruction manual, all titled with the machine's name. Every automatic check passed, because the search returned 152 sales. A count alone cannot catch that. A spread ratio can at least point at it.</p>
<h2>What it costs</h2>
<p>At most 3 requests per item, because the loop stops as soon as a window has enough sales. On the free plan (100 requests a month, 10 a minute) that is at least 33 items a month.</p>
<h2>Limits to know about</h2>
<ul>
<li><strong>The thresholds are rules of thumb.</strong> 8 and 20 come from a published rule of thumb, and the 3x spread ratio is mine. Tune them for your own category.</li>
<li><strong>A match is not a model.</strong> The AI filter removes things that are not a single normal item. It does not check that what is left is the exact model you searched for, and on eBay it agreed with CompsAPI's own labels on about 92% of 690 test listings.</li>
<li><strong>Gross prices only.</strong> These are sold prices before fees and shipping.</li>
<li><strong>Accepted offers:</strong> prices on accepted Best Offer sales are the amount actually paid, not the asking price that eBay's public page shows.</li>
<li><strong>I have not run this script.</strong> It follows the documented parameters and response fields, but it has not been run against a live key or a test server. Treat it as a starting point and check it on an item you know first.</li>
</ul>
<p>CompsAPI is not affiliated with eBay.</p>
<h2>Get a key</h2>
<p>A free key is enough to try this on a few items you know well: <a href="https://compsapi.com/?utm_source=hashnode&amp;utm_medium=article&amp;utm_campaign=thin-market-pricing">get one here</a>. If it returns something that looks wrong, tell us in the comments and we'll look.</p>
]]></content:encoded></item><item><title><![CDATA[Build a 2-year eBay price history in Node.js, one window per month]]></title><description><![CDATA[A short Node.js script that pulls two years of eBay sold prices with one date window per month and prints the median and sales count for each.]]></description><link>https://compsapi.hashnode.dev/build-a-2-year-ebay-price-history-in-node-js-one-window-per-month</link><guid isPermaLink="true">https://compsapi.hashnode.dev/build-a-2-year-ebay-price-history-in-node-js-one-window-per-month</guid><category><![CDATA[Node.js]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[api]]></category><category><![CDATA[data analysis]]></category><category><![CDATA[Developer Tools]]></category><dc:creator><![CDATA[Sam Smith]]></dc:creator><pubDate>Thu, 19 Nov 2026 20:22:13 GMT</pubDate><content:encoded><![CDATA[<p><em>Disclosure: we build CompsAPI, the sold-price API used in this tutorial. It was drafted with AI assistance, and the parameters were checked against CompsAPI's documentation. A free key needs no card.</em></p>
<p>eBay's public sold page shows roughly the last 90 days. That is enough to answer what something is worth this week, and not enough to see a depreciation curve, a seasonal pattern or what a product launch did to a price.</p>
<p>This post builds a small Node.js script that pulls two years of eBay sold prices for any search, one calendar month at a time, and prints the median for each month with the number of sales behind it.</p>
<h2>What you need</h2>
<ul>
<li>Node 18 or newer (the script uses the built-in <code>fetch</code>, so there is nothing to install)</li>
<li>A free CompsAPI key (100 requests a month, no card), saved as an environment variable:</li>
</ul>
<pre><code class="language-bash">export COMPSAPI_KEY="your-key-here"
</code></pre>
<h2>The approach: one date window per month</h2>
<p>CompsAPI's <code>/v1/sold</code> endpoint reads up to 1,095 days of history, and returns up to 240 sales per request. You could page through a long search, but the docs say plainly that several short windows are faster and far more reliable than one deep page walk. So the script asks for one month at a time using <code>start</code> and <code>end</code>, both written <code>YYYY-MM-DD</code> and both inclusive.</p>
<p>Each monthly request also passes <code>exclude=ai_junk</code>, which leaves out sales an AI model labels as lots, parts, accessories, empty boxes and the like, so the monthly median describes the item and not the pile of add-ons around it. Prices on accepted Best Offer sales are the amount actually paid, not the asking price shown on eBay's public page.</p>
<h2>The script</h2>
<p>Save this as <code>history.mjs</code>:</p>
<pre><code class="language-js">// history.mjs: median sold price per month for one eBay search
const KEY = process.env.COMPSAPI_KEY;
const QUERY = process.argv.slice(2).join(" ");
const MONTHS = 24; // keep this at 35 or less: history reaches back 1,095 days
const PAUSE_MS = 6500; // free keys allow 10 requests a minute; paid plans can use 0

if (!QUERY) {
  console.error('usage: node history.mjs "item name"');
  process.exit(1);
}

const sleep = (ms) =&gt; new Promise((resolve) =&gt; setTimeout(resolve, ms));
const iso = (d) =&gt; d.toISOString().slice(0, 10);

function median(values) {
  const s = [...values].sort((a, b) =&gt; a - b);
  const mid = Math.floor(s.length / 2);
  return s.length % 2 ? s[mid] : (s[mid - 1] + s[mid]) / 2;
}

async function pricesBetween(start, end) {
  const url = new URL("https://api.compsapi.com/v1/sold");
  url.search = new URLSearchParams({
    q: QUERY,
    start: iso(start),
    end: iso(end),
    exclude: "ai_junk",
  });
  const res = await fetch(url, { headers: { "X-API-Key": KEY } });
  if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
  const data = await res.json();
  return (data.items ?? []).map((row) =&gt; row.price);
}

const now = new Date();
const rows = [];
for (let i = MONTHS - 1; i &gt;= 0; i--) {
  const start = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() - i, 1));
  const end = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() - i + 1, 0));
  const prices = await pricesBetween(start, end);
  rows.push({
    month: iso(start).slice(0, 7),
    n: prices.length,
    med: prices.length ? median(prices) : null,
  });
  if (i &gt; 0) await sleep(PAUSE_MS);
}

const top = Math.max(...rows.map((r) =&gt; r.med ?? 0));
for (const r of rows) {
  const bar = r.med ? "#".repeat(Math.max(1, Math.round((r.med / top) * 30))) : "";
  const price = r.med ? r.med.toFixed(2).padStart(10) : "  no sales";
  console.log(`${r.month} ${price}  n=${String(r.n).padStart(3)}  ${bar}`);
}
</code></pre>
<p>Run it with an item name:</p>
<pre><code class="language-bash">node history.mjs "nintendo switch oled"
</code></pre>
<p>You get one line per month: the month, the median sold price, the number of sales behind it, and a bar so the shape of the curve is visible at a glance.</p>
<h2>How to read the output</h2>
<ol>
<li><strong>Look at</strong> <code>n</code> <strong>before you look at the price.</strong> A month with 3 sales is a direction, not a figure. Ignore the bar for months with very few sales.</li>
<li><strong>If</strong> <code>n</code> <strong>reaches 240, that month is capped.</strong> One request returns at most 240 sales, so for a busy item the median is built from a slice of the month. Narrow the windows to weeks for items that sell in volume.</li>
<li><strong>Compare the same month across years.</strong> That is what the history is for. A December that is higher than the surrounding months in both years is a seasonal pattern. One high December is a coincidence.</li>
<li><strong>A price that steps down and stays down is a depreciation curve.</strong> A one-month dip that recovers is noise.</li>
</ol>
<h2>What it costs</h2>
<p>The script makes one request per month, so 24 months is 24 requests per item. On the free plan (100 requests a month) that is four items a month. The free plan also allows 10 requests a minute, which is why the script waits 6.5 seconds between calls. On a paid plan you can set <code>PAUSE_MS</code> to 0.</p>
<h2>Limits to know about</h2>
<ul>
<li><strong>Cap per window:</strong> up to 240 sales per request, as above.</li>
<li><strong>Depth:</strong> history reaches back 1,095 days (about 35 months), so <code>MONTHS</code> should not go above 35.</li>
<li><strong>The filter is not perfect.</strong> On eBay, the AI filter agreed with CompsAPI's own labels on about 92% of the 690 listings in its test. It sometimes removes a console sold with its dock and controller as a bundle, and it does not detect counterfeits. For anything where a few percent of error matters, change <code>exclude=ai_junk</code> to <code>ai=1</code> and read the labels yourself.</li>
<li><strong>Other marketplaces:</strong> add a <code>source=</code> parameter to read a marketplace beyond eBay. Their histories start on different dates, so check a marketplace's start date before asking for 24 months.</li>
<li><strong>I have not run this script against a live key.</strong> I did run its date windows and median logic against a fake local server, which behaved as expected, but the real response may differ. The script follows the documented parameters and assumes the sold rows come back under <code>items</code>. If it prints nothing, check the shape of the response first.</li>
</ul>
<p>CompsAPI is not affiliated with eBay.</p>
<h2>Get a key</h2>
<p>A free key is enough to run this on a few items you know well: <a href="https://compsapi.com/?utm_source=hashnode&amp;utm_medium=article&amp;utm_campaign=price-history-node">get one here</a>. If a month looks wrong for an item you know, tell us in the comments and we'll look.</p>
]]></content:encoded></item><item><title><![CDATA[Give Claude and Cursor real eBay sold prices with one MCP config]]></title><description><![CDATA[Connect a hosted MCP server to Claude Code or Cursor and ask for real eBay sold prices, including accepted Best Offer amounts, in plain language.]]></description><link>https://compsapi.hashnode.dev/give-claude-and-cursor-real-ebay-sold-prices-with-one-mcp-config</link><guid isPermaLink="true">https://compsapi.hashnode.dev/give-claude-and-cursor-real-ebay-sold-prices-with-one-mcp-config</guid><category><![CDATA[mcp]]></category><category><![CDATA[claude]]></category><category><![CDATA[AI]]></category><category><![CDATA[api]]></category><category><![CDATA[ebay]]></category><category><![CDATA[cursor]]></category><category><![CDATA[Developer Tools]]></category><category><![CDATA[ecommerce]]></category><dc:creator><![CDATA[Sam Smith]]></dc:creator><pubDate>Thu, 19 Nov 2026 13:05:34 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6aca7c35bfea90f6b77c3372/19f3476f-3621-46f6-9364-2b2d369baa14.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Disclosure: we build CompsAPI, the sold-price API used in this tutorial. The setup below uses its hosted MCP server and a free key.</em></p>
<p>Ask an AI assistant what something sold for on eBay and it will usually answer from memory, or read the public sold page. Both have problems. Memory is stale. The public page has about 90 days of history, and on Best Offer sales it shows the asking price crossed out instead of the amount the buyer paid.</p>
<p>An MCP server fixes this by giving the assistant a tool it can call for live data. This tutorial connects one in a few minutes.</p>
<h2>What you need</h2>
<ul>
<li>An MCP client that supports remote servers with custom headers. Claude Code and Cursor both do.</li>
<li>A free CompsAPI key (100 requests a month, no card).</li>
</ul>
<p>Save the key as an environment variable rather than pasting it into a chat:</p>
<pre><code class="language-bash">export COMPSAPI_KEY="your-key-here"
</code></pre>
<h2>Connect it</h2>
<p><strong>Cursor</strong> (or any client that reads an <code>mcpServers</code> JSON file). Add this to your MCP config:</p>
<pre><code class="language-json">{
  "mcpServers": {
    "compsapi": {
      "url": "https://api.compsapi.com/mcp",
      "headers": { "Authorization": "Bearer YOUR_KEY" }
    }
  }
}
</code></pre>
<p><strong>Claude Code:</strong></p>
<pre><code class="language-bash">claude mcp add --transport http compsapi https://api.compsapi.com/mcp \
  --header "Authorization: Bearer $COMPSAPI_KEY"
</code></pre>
<p>Nothing is installed locally, because the server is hosted. Restart the client, and the tools should show up in its MCP list.</p>
<h2>What the server exposes</h2>
<p>Two tools cover most uses:</p>
<ul>
<li><code>search_sold_listings</code> returns what things actually sold for.</li>
<li><code>search_live_listings</code> returns what is listed for sale right now.</li>
</ul>
<p>The server also exposes marketplace and trading-card tools (<code>search_marketplace_sold</code>, <code>search_marketplace_live</code>, <code>card_lookup</code>, <code>card_population</code>). Each tool call counts as one request against your monthly quota, the same as a REST call.</p>
<h2>Prompts worth trying</h2>
<p>Once connected, ask in plain language:</p>
<ol>
<li><em>"What did a PSA 10 Base Set Charizard sell for over the last year? Give me the median and the spread, not a single sale."</em></li>
<li><em>"Compare sold prices and current asking prices for a Fender American Standard Stratocaster."</em></li>
<li><em>"Look at three years of sold history for a Rolex Submariner and tell me whether there is seasonality."</em></li>
<li><em>"Here are 10 items I'm thinking of buying. Table the median sold price for each."</em></li>
</ol>
<p>The fourth one shows why this is more than a lookup. The assistant makes one call per row and does the table and the arithmetic itself.</p>
<h2>Why the data under it matters</h2>
<p>An assistant is only as good as its source. Three things differ from scraping the public page:</p>
<ul>
<li><strong>Accepted Best Offer prices.</strong> When a listing sells through an accepted offer, eBay's public page shows the asking price crossed out. CompsAPI returns the amount paid. Across 5,859 matched sales, the public page read high on 99.0% of them, with a median overstatement of 14.9%.</li>
<li><strong>History.</strong> Up to 1,095 days per search, on the free plan too.</li>
<li><strong>Volume per call.</strong> Up to 240 sales per request.</li>
</ul>
<h2>Limits to know about</h2>
<ul>
<li>The free tier is 100 requests a month and 10 requests a minute. An assistant that explores freely can use that quickly, so tell it to check before it loops.</li>
<li>Do not paste your key into a chat window. Keep it in a config file or environment variable, because pasted text can end up in provider logs.</li>
<li>A median is only as clean as the search. Broad searches on popular items pull in accessories, parts and lots, so check the cheapest and most expensive rows before trusting a number.</li>
<li>CompsAPI is not affiliated with eBay.</li>
</ul>
<h2>Get a key</h2>
<p>A free key covers every example above: <a href="https://compsapi.com/?utm_source=hashnode&amp;utm_medium=article&amp;utm_campaign=mcp-tutorial">get one here</a>. If a prompt returns something that looks wrong, send it to us and we'll look.</p>
]]></content:encoded></item></channel></rss>