const fetch = require('node-fetch');
const https = require('https');
// Disable SSL verification for local testing
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
const serverUrl = 'https://localhost:3003';
// This requires you to have authenticated with the OAuth flow first
// Use the bearer token from a successful OAuth session
async function showRecommendations() {
console.log('\n🚀 Fetching Recommendations from MCP Server\n');
console.log('=' .repeat(70));
// You need to get a bearer token first by running the OAuth test
console.log('ℹ️ Note: This requires a valid OAuth bearer token.');
console.log(' Run the OAuth test first (localhost-oauth-test-recommendations-v2.js)');
console.log(' to authenticate and get a valid session.\n');
// Example request with userQuery for Bank Leumi
const testRequest = {
jsonrpc: '2.0',
method: 'tools/call',
params: {
name: 'get_all_recommendations',
arguments: {
userQuery: 'show me recommendations for Bank Leumi BL Test Env',
daysBack: 30,
pageSize: 10,
includeClosedAndDone: false
}
},
id: 1
};
console.log('📤 Request with Bank Leumi query:');
console.log(JSON.stringify(testRequest.params.arguments, null, 2));
console.log('\n💡 Expected behavior:');
console.log(' - Customer detection: Bank Leumi BL Test Env (account 24223)');
console.log(' - API key format: 57ade50e-c9a8-49f3-8ce7-28d44536a669:24223:1');
console.log(' - Returns recommendations for Bank Leumi account\n');
console.log('To run a test with a valid token, you would make a request like:');
console.log(`
const response = await fetch('${serverUrl}/mcp', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TOKEN_HERE',
'Content-Type': 'application/json',
'Accept': 'application/json, text/event-stream'
},
body: JSON.stringify(testRequest),
agent: new https.Agent({
rejectUnauthorized: false
})
});
`);
}
showRecommendations();