Skip to main content
Glama
Long0308

VN Stock API MCP Server

by Long0308

get_stock_price_fireant

Retrieve current stock prices for Vietnam market symbols using FireAnt data sources. Provide stock symbols like VIC or VNM to get real-time pricing information.

Instructions

Get real-time stock price from FireAnt. Uses FireAnt API or web scraping to retrieve current stock prices for Vietnam stock market symbols (e.g., VIC, VNM, VCB).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesStock symbol (e.g., 'VIC', 'VNM', 'VCB'). Use comma-separated for multiple symbols.

Implementation Reference

  • The main handler function that implements the tool logic: fetches real-time stock prices from FireAnt API endpoints (primary: https://restv2.fireant.vn/stocks/{sym}/quotes, fallback: /symbols/{sym}/intraday), handles multiple symbols, errors, and provides fallback notes.
    private async getStockPriceFireAnt(args: { symbol: string }) { const { symbol } = args; const symbols = symbol.split(",").map((s) => s.trim().toUpperCase()); try { // Try FireAnt API first const results: any[] = []; for (const sym of symbols) { try { // FireAnt API endpoint for stock quotes const apiUrl = `https://restv2.fireant.vn/stocks/${sym}/quotes`; const response = await fetch(apiUrl, { headers: { "User-Agent": "Mozilla/5.0", "Accept": "application/json", }, }); if (response.ok) { const data = await response.json(); results.push({ symbol: sym, source: "FireAnt API", data: data, timestamp: new Date().toISOString(), }); } else { // Fallback: Try alternative endpoint const altUrl = `https://restv2.fireant.vn/symbols/${sym}/intraday`; const altResponse = await fetch(altUrl, { headers: { "User-Agent": "Mozilla/5.0", "Accept": "application/json", }, }); if (altResponse.ok) { const altData = await altResponse.json(); results.push({ symbol: sym, source: "FireAnt API (alternative)", data: altData, timestamp: new Date().toISOString(), }); } else { // If API fails, provide information about how to access results.push({ symbol: sym, source: "FireAnt", status: "API endpoint may require authentication", note: "FireAnt API may require API key or authentication. Please check FireAnt API documentation or use Firecrawl to scrape from https://www.fireant.vn", documentationUrl: "https://api.fireant.vn/", webUrl: `https://www.fireant.vn/symbol/${sym}`, }); } } } catch (error) { results.push({ symbol: sym, error: error instanceof Error ? error.message : String(error), note: "Unable to fetch from API. Consider using Firecrawl MCP to scrape from FireAnt website.", webUrl: `https://www.fireant.vn/symbol/${sym}`, }); } } return { content: [ { type: "text", text: JSON.stringify( { provider: "FireAnt", symbols: symbols, results: results, note: results.some((r) => r.note) && "Some data may require authentication. Consider using Firecrawl MCP server to scrape real-time data from FireAnt website.", }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: error instanceof Error ? error.message : String(error), note: "Unable to fetch stock prices. You may need to use Firecrawl MCP to scrape data from FireAnt website at https://www.fireant.vn", }, null, 2 ), }, ], isError: true, }; } }
  • src/index.ts:121-134 (registration)
    Tool registration in the tools list, including name, description, and input schema. This list is returned by ListToolsRequestSchema handler.
    name: "get_stock_price_fireant", description: "Get real-time stock price from FireAnt. Uses FireAnt API or web scraping to retrieve current stock prices for Vietnam stock market symbols (e.g., VIC, VNM, VCB).", inputSchema: { type: "object", properties: { symbol: { type: "string", description: "Stock symbol (e.g., 'VIC', 'VNM', 'VCB'). Use comma-separated for multiple symbols.", }, }, required: ["symbol"], }, },
  • Dispatch case in CallToolRequestSchema handler that routes to the getStockPriceFireAnt implementation.
    case "get_stock_price_fireant": return await this.getStockPriceFireAnt(args as any);

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/Long0308/vn-stock-api-mcp'

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