fiinquant-mcp
This server is a personal MCP wrapper around the FiinQuant/FiinQuantX SDK, providing 27 tools for Vietnamese stock market data, analysis, and financial research via Claude Desktop or Cursor.
Price & Market Data
Fetch OHLCV price history and latest stock prices (
fq_get_price_history,fq_get_stock_prices)Get realtime bid/ask order book snapshots (
fq_get_realtime_bid_ask)Retrieve market statistics: market cap, volume, value (
fq_get_market_statistics)
Market Overview & Index Tools
Market breadth: advancing/declining/unchanged counts (
fq_get_market_breadth)Index constituents (e.g., VN30 members) (
fq_get_index_constituents)Money flow contributions and top gainers/losers (
fq_get_money_flow_contribution)Index rebalance allocations for a given cash budget (
fq_get_rebalance)
Fundamental Data
Company basic info, ICB industry classification (
fq_get_basic_info,fq_get_icb_industries)Financial ratios (ROE, PE, etc.) by year/quarter (
fq_get_financial_ratios)Financial statements: income, balance sheet, cash flow (
fq_get_financial_statements)Point-in-time equity snapshots: PE/PB, market cap, liquidity, foreign room (
fq_get_equity_snapshot)Valuation timeseries for stock, index, or sector (
fq_get_valuation_timeseries)
Technical Analysis
Compute indicators: RSI, MACD, SMA, and more (
fq_get_technical_indicators)Detect candlestick/chart patterns: doji, engulfing, support/resistance (
fq_detect_pattern)Relative Rotation Graph (RRG) analysis vs. a benchmark (
fq_get_rrg_analysis)
Screening & Discovery
Screen stocks by indicators, sector, exchange, and sorting criteria (
fq_screen_stocks)Run custom FiinQuant analyses (
fq_run_custom_analysis)Search for available SDK methods/indicators (
fq_search_methods)Call any FiinQuantX method directly when no dedicated tool exists (
fq_call_method)
Ticker & Session Utilities
List tickers by market (HOSE/HNX/UPCOM) and get single ticker metadata (
fq_list_tickers,fq_ticker_info)Health check (
fq_ping), session/plan status (fq_session_status), and gateway operation catalog (fq_list_ops)Log issues locally to stderr via
report_issue(does not upload to admin)
Free Plan Limits: 1 connection, 90 req/min, 80 req/s, ≤33 realtime tickers, ≤31-day history depth, daily and lower timeframes.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@fiinquant-mcpget latest stock prices for FPT and VNM"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
fiinquant-mcp (personal)
Personal resilient MCP server wrapping the FiinQuant / FiinQuantX Python SDK for multiple clients over stdio:
Client | Config | Example name |
Codex CLI |
|
|
Grok CLI |
|
|
Cursor / Claude Desktop |
|
|
uvx | any stdio host | inject SDK via |
Not an official FiinGroup/FiinQuant product. Domain tool names match official FiinQuant MCP; personal extras keep the
fq_prefix.
Version: 0.3.1 · Tools: 27 (21 official + 6 extras)
AI-assisted install (Codex / Claude Code / Grok / Cursor)
User không cần đọc hết docs. Copy prompt trong:
→ dán vào agent → AI tự detect Python, pip install -e, đăng ký MCP (Codex/Grok/Claude/Cursor), smoke fq_ping / get_stock_prices.
Có bản full (chi tiết) và short (1 đoạn) trong file đó.
How it works
flowchart TB
subgraph Client["MCP Clients (stdio JSON-RPC)"]
A["Codex CLI · Grok CLI · Cursor · Claude Desktop"]
end
subgraph MCP["fiinquant-mcp process (stdio)"]
B["FastMCP tools<br/>27 tools · official names + fq_* extras"]
C["Gateway<br/>timeout · re-auth · rate limit · free-tier guards"]
D["Response envelope<br/>ok / code / data / meta · size budget"]
E["SdkClientAdapter<br/>FiinSession mapping"]
end
subgraph SDK["Local Python"]
F["FiinQuantX SDK<br/>private package"]
end
subgraph Cloud["FiinQuant cloud APIs"]
G["Trading data / fundamental / screening / …"]
end
A <-->|"JSON-RPC over stdio"| B
B --> C
C --> E
E --> F
F <-->|"HTTPS + account token"| G
C --> D
D --> B
B --> AData path: client → MCP tool → Gateway (reliability + free limits) → FiinQuantX → FiinQuant API → JSON envelope back to agent.
Auth: FIINQUANT_USERNAME / FIINQUANT_PASSWORD in MCP env (not browser OIDC like official remote MCP).
Related MCP server: Daito
Quick start
1. Shared prerequisites
# Same Python that will run the MCP (example: system 3.11)
python3 -m pip install FiinQuantX # or private wheel from portal
python3 -m pip install -e /path/to/fiinquant-python-mcp
python3 -c "import FiinQuantX, fiinquant_mcp; print('OK')"SDK is private — not always on public PyPI. One Python must have both FiinQuantX and fiinquant_mcp.
Sample configs live under config/:
File | Client |
Codex CLI | |
Grok CLI | |
Cursor / Claude Desktop | |
uvx isolated env | |
Generic JSON (uvx git) |
Naming tip: use fiinquant-sdk for this personal MCP. Keep fiinquant-local if you still run the official remote proxy (npx fiinquant-mcp-proxy).
2. Codex CLI
codex mcp add fiinquant-sdk \
--env FIINQUANT_USERNAME='your@email.com' \
--env FIINQUANT_PASSWORD='your_password' \
--env FIINQUANT_PLAN=free \
--env FIINQUANT_ENFORCE_PLAN_LIMITS=true \
-- /Library/Frameworks/Python.framework/Versions/3.11/bin/python3 -m fiinquant_mcp
codex mcp list
# open a new Codex session and call tools (get_stock_prices, …)Or paste TOML from config/mcp.codex.example.toml into ~/.codex/config.toml.
[mcp_servers.fiinquant-sdk]
command = "/Library/Frameworks/Python.framework/Versions/3.11/bin/python3"
args = ["-m", "fiinquant_mcp"]
[mcp_servers.fiinquant-sdk.env]
FIINQUANT_USERNAME = "your@email.com"
FIINQUANT_PASSWORD = "your_password"
FIINQUANT_PLAN = "free"
FIINQUANT_ENFORCE_PLAN_LIMITS = "true"3. Grok CLI
# After pip install -e . on the same Python as FiinQuantX
# Edit ~/.grok/config.toml — see config/mcp.grok.example.toml
grok mcp doctor fiinquant# ~/.grok/config.toml
[mcp_servers.fiinquant]
command = "/Library/Frameworks/Python.framework/Versions/3.11/bin/python3"
args = ["-m", "fiinquant_mcp"]
enabled = true
startup_timeout_sec = 60
[mcp_servers.fiinquant.env]
FIINQUANT_USERNAME = "your@email.com"
FIINQUANT_PASSWORD = "your_password"
FIINQUANT_PLAN = "free"
FIINQUANT_ENFORCE_PLAN_LIMITS = "true"4. Cursor / Claude Desktop
Copy config/mcp.cursor.example.json into Cursor MCP settings or Claude claude_desktop_config.json (paths differ by OS). Point command at the Python that has both packages.
5. uvx (isolated env)
Only if you inject the private SDK wheel:
{
"mcpServers": {
"fiinquant-sdk": {
"command": "uvx",
"args": [
"--from", "git+https://github.com/luongndcoder/fiinquant-python-mcp",
"--with", "/path/to/FiinQuantX.whl",
"fiinquant-mcp"
],
"env": {
"FIINQUANT_USERNAME": "your@email.com",
"FIINQUANT_PASSWORD": "your_password",
"FIINQUANT_PLAN": "free"
}
}
}
}Client comparison
flowchart LR
subgraph Hosts
CX[Codex CLI<br/>~/.codex/config.toml]
GX[Grok CLI<br/>~/.grok/config.toml]
CR[Cursor / Claude<br/>mcp.json]
end
subgraph Stdio
M["python -m fiinquant_mcp<br/>or uvx … fiinquant-mcp"]
end
CX --> M
GX --> M
CR --> M
M --> S[FiinQuantX + APIs]Codex | Grok | Cursor/Claude | |
Config file |
|
| JSON MCP settings |
CLI add |
|
| UI or JSON edit |
Suggested server name |
|
|
|
vs official proxy | Can coexist with | Independent | Independent |
Plans: free vs paid / higher tiers
MCP không khóa “free-only”. Cả 27 tool luôn được expose. Free chỉ là mặc định an toàn (local guards + API account chặn một phần). Gói cao hơn → cùng MCP, mở thêm data khi FiinQuant cấp permission.
Hai lớp độc lập:
Lớp | Ai kiểm soát | Free | Paid / gói cao |
Local guards (MCP Gateway) | Env | Siết history/rate/ticker | Nới hoặc tắt |
API permission (FiinQuant cloud) | Gói account trên FiinQuant | Nhiều endpoint 403 | Tool trước đó 403 → trả data |
Upgrade account FiinQuant + FIINQUANT_PLAN=paid → full surface dùng được (theo đúng quyền gói)Local guards
FIINQUANT_PLAN=free (default)
Limit | Value |
Connections | 1 session |
Requests / min · / s | 90 · 80 |
Realtime tickers / call | ≤ 33 |
History window | ≤ 31 days |
Intraday TF |
|
Over limit → JSON VALIDATION or RATE_LIMIT (process does not crash).
FIINQUANT_PLAN=paid (hoặc gói cao hơn)
# Codex / Grok env block
FIINQUANT_PLAN = "paid"
# optional: nới tay nếu gói cho phép
# FIINQUANT_MAX_HISTORY_DAYS = "365"
# FIINQUANT_MAX_REALTIME_TICKERS = "200"
# FIINQUANT_REQUESTS_PER_MINUTE = "600"
# FIINQUANT_REQUESTS_PER_SECOND = "200"
# hoặc giữ plan=free nhưng tắt local guard (cẩn thận quota):
# FIINQUANT_ENFORCE_PLAN_LIMITS = "false"paid nới default local caps (history dài hơn, rate/ticker cao hơn). Quyền API thật vẫn do gói FiinQuant quyết định — MCP không fake data.
Live suite (account free) — tool status
Tested end-to-end with FiinQuantX + free account (see plans/.../tool-test-report.json).
Status | Meaning | Count |
Works | Returns real data | 21 |
Blocked by free API | Tool runs; FiinQuant returns 403 / no permission | 6 |
Crash | — | 0 |
Works on free (typical):
get_stock_prices,fq_get_price_historyget_financial_ratios,get_financial_statementsget_valuation_timeseries,get_equity_snapshotget_rrg_analysis,get_rebalanceget_technical_indicators,detect_patternget_market_statistics, health/meta tools
Often 403 on free — expect data on higher plans:
Tool | Typical free error | After upgrade |
| ApiAccessFailed 403 | Company / ICB metadata |
| Screening API 403 | Filter ROE/PE/… |
| No permission MarketBreadth | Advance/decline |
| No permission MoneyFlow | Top gainers/losers flow |
| 403 | VN30 members, … |
Envelope when blocked (tool path still healthy):
{"ok": false, "code": "SDK_ERROR", "message": "…permission…", "hint": "…"}Checklist sau khi nâng gói FiinQuant:
Set
FIINQUANT_PLAN=paid(và/hoặc nớiFIINQUANT_MAX_*) trong env MCP.Restart client session (Codex / Grok / Cursor).
Gọi lại tool từng 403 (vd
screen_stocks,get_basic_info).Nếu vẫn 403 → gói account chưa mở đúng API (không phải MCP thiếu tool).
Response format
Success:
{"ok": true, "data": …, "meta": {"truncated": false, "row_count": 10}}Error (tool failure ≠ process die):
{"ok": false, "code": "TIMEOUT|AUTH|SDK_ERROR|VALIDATION|RATE_LIMIT|INTERNAL", "message": "…", "hint": "…"}tickers accepts ["FPT","VNM"] or "FPT,VNM".
Prompt guide (per tool)
Copy/adapt prompts for your agent. Prefer official tool names first.
Health & meta
Tool | When to use | Example prompt |
| Check MCP alive | “Ping FiinQuant MCP xem process còn sống không.” |
| Creds / plan / rate | “Kiểm tra session FiinQuant: đã login chưa, plan free limits thế nào.” |
| List gateway ops | “Liệt kê các op Gateway hỗ trợ.” |
| Local debug note | “Ghi issue local: tool X lỗi Y khi hỏi Z.” (chỉ log local, không gửi admin FiinQuant) |
| Discover SDK methods | “Search method FiinQuantX chứa Fetch.” |
| Escape hatch | “Dry-run call method_id=login với params {}.” |
Market / prices
Tool | When to use | Example prompt |
| Giá / OHLCV chính | “Lấy giá FPT 2 tuần gần nhất (Daily, adjusted).” · “OHLCV FPT và VNM từ 2026-07-01 đến 2026-07-15.” · “Giá VNINDEX tuần qua.” |
| OHLCV đơn giản start/end | “Price history VNM start=2026-07-01 end=2026-07-15.” |
| Stats (cap, foreign…) | “Market statistics FPT từ 2026-07-01 đến 2026-07-15, time_filter=Daily.” |
| Breadth index | “Market breadth VNINDEX.” (free: often no permission) |
| Thành phần chỉ số | “Lấy danh sách mã VN30.” (free: often 403) |
| Dòng tiền / đóng góp | “Top gainers đóng góp VNINDEX 1Day, limit 10.” (free: often no permission) |
| Bid/ask | “Bid/ask realtime FPT.” (SDK streaming; may return guidance note) |
Tips get_stock_prices:
Always pass
from_date+to_date(YYYY-MM-DD); free max span 31 days.frequency:Dailyor1m/5m/15m/1h/4h.Multiple tickers:
["FPT","VNM"].
Universe
Tool | When to use | Example prompt |
| Tên, sàn, ngành | “Basic info FPT, VNM.” (free: often 403) |
| ICB levels | “List ICB industries level=2.” |
| List theo sàn | “List tickers market=HOSE.” |
| 1 mã metadata | “Ticker info FPT.” (free: often 403) |
Fundamental
Tool | When to use | Example prompt |
| Chỉ số tài chính | “Financial ratios FPT years 2024 và 2025.” |
| BCTC | “Income statement FPT năm 2024 (consolidated).” · “Balance sheet FPT statement=balance_sheet years=[2024].” |
| Lịch sử định giá | “Valuation timeseries FPT scope=stock from 2026-06-15 to 2026-07-15.” |
| Snapshot gần đây | “Equity snapshot FPT metrics pe,pb.” |
statement values: income_statement · balance_sheet · cashflow · full · note
Screening & technical
Tool | When to use | Example prompt |
| Lọc cổ phiếu | “Screen HOSE: ROE > 15, limit 20.” (free: often 403) |
| RSI/MACD/… | “RSI 14 và MACD cho FPT, by=1d.” |
| Mẫu nến / pattern | “Detect doji trên FPT từ 2026-06-15 đến 2026-07-15.” |
| RRG vs benchmark | “RRG FPT,VNM vs VNINDEX 1 tháng gần nhất.” |
| Phân bổ theo rổ | “Rebalance VN30 với budget 1 tỷ VND.” |
| Custom / list | “List custom analyses available.” |
Screen filters example (JSON):
[{"indicator": "roe", "operator": "gt", "value": 15}]Pattern params example:
{"tickers": ["FPT"], "from_date": "2026-06-15", "to_date": "2026-07-15", "by": "1d"}Example agent workflows
A. Xem giá nhanh
Dùng get_stock_prices lấy OHLCV FPT 2 tuần gần nhất (Daily, adjusted).
Tóm tắt close đầu/cuối kỳ, % thay đổi, volume bất thường.B. Phân tích fundamental
1) get_financial_ratios FPT years 2024,2025
2) get_financial_statements FPT income_statement 2024
So sánh revenue / net profit / EPS.C. So sánh 2 mã + index
get_stock_prices tickers=[FPT,VNM,VNINDEX] from_date=… to_date=… (≤31 ngày free).
Bảng close theo ngày + nhận xét tương quan ngắn hạn.D. Khi tool 403
Nếu SDK_ERROR permission/403: báo user đây là hạn mức gói free FiinQuant,
không phải MCP die; gợi ý tool thay thế (vd giá thay vì screen).Environment
Variable | Default | Meaning |
| — | SDK username |
| — | SDK password |
|
|
|
|
| Local rate/history/ticker guards |
|
| Max date span |
|
| Cap per realtime-ish call |
|
| Local RPM |
|
| Local RPS |
|
| Per-call timeout |
|
| Response row budget |
|
| Response char budget |
Architecture vs official MCP
Official FiinQuant MCP | This MCP | |
Tool names |
| Same + |
Auth | Browser / OIDC remote | Local SDK user/pass |
Transport | Streamable HTTP | stdio |
Reliability | Vendor | Timeout, envelope, size budget, free guards |
| Admin upload | Local log only |
sequenceDiagram
participant U as User / Agent
participant C as MCP Client
participant M as fiinquant-mcp
participant G as Gateway
participant S as FiinQuantX
participant A as FiinQuant API
U->>C: "Giá FPT 2 tuần gần nhất"
C->>M: tools/call get_stock_prices
M->>G: call(op, tickers, from, to)
G->>G: free-tier check (≤31d, rate…)
G->>S: Fetch_Trading_Data(...)
S->>A: HTTPS
A-->>S: OHLCV
S-->>G: DataFrame
G-->>M: normalize + envelope
M-->>C: {"ok":true,"data":[...]}
C-->>U: Table / summaryDevelop
git clone https://github.com/luongndcoder/fiinquant-python-mcp.git
cd fiinquant-python-mcp
# Use a Python that already has FiinQuantX
pip install -e ".[dev]"
pytest -v
python -m fiinquant_mcp # stdio serverUnit tests mock the SDK boundary (no network). Live suite: plans/20260715-fiinquant-personal-mcp/tool-test-report.json.
License
MIT for this wrapper only. FiinQuant SDK and market data remain under FiinQuant terms of use. Do not commit credentials.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceMCP server providing comprehensive access to Finnhub financial market data API for AI assistants like Claude Desktop.Last updated10MIT
- Flicense-qualityBmaintenanceMCP server for screening Indian stocks and mutual funds by wrapping screener.in and Morningstar India, enabling fundamental queries from Claude or Cursor.Last updated
- Alicense-qualityBmaintenanceAn MCP server that exposes Finviz stock screening, fundamentals, news, and market data as tools for MCP clients like Claude Code and Claude Desktop.Last updatedMIT
- AlicenseAqualityBmaintenanceMCP server for TradingView's market screener API, enabling stock, forex, crypto, and ETF screening, technical analysis, and investor workflows via Claude or CLI.Last updated1220547MIT
Related MCP Connectors
Query SEC EDGAR filings, XBRL financials, and company data through MCP. STDIO & Streamable HTTP.
The financial MCP for AI agents - 90+ financial tables, SEC filings, signals, alt-data.
Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/luongndcoder/fiinquant-python-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server