Yggdrasil
MCP ServersMCP 伺服器 SKILLs技能 PlugIns解決方案 Asgard AI SolutionAsgard AI 方案 Submit Listing申請上架 GitHub
T

Taiwan Agri Food Market 台灣農產品市場行情

Released已發布
data taiwan

MCP Server for twfood.cc — 6 AI-callable tools for Taiwan agricultural wholesale market price data including daily, weekly, monthly, and yearly reports.

台灣農產品批發市場即時價格 MCP Server — 6 個工具查詢日/週/月/年行情及跨市場比價。

Status狀態
released
Tools工具數
6
Category分類
data
Region地區
taiwan
Maintainer維護者
GitHub

Features功能特色

  • 6 MCP tools — Search products, query trade data at 4 time granularities, cross-market comparison
  • No authentication — Uses public twfood.cc APIs, no credentials needed
  • Historical data — Yearly summaries back to 1996
  • 16+ wholesale markets — Cross-market volume and price comparison
  • 2,000+ products — Vegetables, fruits, flowers, imported items
  • 6 個 MCP 工具 — 品項搜尋、4 種時間粒度交易查詢、跨市場比較
  • 無需認證 — 使用 twfood.cc 公開 API,無需任何憑證
  • 歷史資料 — 年度彙總可追溯至 1996 年
  • 16+ 批發市場 — 跨市場交易量與價格比較
  • 2,000+ 品項 — 蔬菜、水果、花卉、進口品

Quick Start快速開始

# Test connection
python scripts/auth/test_connection.py

# Run all tool tests
python tests/test_all_tools.py

# Start MCP server
python mcp_server.py
# 測試連線
python scripts/auth/test_connection.py

# 執行所有工具測試
python tests/test_all_tools.py

# 啟動 MCP 伺服器
python mcp_server.py

Available Tools可用工具

Tool Description Parameters
search_products Search 2,000+ products by name or code keyword
get_daily_trades Daily trade data (volume, avg/high/low price) item_code, start_date
get_weekly_trades Weekly trade summaries item_code, start_date
get_monthly_trades Monthly trade summaries item_code, start_date
get_yearly_trades Yearly trade summaries (back to 1996) item_code
get_market_history Cross-market volume & price comparison (~17 markets) item_code
工具 說明 參數
search_products 搜尋 2,000+ 品項(依名稱或代碼) keyword
get_daily_trades 每日交易資料(交易量、均/高/低價) item_code, start_date
get_weekly_trades 每週交易彙總 item_code, start_date
get_monthly_trades 每月交易彙總 item_code, start_date
get_yearly_trades 每年交易彙總(可追溯至 1996) item_code
get_market_history 跨市場交易量與價格比較(約 17 市場) item_code

Contributing貢獻

請參閱 CONTRIBUTING.md

License授權

MIT License — see LICENSE for details.

The MIT license applies to the source code of this MCP server only. The agricultural market data accessed through twfood.cc is subject to its own CC BY-NC-ND 4.0 license terms.

MIT License — 詳見 LICENSE

MIT 授權僅適用於本 MCP 伺服器的原始碼。透過 twfood.cc 存取的農產品市場資料受其 CC BY-NC-ND 4.0 授權條款約束。

PrerequisitesPrerequisites

  • Python 3.10+
  • No API credentials required (public data)
  • Python 3.10+
  • 無需 API 憑證(公開資料)

InstallInstall

From PyPI

pip install mcp-twfood

Using uvx (no install)

uvx mcp-twfood

From source

git clone https://github.com/asgard-ai-platform/mcp-twfood.git
cd mcp-twfood
uv venv && source .venv/bin/activate
uv pip install -e .

從 PyPI

pip install mcp-twfood

使用 uvx(免安裝)

uvx mcp-twfood

從原始碼

git clone https://github.com/asgard-ai-platform/mcp-twfood.git
cd mcp-twfood
uv venv && source .venv/bin/activate
uv pip install -e .

UsageUsage

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "twfood": {
      "command": "python",
      "args": ["/path/to/mcp-twfood/mcp_server.py"],
      "env": {
        "PYTHONPATH": "/path/to/mcp-twfood"
      }
    }
  }
}

