Skip to main content
Glama
VN Stock API MCP Server

VN Stock API MCP Server

by Long0308

VN Stock API MCP Server

MCP server để tìm kiếm và truy cập API từ các công ty chứng khoán Việt Nam: VNDirect, FireAnt, và SSI.

Tính năng

  • Tìm kiếm API documentation từ VNDirect, FireAnt, và SSI

  • Lấy thông tin về API endpoints

  • Truy cập documentation URLs

  • Lấy giá cổ phiếu real-time từ FireAnt (get_stock_price_fireant)

  • Liệt kê tất cả mã cổ phiếu Việt Nam (list_vn_stocks) - tương tự list_assets trong coincap-mcp

  • Lấy tin tức thị trường chứng khoán từ CafeF (get_cafef_market_news) - sử dụng Firecrawl API để scrape tin tức

  • Phân tích mô hình nến Doji (analyze_doji_pattern) - phân tích kỹ thuật để phát hiện tín hiệu đảo chiều

Related MCP server: VNStock MCP Server

Cài đặt

Cách 1: Clone từ GitHub (Khuyến nghị)

# Clone repository
git clone https://github.com/Long0308/vn-stock-api-mcp.git
cd vn-stock-api-mcp

# Cài đặt dependencies và build
npm install
npm run build

Cách 2: Sử dụng trực tiếp từ GitHub (đã có sẵn dist/)

Nếu bạn chỉ muốn sử dụng mà không cần phát triển, bạn có thể clone và sử dụng trực tiếp:

# Clone repository
git clone https://github.com/Long0308/vn-stock-api-mcp.git
cd vn-stock-api-mcp

# Chỉ cần cài đặt dependencies (dist/ đã có sẵn)
npm install

Cấu hình trong mcp.json

Cấu hình với đường dẫn local (sau khi clone)

Cấu hình cơ bản (không có Firecrawl API):

{
  "mcpServers": {
    "vn-stock-api-mcp": {
      "command": "node",
      "args": [
        "C:\\path\\to\\vn-stock-api-mcp\\dist\\index.js"
      ]
    }
  }
}

Cấu hình đầy đủ (có Firecrawl API để sử dụng tính năng get_cafef_market_news):

{
  "mcpServers": {
    "vn-stock-api-mcp": {
      "command": "node",
      "args": [
        "C:\\path\\to\\vn-stock-api-mcp\\dist\\index.js"
      ],
      "env": {
        "FIRECRAWL_API_KEY": "your-firecrawl-api-key-here"
      }
    }
  }
}

Cấu hình với đường dẫn tương đối

{
  "mcpServers": {
    "vn-stock-api-mcp": {
      "command": "node",
      "args": [
        "~/vn-stock-api-mcp/dist/index.js"
      ],
      "env": {
        "FIRECRAWL_API_KEY": "your-firecrawl-api-key-here"
      }
    }
  }
}

Lưu ý:

  • Thay C:\\path\\to\\vn-stock-api-mcp hoặc ~/vn-stock-api-mcp bằng đường dẫn thực tế đến thư mục bạn đã clone.

  • Thay "your-firecrawl-api-key-here" bằng API key thực tế của bạn từ firecrawl.dev (chỉ cần nếu muốn sử dụng tính năng get_cafef_market_news).

  • Nếu không có Firecrawl API key, các tool khác vẫn hoạt động bình thường, chỉ có get_cafef_market_news sẽ sử dụng phương pháp fallback.

Tools có sẵn

1. search_vn_stock_api

Tìm kiếm API documentation từ các nhà cung cấp.

Parameters:

  • provider: "vndirect" | "fireant" | "ssi" | "all"

  • query (optional): Từ khóa tìm kiếm

2. get_api_endpoints

Lấy danh sách API endpoints cho một nhà cung cấp.

Parameters:

  • provider: "vndirect" | "fireant" | "ssi"

  • category (optional): Lọc theo category

3. get_api_documentation_urls

Lấy URLs của API documentation.

