Skip to main content
Glama

Indian Stock Exchange MCP Server

by nikhilcherry
test-mcp.jsโ€ข1.75 kB
// Direct test of the MCP server functionality import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import * as dotenv from "dotenv"; dotenv.config(); const BASE_URL = "https://stock.indianapi.in"; const API_KEY = process.env.ISE_API_KEY; console.error("=".repeat(60)); console.error("๐Ÿงช MCP Server Test"); console.error("=".repeat(60)); console.error(`API Key: ${API_KEY ? API_KEY.substring(0, 20) + "..." : "โŒ NOT FOUND"}`); console.error(`Base URL: ${BASE_URL}`); console.error("=".repeat(60)); async function testMakeRequest() { console.error("\n๐Ÿ“ก Testing makeRequest function...\n"); const testUrl = `${BASE_URL}/news`; console.error(`Fetching: ${testUrl}`); try { const response = await fetch(testUrl, { headers: { "x-api-key": API_KEY || "", }, }); console.error(`Status: ${response.status} ${response.statusText}`); if (response.ok) { const data = await response.json(); console.error(`โœ… Success! Received ${JSON.stringify(data).length} bytes`); console.error(`First item:`, JSON.stringify(data[0] || data, null, 2).substring(0, 200)); return data; } else { const errorText = await response.text(); console.error(`โŒ Error:`, errorText); return null; } } catch (err) { console.error(`โŒ Request Failed:`, err.message); return null; } } testMakeRequest().then(() => { console.error("\n" + "=".repeat(60)); console.error("โœ… Test Complete"); console.error("=".repeat(60)); process.exit(0); });

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