Skip to content

fix(indexer): stop shipping the retired /api/v1 base URL - #48

Merged
adacapo21 merged 3 commits into
mainfrom
fix/setup-wizard-indexer-url
Aug 21, 2026
Merged

fix(indexer): stop shipping the retired /api/v1 base URL#48
adacapo21 merged 3 commits into
mainfrom
fix/setup-wizard-indexer-url

Conversation

@adacapo21

Copy link
Copy Markdown
Member

Every read tool in a wizard-configured install fails with a bare 404 — TVL, protocol stats, assets and ADA price alike. It reads like an outage; it is a stale URL.

What is wrong

v3 moved the analytics indexer from /api/v1 to /api, but three places still hand out the old base:

  • src/cli/setup.ts (both config branches) — writes it into the user's MCP client config, where it persists and overrides the correct runtime default
  • .env.example
  • fly.toml — so the hosted deployment 404s identically

Reproduced against the published package: INDEXER_URL=.../api/v1 404s on every endpoint, .../api resolves.

The trap for anyone who tries to fix it themselves

The obvious correction is /api/v3, and it half-works, which is worse:

/api/v1  ->  every route 404s
/api/v3  ->  /api/v3/v3/analytics/tvl  404   (get_tvl adds its own /v3)
             /api/v3/assets            200   (get_assets does not)

Tool paths carry their own version where the v3 indexer needs one and omit it elsewhere, so the base has to stop at /api. A versioned base breaks one half of the read tools and leaves the other half working — which points the investigation at the API rather than at the config.

So beyond correcting the three files, normalizeIndexerUrl() now strips a trailing version segment from a configured base and says so once on stderr:

Indigo MCP: INDEXER_URL ".../api/v1" ends in an API version; using ".../api".
Tool paths carry their own version — set the base URL without one.

That matters because the bad value is already sitting in users' config files: correcting the wizard does nothing for someone who ran it last month. With the guard, those installs recover on the next upgrade without anyone having to work out which half of their tools is lying.

Verified against the live indexer

INDEXER_URL before after
.../api/v1 (what the wizard wrote) every route 404 get_tvlget_ada_price
.../api/v3 (the natural "fix") TVL and stats 404, assets fine get_tvlget_ada_price
unset

7 new tests cover the normalisation, including a base URL whose path legitimately contains a version segment that must not be stripped. Suite 115 passing; typecheck, lint, format and build clean.

Independent of #47 — no overlapping files — and worth merging first, since it is the failure everyone hits before they get anywhere near Pyth.

Note for whoever cuts the next release: npm still serves 0.3.0 from 10 June, which predates the read tools moving onto /api/v3, so npx installs are broken regardless of this fix until a new version ships.

The setup wizard writes INDEXER_URL into the user's MCP client config, and
it still wrote the v1 analytics base. v3 moved the indexer from /api/v1 to
/api, so every read tool in a wizard-configured install fails with a bare
404 — TVL, protocol stats, assets and ADA price alike, which reads like an
outage rather than a config problem.

The runtime default in indexer-client.ts and the README were already
correct; the wizard was overriding the good default with a dead one. fly.toml
set the same stale base, so the hosted deployment 404s identically.

Reproduced with the published package: INDEXER_URL=.../api/v1 gives 404 on
every endpoint, .../api resolves.
Tool paths carry their own API version where the v3 indexer needs one
(/v3/analytics/tvl) while others are unversioned (/assets), so the base URL
has to stop at /api. Get that wrong and roughly half the read tools break
while the rest keep working, which looks like a partial outage:

  /api/v1 -> every route 404s (v1 is retired, and older setup wizards wrote
             this value into MCP client configs, where it persists)
  /api/v3 -> /api/v3/v3/analytics/tvl 404s while /api/v3/assets resolves

Both are now normalised back to /api with a one-line note on stderr, so
existing broken configs recover without the user having to work out which
half of their tools is lying to them.

Verified against the live indexer: get_tvl and get_ada_price return data
under /api/v1, /api/v3 and no override at all.
Same retired /api/v1 base as the setup wizard wrote; anyone copying
.env.example gets read tools that 404 on every route.
@adacapo21
adacapo21 merged commit a5e33c7 into main Aug 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant