Skip to main content
Glama

Indian Stock Exchange MCP Server

by nikhilcherry
test-direct.jsโ€ข2.01 kB
// Simple API test without MCP server initialization import * as dotenv from "dotenv"; dotenv.config(); const BASE_URL = "https://stock.indianapi.in"; const API_KEY = process.env.ISE_API_KEY; console.log("=".repeat(60)); console.log("๐Ÿงช Direct API Test (No MCP Server)"); console.log("=".repeat(60)); console.log(`API Key: ${API_KEY ? API_KEY.substring(0, 20) + "..." : "โŒ NOT FOUND"}`); console.log(`Base URL: ${BASE_URL}`); console.log("=".repeat(60)); async function testEndpoints() { const endpoints = [ { name: "News", url: `${BASE_URL}/news` }, { name: "Top Gainers", url: `${BASE_URL}/stock/gainers` }, { name: "Top Losers", url: `${BASE_URL}/stock/losers` }, { name: "Stock Price (Reliance)", url: `${BASE_URL}/stock/price?name=Reliance` }, ]; for (const endpoint of endpoints) { console.log(`\n๐Ÿ“ก Testing: ${endpoint.name}`); console.log(`URL: ${endpoint.url}`); try { const response = await fetch(endpoint.url, { headers: { "x-api-key": API_KEY || "", }, }); console.log(`Status: ${response.status} ${response.statusText}`); if (response.ok) { const data = await response.json(); const dataStr = JSON.stringify(data, null, 2); console.log(`โœ… Success! Response length: ${dataStr.length} bytes`); console.log(`Preview:`, dataStr.substring(0, 300) + "..."); } else { const errorText = await response.text(); console.log(`โŒ Error Response:`, errorText.substring(0, 300)); } } catch (err) { console.log(`โŒ Request Failed:`, err.message); } console.log("-".repeat(60)); } } testEndpoints().then(() => { console.log("\nโœ… All tests complete!"); process.exit(0); }).catch(err => { console.error("โŒ Test failed:", err); process.exit(1); });

Latest Blog Posts

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/nikhilcherry/Indian-stock-MCP'

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