VNStock MCP Server (Unofficial)
An unofficial MCP (Model Context Protocol) server that provides tools to access Vietnam stock market data. This is a wrapper around the excellent vnstock library by @thinh-vu.
Note: This is an independent project and is not officially affiliated with the vnstock library or its maintainers.
About vnstock
This MCP server is built on top of the vnstock library - a powerful Python toolkit for Vietnamese stock market analysis created by Thinh Vu. vnstock provides comprehensive access to Vietnam stock market data including:
Real-time and historical stock prices
Company financial statements
Market data and trading statistics
Mutual fund information
Gold prices and exchange rates
For more information about the underlying library, visit: https://github.com/thinh-vu/vnstock
Features
This MCP server exposes vnstock's capabilities through MCP tools, allowing AI assistants and other MCP clients to:
Access company information and financial data
Retrieve stock quotes and historical prices
Get trading statistics and market data
Query mutual fund information
Access gold prices and exchange rates
Retrieve financial statements (income, balance sheet, cash flow)
Installation
Install from PyPI (Recommended)
Install from source
Prerequisites
Python 3.10+
uv (install with
pip install uvor seehttps://docs.astral.sh/uv/)
Quick Start
Run the MCP server
Default mode (stdio)
With transport options
The server uses FastMCP and supports multiple transport protocols:
stdio: Standard input/output (default, for MCP clients like Claude Desktop)
sse: Server-Sent Events (for web applications)
streamable-http: HTTP streaming (for HTTP-based integrations)
Transport Modes
The VNStock MCP Server supports three different transport protocols to accommodate various use cases:
stdio (Default)
Use case: Standard MCP clients like Claude Desktop, Cursor, Cline
Protocol: Communication via standard input/output streams
Usage:
vnstock-mcp-serverorvnstock-mcp-server --transport stdioBest for: Desktop applications and traditional MCP integrations
SSE (Server-Sent Events)
Use case: Web applications that need real-time data streaming
Protocol: HTTP-based server-sent events
Usage:
vnstock-mcp-server --transport sse [--mount-path /path]Server runs on:
http://127.0.0.1:8000(default)Best for: Web dashboards, browser-based applications
streamable-http
Use case: HTTP-based integrations and API services
Protocol: HTTP streaming with JSON-RPC over HTTP
Usage:
vnstock-mcp-server --transport streamable-httpServer runs on:
http://127.0.0.1:8000(default)Best for: REST API integrations, microservices architecture
Command Line Options
MCP client integration
Cursor / Cline example
Add a server entry in your MCP configuration:
Default stdio transport
With specific transport options
If installed from source:
Claude Desktop example
In MCP server settings:
Command:
vnstock-mcp-serverArgs: (leave empty for stdio, or add transport options like
--transport sse)
Available Tools
The MCP server provides the following categories of tools:
Company Information
Company overview, news, events
Shareholders and officers information
Subsidiaries and insider deals
Trading statistics and ratios
Financial Data
Income statements, balance sheets, cash flows
Financial ratios and raw reports
Historical financial data (quarterly/yearly)
Market Data
Real-time quotes and historical prices
Intraday trading data and price depth
Market price boards for multiple symbols
Fund Information
Fund listings and search
NAV reports and holdings
Industry and asset allocation
Miscellaneous
Gold prices (SJC, BTMC)
Exchange rates
Symbol listings by industry/group
Development
Install with uv (for development)
Testing with uv
Building and Publishing
Build locally
Create a release
This will:
Run tests
Create and push a git tag
Trigger GitHub Actions to build and publish to PyPI
Credits
This project is a wrapper around the vnstock library created by @thinh-vu. All stock market data access functionality is provided by vnstock.
Please consider:
⭐ Starring the original vnstock repository
📖 Reading the vnstock documentation
💖 Supporting the vnstock project if you find it valuable
Disclaimer
This is an unofficial wrapper and is not affiliated with the vnstock library or its maintainers. For issues related to the underlying stock market data or vnstock functionality, please refer to the vnstock repository.
Troubleshooting
Installation Issues
Module not found with :
Ensure
uv synccompleted successfully in the project root.Verify Python version:
python --versionanduv python list.
Command :
Ensure the package is installed:
pip list | grep vnstock-mcp-serverTry reinstalling:
pip install --upgrade vnstock-mcp-server
Connection Issues
MCP client cannot connect (stdio mode):
Confirm the client configuration matches the installation method
Check client logs for detailed errors.
Ensure no extra arguments are passed for stdio transport
Cannot access SSE/HTTP endpoints:
Verify the server is running: check for "Uvicorn running on http://127.0.0.1:8000"
Check if port 8000 is available:
netstat -an | grep 8000Try accessing
http://127.0.0.1:8000in browser for SSE mode
Transport Mode Issues
SSE transport not working:
Ensure mount-path is correctly specified if needed
Check server logs for startup errors
Verify web client can connect to the SSE endpoint
Wrong transport mode selected:
Use
--helpto see available transport optionsstdio: for desktop MCP clients (Claude Desktop, Cursor)
sse: for web applications
streamable-http: for HTTP API integrations
Getting Help
Check server version:
vnstock-mcp-server --versionView all options:
vnstock-mcp-server --helpTest server startup: Run with
--transport stdiofirst to verify basic functionality
License
MIT License - see LICENSE file for details.
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests for new functionality
Run tests:
uv run pytestSubmit a pull request
Changelog
v1.1.0 (Current Development)
NEW: Added support for multiple transport modes (stdio, sse, streamable-http)
NEW: Command line arguments for transport selection (
--transport,--mount-path)NEW: SSE (Server-Sent Events) transport for web applications
NEW: HTTP streaming transport for API integrations
IMPROVED: Enhanced CLI with help messages and validation
IMPROVED: Better error handling and user feedback
IMPROVED: Comprehensive documentation for all transport modes
v1.0.0
Initial release
Full Vietnam stock market data access via MCP
Support for company data, financial statements, quotes, and more
Wrapper around vnstock v3.2.6+