fix: use production API URL for tool search in Vercel deployments

- Change default TPMJS_API_URL to https://tpmjs.com in production
- Keep localhost:3000 for local development
- Fixes "ECONNREFUSED 127.0.0.1:3000" error in Vercel
- Allows playground to search tools from production registry

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ajax Davis 2025-12-04 13:34:29 +10:00
parent 9e863fe181
commit 08d1e5a717

View file

@ -64,8 +64,10 @@ export const searchTpmjsToolsTool = tool({
...(category && { category }),
});
// Use environment variable or default to localhost for development
const baseUrl = process.env.TPMJS_API_URL || 'http://localhost:3000';
// Use environment variable, or default to production API (falls back to localhost in dev)
const baseUrl =
process.env.TPMJS_API_URL ||
(process.env.NODE_ENV === 'production' ? 'https://tpmjs.com' : 'http://localhost:3000');
const url = `${baseUrl}/api/tools/search?${params}`;
console.log(`🌐 Fetching: ${url}`);