Parameters:

  • provider: "vndirect" | "fireant" | "ssi" | "all"

4. get_stock_price_fireant

Lấy giá cổ phiếu real-time từ FireAnt API. Hỗ trợ lấy giá cho một hoặc nhiều mã cổ phiếu cùng lúc.

Parameters:

  • symbol: Mã cổ phiếu (ví dụ: "VIC", "VNM", "VCB"). Có thể truyền nhiều mã cách nhau bằng dấu phẩy (ví dụ: "VIC,VNM,VCB")

Ví dụ sử dụng:

{
  "symbol": "VIC"
}

hoặc nhiều mã:

{
  "symbol": "VIC,VNM,VCB"
}

Lưu ý:

  • FireAnt API có thể yêu cầu authentication. Nếu API không hoạt động, tool sẽ cung cấp URL web để truy cập thông tin trên FireAnt website.

  • Để lấy dữ liệu real-time tốt hơn, có thể sử dụng kết hợp với Firecrawl MCP server để scrape từ website FireAnt.

5. list_vn_stocks

Liệt kê tất cả các mã cổ phiếu Việt Nam có sẵn. Tương tự như list_assets trong coincap-mcp, tool này trả về danh sách đầy đủ các mã cổ phiếu được giao dịch trên các sàn chứng khoán Việt Nam (HOSE, HNX, UPCOM).

Parameters:

  • exchange (optional): Lọc theo sàn giao dịch - "HOSE" (Sàn Hồ Chí Minh), "HNX" (Sàn Hà Nội), "UPCOM" (Thị trường UPCOM), hoặc "all" để lấy tất cả (mặc định: "all")

  • search (optional): Từ khóa tìm kiếm để lọc theo mã cổ phiếu hoặc tên công ty

Ví dụ sử dụng:

Liệt kê tất cả mã cổ phiếu:

{}

Lọc theo sàn HOSE:

{
  "exchange": "HOSE"
}

Tìm kiếm mã cổ phiếu:

{
  "search": "VIC"
}

Kết hợp filter và search:

{
  "exchange": "HOSE",
  "search": "bank"
}

Lưu ý:

  • Tool sẽ cố gắng lấy danh sách từ FireAnt API trước, nếu không thành công sẽ sử dụng danh sách tĩnh các mã cổ phiếu phổ biến.

  • Danh sách bao gồm các mã cổ phiếu lớn và phổ biến trên thị trường Việt Nam.

  • Để lấy thông tin chi tiết và giá real-time, sử dụng get_stock_price_fireant với mã cổ phiếu cụ thể.

6. get_cafef_market_news

Lấy tin tức thị trường chứng khoán mới nhất từ CafeF (cafef.vn). Tool này sử dụng Firecrawl API để scrape và trả về tin tức, phân tích, và cập nhật thị trường từ trang tin tài chính hàng đầu Việt Nam.

Parameters:

  • limit (optional): Số lượng bài viết tối đa cần trả về (mặc định: 20, tối đa: 100)

  • search (optional): Từ khóa tìm kiếm để lọc tin tức (ví dụ: "VIC", "VN-Index", "ngân hàng")

  • format (optional): Định dạng đầu ra - "markdown" (văn bản có định dạng), "json" (dữ liệu có cấu trúc), hoặc "text" (văn bản thuần). Mặc định: "markdown"

Ví dụ sử dụng:

Lấy 20 tin tức mới nhất:

{}

Lấy 10 tin tức về VIC:

{
  "limit": 10,
  "search": "VIC"
}

Lấy tin tức dạng JSON:

{
  "limit": 20,
  "format": "json"
}

Tìm kiếm tin tức về ngân hàng:

{
  "search": "ngân hàng",
  "limit": 15
}

