---
title: "MCP 金融資料 串接指南 | Narwhal API"
description: "連接 MCP 用戶端、探索 Narwhal 公開工具，並了解結果與額度行為。"
url: "https://narwhalapi.com/zh-tw/docs/mcp"
---

# MCP 金融資料：透過 MCP 連線

透過 MCP 用戶端使用相同的 Narwhal 金鑰與公開 API 結構描述。

[取得免費 API 金鑰](https://narwhalapi.com/zh-tw/signup)

Narwhal 提供一個無狀態的 Streamable HTTP MCP 端點。它使用與 REST 相同的已啟用資料 API、回應結構描述、驗證方式與額度。

## 連線

- [MCP 伺服器概覽](https://narwhalapi.com/zh-tw/mcp.md)
- [Claude Code 設定](https://narwhalapi.com/zh-tw/docs/mcp/claude.md)
- [Cursor 設定](https://narwhalapi.com/zh-tw/docs/mcp/cursor.md)
- [VS Code 設定](https://narwhalapi.com/zh-tw/docs/mcp/vscode.md)

將遠端伺服器 `https://api.narwhalapi.com/mcp` 新增到您的 MCP 用戶端。請選擇「Connect」，以 Narwhal 帳戶登入，然後在 Narwhal 授權畫面選擇「Allow」。

如果您的用戶端無法登入，請改用 API 金鑰。

將遠端伺服器 URL 和 Bearer 標頭加入支援需驗證身分之 Streamable HTTP 的 MCP 用戶端。

與客戶端無關的欄位映射

```
{
  "url": "https://api.narwhalapi.com/mcp",
  "headers": {
    "Authorization": "Bearer YOUR_NARWHAL_API_KEY"
  }
}
```

這是欄位對照範例，並非可直接複製貼上的檔案。替換 `YOUR_NARWHAL_API_KEY` 時，請使用用戶端的安全機密設定。JSON 本身不會自動展開 shell 變數，且各 MCP 用戶端使用的環境變數語法不同。

請勿將實際使用的金鑰貼到共用的設定檔中。

## 可用工具

`tools/list` returns the public tools enabled for this release profile. The data tools are read-only; the monitor tools and report_missing_data change state. The catalogue below is the public tool set, not a promise that every source has a value for every input.

`economics_get_cpi` `economics_get_inflation` `economics_get_unemployment` `economics_get_labour_force_participation` `economics_get_gdp` `economics_get_gdp_growth` `economics_get_trade` `economics_get_cpi_history` `economics_get_inflation_history` `economics_get_unemployment_history` `economics_get_labour_force_participation_history` `economics_get_gdp_history` `economics_get_gdp_growth_history` `economics_get_trade_history` `fx_get_rates` `fx_get_rate_history` `fx_convert_currency` `commodities_list_palmoil_physical_series` `commodities_get_palmoil_physical_price` `commodities_get_palmoil_physical_observations` `calendars_list_holidays` `calendars_get_holidays_on_date` `calendars_get_next_holiday` `economics_get_yield_curve` `economics_get_yield_curve_history` `economics_list_releases` `economics_get_release` `commodities_get_spot_price` `economics_read_series_observations` `predictions_list_topics` `predictions_get_topic` `predictions_list_events` `predictions_get_scalar` `predictions_get_scalar_history` `predictions_get_extreme` `predictions_get_extreme_history` `predictions_get_timing` `predictions_get_timing_history` `predictions_get_binary` `predictions_get_binary_history` `predictions_get_policy_path` `predictions_get_policy_path_history` `economics_get_policy_rate` `economics_get_policy_rate_history` `economics_get_central_bank_reserves` `economics_get_central_bank_balance_sheet` `calendars_get_exchange_closures` `calendars_get_exchange_status` `calendars_list_exchanges` `calendars_get_business_days` `economics_get_population_history` `economics_get_regional_cpi` `economics_get_regional_gdp` `calendars_convert_dates` `calendars_find_dates` `calendars_get_hijri_year` `economics_get_equity_risk_premium` `economics_get_equity_risk_premium_history` `economics_list_equity_risk_premium` `economics_get_rate_decisions` `economics_get_industrial_production` `economics_get_industrial_production_history` `economics_get_retail_sales` `economics_get_retail_sales_history` `economics_get_producer_prices` `economics_get_producer_prices_history` `economics_get_harmonised_inflation` `economics_get_harmonised_inflation_history` `economics_list_series` `economics_get_current_account` `economics_get_current_account_history` `economics_get_money_supply` `economics_get_money_supply_history` `equities` `economics_get_credit_rating` `economics_list_credit_ratings` `economics_get_inflation_calculator` `economics_get_country_profile` `fx_list_currencies` `economics_get_reference_rates` `predictions_list_accuracy` `predictions_get_accuracy` `economics_get_forecasts` `trade_list_hs_codes` `trade_get_hs_code` `trade_get_coverage` `trade_get_partners` `trade_get_products` `trade_get_product` `trade_get_flows` `filings_search_companies` `filings_get_company` `filings_get_financials` `filings_list_company_filings` `filings_get_filing` `filings_list_latest_filings` `filings_list_holders` `filings_get_as_reported` `filings_screen_companies` `filings_get_screen_filters` `filings_search_line_items` `filings_get_sections` `filings_get_company_sections` `filings_list_section_items` `filings_list_institutional_holders` `filings_list_investor_holdings` `filings_search_investors` `filings_list_investor_filings` `filings_list_fund_holdings` `filings_list_company_funds` `calendars_list_registrations` `filings_list_beneficial_owners` `filings_list_investor_beneficial_ownership` `filings_search_beneficial_ownership_filers` `filings_search_beneficial_ownership_companies` `filings_list_insider_trades` `filings_list_insider_ownership` `filings_list_insider_feed` `filings_list_insider_person_trades` `filings_list_company_insiders` `filings_get_insider_activity` `filings_list_insider_transaction_codes` `filings_list_insider_statements` `funds` `crypto` `company_calendars` `economics_search_catalogue` `economics_read_catalogue_series` `economics_read_catalogue_observations` `economics_read_catalogue_latest_batch` `commodities_get_price_history` `fx_get_rate_bars` `commodities_list_physical_series` `commodities_get_physical_series` `commodities_get_physical_latest` `commodities_get_physical_observations` `events_list` `events_get`

## 監控

A monitor sends a signed JSON event to an HTTPS URL when a new figure arrives. These seven tools create and manage monitors with the same inputs, results and errors as the `/v1/webhooks` routes. They are not read-only, and they take no credit. A monitor needs a public HTTPS URL that your agent or its backend controls. An agent with no endpoint should poll `events_list` instead.

| 工具 | 用途 |
| --- | --- |
| `monitors_create` | 根據網址、國家和系列建立監控器。簽章密鑰只回傳一次。 |
| `monitors_list` | 列出帳戶的監控器，以及可啟用的數量。 |
| `monitors_update` | 暫停或恢復監控器，或更改其網址、國家或系列。未提供的內容保持不變。 |
| `monitors_delete` | 刪除監控器。 |
| `monitors_send_test` | 向監控器的網址發送帶簽章的測試事件。 |
| `monitors_list_deliveries` | 列出發送到該網址的內容及每次嘗試的狀態。 |
| `monitors_replay_delivery` | 重新發送之前的投遞。事件 ID 保持不變。 |

The signing secret is shown only in the result of `monitors_create`。The agent must hand it to the user's backend to store. Each event carries `x-narwhal-timestamp` 與 `x-narwhal-signature`; the backend recomputes the HMAC-SHA256 of the timestamp, a dot and the raw body with the secret and compares it with the signature before it trusts the body. The steps are in the [Webhook 參考](https://narwhalapi.com/zh-tw/docs/api/webhooks.md)。An account can keep 25 monitors, and all of them can be enabled. A country that no event of the chosen families can reach is refused, and the error names it. The dashboard lists the countries each release type can fire for. An account created by agent sign-up gets `account_pending` until the user has verified it.

An app sign-in, such as a Claude or ChatGPT connector, cannot manage monitors. The monitor tools are left out of its tool list, and a call answers status 403 with `api_key_required`。使用 API 金鑰的連線可以管理監控器。

監控器只在新數字送達時發送投遞。之後被更改的數字、日期變更和已取消的發布不會發送也不收費。類別為 `gdp`、`prices`、`labour`、`trade`、`policy_rate`、`yield_curve`、`predictions` 和 `filings`，其他類別會被拒絕。監控器只對 Narwhal 為該國家提供的發布觸發。

A release day can produce a calendar event and a data event for one publication. A monitor that matches both gets one delivery: `release.updated` carries the release and, when the values can be read, the data, and the linked `dataset.published` event is not sent to the same monitor when that release carries the figure. Every event type, field and example body is in the [接收 Webhook 指南](https://narwhalapi.com/zh-tw/how-to/receive-webhooks.md)。

## 回報缺少的資料

把您找過但沒有找到的資料告訴 Narwhal。用一句話說明想要的內容：指標、國家或市場，以及期間。免費，每天 20 則。

此工具名為 `report_missing_data`。它不扣額度，也不回傳資料。Narwhal 會閱讀這些回報，以決定新增哪些資料。

回報呼叫

```
{ "name": "report_missing_data",
  "arguments": {
    "wanted": "Monthly palm oil stocks in Sabah for 2025" } }
```

結果為 `{ "status": "recorded" }`。如果狀態為 `already_recorded` ，表示此帳戶今天稍早已送出相同的回報。

| 欄位 | 內容 |
| --- | --- |
| `wanted` | 必填。用一句平實的話說明想要的內容。最多 300 個字元。 |
| `area` | 資料所屬的領域。取以下之一： `calendars` 、 `commodities` 、 `company_calendars` 、 `crypto` 、 `economics` 、 `equities` 、 `events` 、 `filings` 、 `funds` 、 `futures` 、 `fx` 、 `indices` 、 `predictions` 、 `trade` 、 `other`。 |
| `country` | 當資料只涉及一個國家時，填寫 ISO 3166 三字母國家代碼。 |
| `tried` | 您呼叫過但沒有該資料的工具。 |
| `source_url` | 發布該資料的公開網頁。 |

透過應用程式登入（例如 Claude 或 ChatGPT 連接器）無法回報缺少的資料。此工具不會出現在其工具清單中，呼叫時會回傳狀態 403 和以下代碼： `api_key_required`。使用 API 金鑰的連線可以回報。

當工具向使用 API 金鑰的連線回傳 `not_covered` 或表示找不到的代碼時，結果中會多出一行文字： 如果您認為 Narwhal 應該有這項資料，請呼叫 `report_missing_data` 並說明想要的內容。

| 拒絕 | 詳情 |
| --- | --- |
| `429 limit_reached` | 此帳戶今天已送出 20 則回報。請明天再送。 |
| `403 api_key_required` | 無法透過應用程式登入回報缺少的資料。請使用 Narwhal API 金鑰作為 Bearer 權杖連線到此 MCP 伺服器。 |
| `400 invalid_query` | 某個欄位缺少或格式不正確。詳情中會指出該欄位。 |

## 參數和結果

最新發布工具接受 `country`，可選 `period` 以及可選擇取得的 `version_id`。歷史資料工具接受 `country`，可選 `start` 與 `end`，另加 `limit` 與 `cursor` 用於分頁。

工具參數

```
{
  "country": "USA",
  "period": "2026-07"
}
```

| 工具 | 期間 | 其他參數 |
| --- | --- | --- |
| [`economics_get_cpi`](https://narwhalapi.com/zh-tw/docs/api/economics/cpi.md) | `YYYY-MM` | `version_id` |
| [`economics_get_inflation`](https://narwhalapi.com/zh-tw/docs/api/economics/inflation.md) | `YYYY-MM or YYYY-QN` | `version_id` |
| [`economics_get_unemployment`](https://narwhalapi.com/zh-tw/docs/api/economics/unemployment.md) | `YYYY, YYYY-MM, or YYYY-QN` | `version_id` |
| [`economics_get_labour_force_participation`](https://narwhalapi.com/zh-tw/docs/api/economics/labour-force-participation.md) | `YYYY, YYYY-MM, or YYYY-QN` | `version_id` |
| [`economics_get_gdp`](https://narwhalapi.com/zh-tw/docs/api/economics/gdp.md) | `YYYY-QN` | `version_id` |
| [`economics_get_gdp_growth`](https://narwhalapi.com/zh-tw/docs/api/economics/gdp-growth.md) | `YYYY-QN` | `version_id` |
| [`economics_get_trade`](https://narwhalapi.com/zh-tw/docs/api/economics/trade.md) | `YYYY or YYYY-MM` | `version_id` |
| [`economics_get_current_account`](https://narwhalapi.com/zh-tw/docs/api/economics/current-account.md) | `YYYY-QN` | `version_id` |
| [`economics_get_harmonised_inflation`](https://narwhalapi.com/zh-tw/docs/api/economics/harmonised-inflation.md) | `YYYY-MM` | `version_id` |
| [`economics_get_industrial_production`](https://narwhalapi.com/zh-tw/docs/api/economics/industrial-production.md) | `YYYY-MM` | `version_id` |
| [`economics_get_money_supply`](https://narwhalapi.com/zh-tw/docs/api/economics/money-supply.md) | `YYYY-MM` | `version_id` |
| [`economics_get_producer_prices`](https://narwhalapi.com/zh-tw/docs/api/economics/producer-prices.md) | `YYYY-MM` | `version_id` |
| [`economics_get_cpi_history`](https://narwhalapi.com/zh-tw/docs/api/economics/cpi-history.md) | `YYYY-MM` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_inflation_history`](https://narwhalapi.com/zh-tw/docs/api/economics/inflation-history.md) | `YYYY-MM or YYYY-QN` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_unemployment_history`](https://narwhalapi.com/zh-tw/docs/api/economics/unemployment-history.md) | `YYYY-MM or YYYY-QN` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_labour_force_participation_history`](https://narwhalapi.com/zh-tw/docs/api/economics/labour-force-participation-history.md) | `YYYY-MM or YYYY-QN` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_gdp_history`](https://narwhalapi.com/zh-tw/docs/api/economics/gdp-history.md) | `YYYY-QN` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_gdp_growth_history`](https://narwhalapi.com/zh-tw/docs/api/economics/gdp-growth-history.md) | `YYYY-QN` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_trade_history`](https://narwhalapi.com/zh-tw/docs/api/economics/trade-history.md) | `YYYY-MM` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_population_history`](https://narwhalapi.com/zh-tw/docs/api/economics/population-history.md) | `YYYY` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_current_account_history`](https://narwhalapi.com/zh-tw/docs/api/economics/current-account-history.md) | `YYYY-QN` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_harmonised_inflation_history`](https://narwhalapi.com/zh-tw/docs/api/economics/harmonised-inflation-history.md) | `YYYY-MM` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_industrial_production_history`](https://narwhalapi.com/zh-tw/docs/api/economics/industrial-production-history.md) | `YYYY-MM` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_money_supply_history`](https://narwhalapi.com/zh-tw/docs/api/economics/money-supply-history.md) | `YYYY-MM` | `start`、 `end`、 `limit`，以及 `cursor` |
| [`economics_get_producer_prices_history`](https://narwhalapi.com/zh-tw/docs/api/economics/producer-prices-history.md) | `YYYY-MM` | `start`、 `end`、 `limit`，以及 `cursor` |

成功的工具呼叫回傳符合架構的 `structuredContent` ，並將相同的 JSON 序列化為文字一併回傳，以確保用戶端相容性。MCP 問題使用與 REST 相同的公開狀態與代碼。

## 額度扣款規則

初始化與工具探索不收費。每次成功的 `tools/call` 與對應的 REST 呼叫扣除相同的額度，依其 API 的價格計費。一次查詢多個 ID 的工具，每個 ID 計為一次呼叫。

首次 tools/call

```
{
  "method": "tools/call",
  "params": {
    "name": "fx_get_rates",
    "arguments": { "base": "USD", "currencies": ["EUR", "JPY"] }
  }
}
```

每個帳戶每月可免費獲得 10 美元。The limit is 50 requests a minute on free credit and 500 once the account holds paid credit. `X-Narwhal-Cost` 與 `X-Narwhal-Balance` show what a call cost and what is left. 該 `X-RateLimit-*` headers describe your request bucket: Limit is its size (the burst), Remaining is what is left and Reset is when it is full again. It refills at the per-minute rate. Too many requests too fast return `429 rate_limit_exceeded`；餘額不足以支付的呼叫會回傳 `402 insufficient_credits`。

## 故障排查

| 症狀 | 檢查 |
| --- | --- |
| `401 invalid_api_key` | 確認 Bearer 標頭完全正確，且金鑰仍有效。 |
| 連線時發生重新導向 | 請準確使用 `https://api.narwhalapi.com/mcp` ，結尾不可加上斜線。 |
| 工具缺失 | 僅可使用上面列出的公共工具。 |
| 工具回傳問題 | 讀取其結構化的 status、code、detail 及請求 ID。請參閱 [API 錯誤 處理：錯誤碼、額度與重試](https://narwhalapi.com/zh-tw/docs/errors.md)。 |

此頁面對你有幫助嗎?