Claude Code

The .mcp.json file is auto-discovered when you open the project directory.

Cursor

Add to Cursor MCP settings:

{
  "mcpServers": {
    "twfood": {
      "command": "python",
      "args": ["/path/to/mcp-twfood/mcp_server.py"],
      "env": {
        "PYTHONPATH": "/path/to/mcp-twfood"
      }
    }
  }
}

Claude Desktop

新增至 ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "twfood": {
      "command": "python",
      "args": ["/path/to/mcp-twfood/mcp_server.py"],
      "env": {
        "PYTHONPATH": "/path/to/mcp-twfood"
      }
    }
  }
}

Claude Code

開啟專案目錄時會自動發現 .mcp.json

Cursor

新增至 Cursor MCP 設定:

{
  "mcpServers": {
    "twfood": {
      "command": "python",
      "args": ["/path/to/mcp-twfood/mcp_server.py"],
      "env": {
        "PYTHONPATH": "/path/to/mcp-twfood"
      }
    }
  }
}

Usage ExamplesUsage Examples

"What was last week's cabbage price?"

You: 我想知道上週高麗菜的批發價格

AI calls:

search_products(keyword="高麗菜")

Found item code LA1. Then:

get_weekly_trades(item_code="LA1", start_date="2026/03/24")

Result: SUCCESS — Last week (week 14) cabbage averaged 6.47 TWD/kg, total volume 4,041,510 kg. Price has been gradually rising from 5.76 in early March.


"Compare cabbage prices across all wholesale markets"

You: 全台各批發市場的高麗菜行情比較

AI calls:

get_market_history(item_code="LA1")

Result: SUCCESS — Returns volume and price time series for 17 markets. For example, 台北二 averages 7.2 TWD/kg while 西螺鎮 averages 5.1 TWD/kg — regional price differences clearly visible.


"Daily pineapple prices for March"

You: 三月份金鑽鳳梨每天的批發價多少?

AI calls:

get_daily_trades(item_code="B2", start_date="2026/03/01")

Result: SUCCESS — 33 daily records. March 1: avg 28.02, high 36.75, low 20.02 TWD/kg with volume 126,913 kg. Prices fluctuated between 20–37 TWD/kg range throughout the month.


"How have strawberry prices changed over the years?"

You: 草莓歷年來的價格變化?

AI calls:

get_yearly_trades(item_code="N1")

Result: SUCCESS — 31 years of data since 1996. Prices rose from ~40 TWD/kg in the early 2000s to 80–98 TWD/kg in recent years (2022: 97.8, 2023: 80.73, 2024: 81.86, 2025: 94.23 TWD/kg).


"Monthly banana market trends"

You: 香蕉近一年的月度走勢

AI calls:

get_monthly_trades(item_code="A1", start_date="2025/04/01")

Result: SUCCESS — 12 monthly summaries showing seasonal price and volume patterns. Useful for understanding supply cycles and planning purchasing.


"What pineapple varieties are available?"

You: 有哪些鳳梨品種?

AI calls:

search_products(keyword="鳳梨")

Result: SUCCESS — Found 7 varieties: 鳳梨-開英 (B1), 鳳梨-金鑽鳳梨 (B2), 鳳梨-香水鳳梨 (B3), 鳳梨-鳳梨花 (B4), 鳳梨-蜜鳳梨 (B5), 鳳梨-其他 (B9), plus 釋迦-鳳梨釋迦 (32).


"Is garlic expensive right now?"

You: 最近蒜頭貴不貴?幫我查一下

AI calls:

search_products(keyword="蒜頭")

Found 大蒜-蒜頭 with code SG5. Then:

get_daily_trades(item_code="SG5", start_date="2026/03/01")

Result: SUCCESS — Returns daily prices so you can compare current prices against recent trends and decide whether to buy now or wait.


"Which market has cheapest cabbage?"

You: 哪個批發市場的高麗菜最便宜?

AI calls:

get_market_history(item_code="LA1")