Lưu ý:

  • Tool sử dụng Firecrawl API để scrape dữ liệu từ cafef.vn.

  • Để sử dụng Firecrawl API, bạn cần tự đăng ký và lấy API key của riêng bạn từ firecrawl.dev.

  • Nếu không có Firecrawl API key, tool sẽ sử dụng phương pháp fallback với HTML parsing cơ bản (kết quả có thể kém chính xác hơn).

  • Để có kết quả tốt nhất, nên sử dụng Firecrawl API key của bạn.

Cách lấy Firecrawl API Key:

  1. Truy cập https://firecrawl.dev

  2. Đăng ký tài khoản miễn phí hoặc đăng nhập

  3. Vào Dashboard và lấy API key của bạn

  4. Copy API key và thêm vào cấu hình mcp.json như hướng dẫn bên dưới

Cấu hình Firecrawl API Key trong mcp.json:

Thêm env với FIRECRAWL_API_KEY vào cấu hình của vn-stock-api-mcp:

{
  "mcpServers": {
    "vn-stock-api-mcp": {
      "command": "node",
      "args": ["C:\\path\\to\\vn-stock-api-mcp\\dist\\index.js"],
      "env": {
        "FIRECRAWL_API_KEY": "your-firecrawl-api-key-here"
      }
    }
  }
}

⚠️ QUAN TRỌNG:

  • Thay "your-firecrawl-api-key-here" bằng API key thực tế của bạn từ firecrawl.dev

  • KHÔNG chia sẻ API key của bạn công khai

  • KHÔNG commit API key vào Git repository

7. analyze_doji_pattern

Phân tích mô hình nến Doji trong biểu đồ giá cổ phiếu. Mô hình Doji cho thấy sự không chắc chắn của thị trường và tiềm năng đảo chiều xu hướng. Tool này phát hiện các loại Doji khác nhau bao gồm Standard Doji, Long-legged Doji, Dragonfly Doji, Gravestone Doji, và Four Price Doji.

Parameters:

  • symbol (required): Mã cổ phiếu cần phân tích (ví dụ: "VIC", "VNM", "VCB")

  • period (optional): Chu kỳ thời gian phân tích - "1D" (ngày), "1W" (tuần), "1M" (tháng). Mặc định: "1D"

  • days (optional): Số ngày để phân tích (mặc định: 30, tối đa: 100). Dùng để phát hiện mô hình Doji trong dữ liệu lịch sử

  • threshold (optional): Ngưỡng phát hiện Doji theo phần trăm của khoảng giá (mặc định: 0.1 = 0.1%). Giá trị thấp hơn sẽ phát hiện nhiều mô hình Doji hơn

Ví dụ sử dụng:

Phân tích Doji cho VIC (30 ngày gần nhất):

{
  "symbol": "VIC"
}

Phân tích Doji với chu kỳ tuần:

{
  "symbol": "VIC",
  "period": "1W",
  "days": 60
}

Phân tích với ngưỡng tùy chỉnh:

{
  "symbol": "VNM",
  "threshold": 0.05,
  "days": 50
}

Các loại mô hình Doji được phát hiện:

  1. Standard Doji: Giá mở và giá đóng gần như bằng nhau với bóng nến ở cả hai phía

    • Ý nghĩa: Thị trường không chắc chắn, có thể đảo chiều xu hướng

  2. Long-legged Doji: Thân nến nhỏ với bóng trên và bóng dưới rất dài

    • Ý nghĩa: Biến động cao và không chắc chắn mạnh, tiềm năng đảo chiều

  3. Dragonfly Doji: Giá mở và giá đóng gần mức cao nhất, với bóng dưới dài

    • Ý nghĩa: Tín hiệu tăng giá, đặc biệt sau xu hướng giảm

  4. Gravestone Doji: Giá mở và giá đóng gần mức thấp nhất, với bóng trên dài

    • Ý nghĩa: Tín hiệu giảm giá, đặc biệt sau xu hướng tăng

  5. Four Price Doji: Giá mở = giá cao = giá thấp = giá đóng (rất hiếm)

    • Ý nghĩa: Không chắc chắn cực mạnh, xuất hiện rất hiếm

