fix(indexer): stop shipping the retired /api/v1 base URL - #48
Merged
Conversation
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.
This was referenced Aug 21, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/v1to/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.examplefly.toml— so the hosted deployment 404s identicallyReproduced against the published package:
INDEXER_URL=.../api/v1404s on every endpoint,.../apiresolves.The trap for anyone who tries to fix it themselves
The obvious correction is
/api/v3, and it half-works, which is worse: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: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.../api/v1(what the wizard wrote)get_tvl✓get_ada_price✓.../api/v3(the natural "fix")get_tvl✓get_ada_price✓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, sonpxinstalls are broken regardless of this fix until a new version ships.