Skip to main content
Glama

LoadRunner Cloud MCP Server

by pbandreddy
auth-get-token.js1.48 kB
/** * Function to get an auth token from LoadRunner Cloud. * * @returns {Promise<string|Object>} - The access token or an error message object. */ const getAuthToken = async () => { const baseUrl = process.env.LRC_BASE_URL; const tenantId = process.env.LRC_TENANT_ID; const clientId = process.env.LRC_CLIENT_ID; const clientSecret = process.env.LRC_CLIENT_SECRET; try { const url = new URL(`${baseUrl}/auth-client`); url.searchParams.append('TENANTID', tenantId); const headers = { 'Content-Type': 'application/json', 'accept': 'application/json' }; const body = JSON.stringify({ client_id: clientId, client_secret: clientSecret }); const response = await fetch(url.toString(), { method: 'POST', headers, body }); if (!response.ok) { const text = await response.text(); try { const errorData = JSON.parse(text); throw new Error(JSON.stringify(errorData)); } catch (jsonErr) { // Not JSON, log the raw text console.error('Non-JSON error response:', text); throw new Error(text); } } const data = await response.json(); // Adjust according to actual API response structure return data.access_token || data.token || data; } catch (error) { console.error('Error retrieving auth token:', error); return { error: 'An error occurred while retrieving auth token.' }; } }; export { getAuthToken };

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pbandreddy/loadrunner-cloud-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server