Lưu ý:

  • Tool cần dữ liệu OHLC (Open, High, Low, Close) từ FireAnt API hoặc nguồn khác

  • Nếu FireAnt API không khả dụng, tool sẽ cung cấp hướng dẫn sử dụng Firecrawl để scrape dữ liệu

  • Mô hình Doji chỉ cho thấy sự không chắc chắn của thị trường, nên kết hợp với các chỉ báo kỹ thuật khác để đưa ra quyết định đầu tư

  • Phân tích kỹ thuật không đảm bảo kết quả đầu tư, chỉ mang tính chất tham khảo

Các nhà cung cấp được hỗ trợ

VNDirect

FireAnt

SSI

Development

npm run dev  # Watch mode
npm run build  # Build
npm start  # Run server

License

MIT

Available Tools

7 tools
analyze_doji_patternC

Analyze Doji candlestick patterns in stock price charts. Doji patterns indicate market indecision and potential trend reversals. Detects various types of Doji patterns including Standard Doji, Long-legged Doji, Dragonfly Doji, Gravestone Doji, and Four Price Doji.

Inputs: symbol (required), period, days, threshold.

get_api_documentation_urlsB

Get documentation URLs for API providers. Returns links to official API documentation, guides, and GitHub repositories.

Inputs: provider (required).

get_api_endpointsC

Get specific API endpoints for a provider. Returns detailed endpoint information including URLs, methods, and descriptions.

Inputs: provider (required), category.

get_cafef_market_newsB

Get latest stock market news from CafeF (cafef.vn). Scrapes and returns comprehensive market news, analysis, and updates from Vietnam's leading financial news website. Uses Firecrawl API for reliable web scraping.

Inputs: limit, search, format.

get_stock_price_fireantB

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).

Inputs: symbol (required).

list_vn_stocksA

List all available Vietnam stock symbols. Returns a comprehensive list of stock symbols traded on Vietnamese stock exchanges (HOSE, HNX, UPCOM). Similar to list_assets in coincap-mcp.

Inputs: exchange, search.

search_vn_stock_apiB

Search for API documentation and endpoints from VNDirect, FireAnt, or SSI. Returns information about available APIs, endpoints, and documentation URLs.

Inputs: provider (required), query.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 7 tools

    Disambiguation3/5

    The tools have some clear distinctions, such as between price fetching, news retrieval, and API documentation, but there is notable overlap: get_api_documentation_urls and search_vn_stock_api both handle API documentation, and get_api_endpoints is closely related, which could cause confusion for an agent. The Doji analysis tool is distinct but may not integrate well with the others.

    Naming Consistency4/5

    Most tools follow a consistent verb_noun pattern (e.g., get_stock_price_fireant, list_vn_stocks, search_vn_stock_api), with clear and descriptive names. However, analyze_doji_pattern uses 'analyze' instead of 'get' or 'list', and includes underscores inconsistently with compound terms, slightly deviating from the overall pattern.

    Tool Count4/5

    With 7 tools, the count is reasonable for a server focused on Vietnam stock market data and API access. It covers multiple aspects like prices, news, symbols, and documentation without being overly bloated, though it could be slightly refined to reduce redundancy in the API documentation tools.

    Completeness3/5

    The server covers key areas like stock listing, price fetching, news, and API documentation, but there are gaps: it lacks tools for historical data, portfolio management, or trading operations, which are common in stock APIs. The Doji analysis tool feels isolated without complementary technical analysis tools, limiting overall domain coverage.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI assistants to query Vietnam stock intraday data from SSI FastConnect API, providing access to stock codes, detailed information, index data, and OHLC information through natural language queries.
      17
      Apache 2.0
    • A
      license
      B
      quality
      D
      maintenance
      Provides access to Vietnam stock market data including real-time quotes, historical prices, company financials, trading statistics, mutual fund information, and exchange rates through the vnstock library.
      33
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides seamless access to Vietnamese stock market data, enabling real-time prices, historical data, company fundamentals, and market analysis through natural language queries.
      17 npm
      MIT