Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

test(pump-mcp): assert an exhausted RPC chain reports upstream data, not internal

nirholas23771ffbaac2
diff --git a/tests/workers/pump-fun-mcp-worker.test.js b/tests/workers/pump-fun-mcp-worker.test.js
index 980ada74b..0b7fe25a4 100644
--- a/tests/workers/pump-fun-mcp-worker.test.js
+++ b/tests/workers/pump-fun-mcp-worker.test.js
@@ -18,6 +18,15 @@ const PROTOCOL_VERSION = '2025-06-18';
// indexer-configured branch is exercised without an upstream or a mock.
const DEAD_INDEXER = { PUMPFUN_BOT_URL: 'http://127.0.0.1:1' };
+// Two unreachable RPCs. Because the worker only falls back to the public
+// endpoint when NOTHING is configured, this pins the whole chain to closed local
+// ports: the failover runs for real and exhausts without leaving the machine.
+const DEAD_RPC_CHAIN = {
+ SOLANA_RPC_URL: 'http://127.0.0.1:1',
+ SOLANA_RPC_FALLBACKS: 'http://127.0.0.1:2',
+};
+const REAL_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';
+
const ON_CHAIN_TOOLS = ['get_bonding_curve', 'get_token_details', 'get_token_holders'];
const INDEXER_TOOLS = [
'search_tokens',
@@ -217,6 +226,16 @@ describe('pump-fun-mcp worker: tools/call', () => {
}
});
+ it('exhausts the RPC failover chain and reports -32004, never an internal error', async () => {
+ // Every configured endpoint is refused, so each tool must surface the
+ // upstream-data code its siblings use instead of leaking a -32603.
+ for (const name of ON_CHAIN_TOOLS) {
+ const json = await callTool(name, { mint: REAL_MINT }, DEAD_RPC_CHAIN);
+ expect(json.error.code, name).toBe(-32004);
+ expect(json.error.message, name).toMatch(/unavailable/);
+ }
+ });
+
it('rejects an unknown tool name', async () => {
const json = await callTool('definitely_not_a_tool');
expect(json.error.code).toBe(-32601);