Result: SUCCESS — AI analyzes the price time series across 17 markets and identifies the markets with consistently lower prices. Southern and central markets (e.g., 西螺鎮, 溪湖鎮) tend to have lower prices than 台北二.

「我想知道上週高麗菜的批發價格」

你: 我想知道上週高麗菜的批發價格

AI 呼叫:

search_products(keyword="高麗菜")

找到品項代碼 LA1,接著:

get_weekly_trades(item_code="LA1", start_date="2026/03/24")

結果: SUCCESS — 上週(第 14 週)高麗菜平均 6.47 元/公斤,總交易量 4,041,510 公斤。三月初以來價格從 5.76 元逐步上漲。


「全台各批發市場的高麗菜行情比較」

你: 全台各批發市場的高麗菜行情比較

AI 呼叫:

get_market_history(item_code="LA1")

結果: SUCCESS — 回傳 17 個市場的交易量與價格時間序列。例如台北二平均 7.2 元/公斤,西螺鎮平均 5.1 元/公斤 — 地區差價一目瞭然。


「三月份金鑽鳳梨每天的批發價多少?」

你: 三月份金鑽鳳梨每天的批發價多少?

AI 呼叫:

get_daily_trades(item_code="B2", start_date="2026/03/01")

結果: SUCCESS — 33 筆日資料。3/1:均價 28.02,最高 36.75,最低 20.02 元/公斤,交易量 126,913 公斤。整月價格在 20–37 元之間波動。


「草莓歷年來的價格變化?」

你: 草莓歷年來的價格變化?

AI 呼叫:

get_yearly_trades(item_code="N1")

結果: SUCCESS — 自 1996 年起共 31 年資料。2000 年代初約 40 元/公斤,近年攀升至 80–98 元(2022: 97.8, 2023: 80.73, 2024: 81.86, 2025: 94.23 元/公斤)。


「香蕉近一年的月度走勢」

你: 香蕉近一年的月度走勢

AI 呼叫:

get_monthly_trades(item_code="A1", start_date="2025/04/01")

結果: SUCCESS — 12 筆月度彙總,清楚呈現季節性價量變化,適合了解供應週期與採購規劃。


「有哪些鳳梨品種?」

你: 有哪些鳳梨品種?

AI 呼叫:

search_products(keyword="鳳梨")

結果: SUCCESS — 找到 7 個品種:鳳梨-開英 (B1)、鳳梨-金鑽鳳梨 (B2)、鳳梨-香水鳳梨 (B3)、鳳梨-鳳梨花 (B4)、鳳梨-蜜鳳梨 (B5)、鳳梨-其他 (B9),以及釋迦-鳳梨釋迦 (32)。


「最近蒜頭貴不貴?」

你: 最近蒜頭貴不貴?幫我查一下

AI 呼叫:

search_products(keyword="蒜頭")

找到「大蒜-蒜頭」代碼 SG5,接著:

get_daily_trades(item_code="SG5", start_date="2026/03/01")

結果: SUCCESS — 回傳每日價格,可與近期趨勢比較,判斷現在買划不划算。


「哪個批發市場的高麗菜最便宜?」

你: 哪個批發市場的高麗菜最便宜?

AI 呼叫:

get_market_history(item_code="LA1")

結果: SUCCESS — AI 分析 17 個市場的價格時間序列,找出價格持續較低的市場。中南部市場(如西螺鎮、溪湖鎮)通常比台北二便宜。

Itemcode ReferenceItemcode Reference

Category Prefix Example
Leafy vegetables LA LA1 (Cabbage/高麗菜)
Legumes FB FB1
Seasonings SA SA3
Vegetable fruits FJ FJ3
Stem vegetables SB SB2
Fruits Various A1 (Banana), B2 (Pineapple), P1 (Guava), N1 (Strawberry)
Roses FR FR102
Imported roses IR IR101

Use search_products to find the exact item code for any product.

分類 前綴 範例
葉菜類 LA LA1(高麗菜)
豆菜類 FB FB1
香辛類 SA SA3
果菜類 FJ FJ3
莖菜類 SB SB2
水果 各式 A1(香蕉)、B2(鳳梨)、P1(芭樂)、N1(草莓)
玫瑰 FR FR102
進口玫瑰 IR IR101

使用 search_products 可查詢任何品項的確切代碼。

ArchitectureArchitecture

stdio (JSON-RPC 2.0)
  → mcp_server.py (entry point)
    → app.py (FastMCP singleton)
      → tools/twfood_tools.py (@mcp.tool() — 6 tools)
        → connectors/rest_client.py (HTTP GET with retry)
          → auth/none.py (no auth — public API)
            → config/settings.py (twfood.cc endpoints)
stdio (JSON-RPC 2.0)
  → mcp_server.py(入口)
    → app.py(FastMCP 單例)
      → tools/twfood_tools.py(@mcp.tool() — 6 個工具)
        → connectors/rest_client.py(HTTP GET + 重試)
          → auth/none.py(無認證 — 公開 API)
            → config/settings.py(twfood.cc 端點)

Publishing To PypiPublishing To Pypi

This project uses GitHub Actions for automated PyPI publishing.

Setup (one-time)

  1. PyPI Trusted Publisher — Go to pypi.org/manage/account/publishing and add:

    • PyPI project name: mcp-twfood
    • Owner: asgard-ai-platform
    • Repository: mcp-twfood
    • Workflow name: publish.yml
    • Environment name: pypi
  2. GitHub Environment — Repo Settings > Environments > New environment named pypi

Release

# Tag and create release — triggers publish workflow
gh release create v0.1.0 --title "v0.1.0 - Initial Release" --notes "Initial release with 6 tools for Taiwan agricultural wholesale market data"

本專案使用 GitHub Actions 自動發布至 PyPI。

設定(僅需一次)

  1. PyPI Trusted Publisher — 前往 pypi.org/manage/account/publishing 新增:

    • PyPI 專案名稱:mcp-twfood
    • Owner:asgard-ai-platform
    • Repository:mcp-twfood
    • Workflow name:publish.yml
    • Environment name:pypi
  2. GitHub Environment — Repo Settings > Environments > 新增 pypi 環境

發布

# 建立 tag 與 release — 自動觸發發布流程
gh release create v0.1.0 --title "v0.1.0 - Initial Release" --notes "初始版本,提供 6 個台灣農產品批發市場行情查詢工具"

Data SourceData Source

This MCP server retrieves data from twfood.cc (當季好蔬果), a Taiwan agricultural wholesale market real-time price data platform that combines big data and data visualization technologies.

We sincerely thank the twfood.cc team for making this valuable agricultural market data publicly accessible. Their work enables transparency in Taiwan's agricultural wholesale market and benefits farmers, traders, researchers, and consumers.

Note: This project is an independent open-source MCP server and is not officially affiliated with or endorsed by twfood.cc. Please respect the data license terms when using the data retrieved through this server.

本 MCP 伺服器的資料來自 twfood.cc(當季好蔬果),一個結合大數據與資料視覺化技術的台灣農產品批發市場即時價格資料平台。

誠摯感謝 twfood.cc(當季好蔬果) 團隊將珍貴的農產品市場資料公開供大眾使用。他們的努力讓台灣農產品批發市場的資訊更加透明,惠及農民、貿易商、研究者與消費者。

注意: 本專案為獨立的開源 MCP 伺服器,與 twfood.cc 無官方隸屬或背書關係。使用透過本伺服器取得的資料時,請遵守其資料授權條款。

Part Of The Asgard EcosystemPart Of The Asgard Ecosystem

This server is part of the Asgard AI Platform open-source ecosystem, connecting AI to real-world services across e-commerce, finance, government data, IoT, social media, and more.

此伺服器是 Asgard AI Platform 開源生態系的一部分,連接 AI 至電商、金融、政府開放資料、IoT、社群媒體等真實世界服務。

Tags標籤

agriculturefoodmarket-datataiwan

Need more powerful data capabilities? 需要更強大的data能力?

Upgrade to Mimir for enterprise-grade features, SLAs, and dedicated support.

升級至 Mimir 取得企業級功能、SLA 與專屬支援。

Learn More About Mimir →了解 Mimir →

Related MCP Servers相關 MCP 伺服器