MCP経由で接続
MCP クライアントから同じ Narwhal キーと公開 API スキーマを使用します。
Narwhal は、ステートレスな Streamable HTTP MCP エンドポイントを1つ提供します。REST と同じ有効なデータ API、レスポンススキーマ、認証、クォータを使用します。
接続
認証済みStreamable HTTPに対応するMCPクライアントへ、リモートサーバーURLとBearerヘッダーを追加します。
{
"url": "https://api.narwhalapi.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_NARWHAL_API_KEY"
}
}これは各フィールドの対応を示す例であり、そのまま貼り付けて使うファイルではありません。 YOUR_NARWHAL_API_KEY を、クライアントの安全なシークレット設定で置き換えてください。JSON 自体にシェル変数を展開する機能はなく、MCP クライアントごとに環境変数の構文も異なります。
実際のキーを共有設定ファイルに貼り付けないでください。
利用可能なツール
tools/list は、このリリースプロファイルで有効な公開の読み取り専用ツールを返します。以下は公開ツールの一覧であり、すべてのソースがすべての入力に対する値を持つことを保証するものではありません。
economics_get_cpieconomics_get_inflationeconomics_get_unemploymenteconomics_get_labour_force_participationeconomics_get_gdpeconomics_get_gdp_growtheconomics_get_tradeeconomics_get_cpi_historyeconomics_get_inflation_historyeconomics_get_unemployment_historyeconomics_get_labour_force_participation_historyeconomics_get_gdp_historyeconomics_get_gdp_growth_historyeconomics_get_trade_historyeconomics_read_series_observationsfx_get_ratesfx_get_rate_historyfx_convert_currencyfx_get_rate_barscommodities_get_spot_pricecommodities_get_price_historycommodities_list_palmoil_physical_seriescommodities_get_palmoil_physical_pricecommodities_get_palmoil_physical_observationscommodities_list_physical_seriescommodities_get_physical_seriescommodities_get_physical_latestcommodities_get_physical_observationseconomics_list_releaseseconomics_get_releaseevents_listevents_getpredictions_list_topicspredictions_get_topicpredictions_list_eventspredictions_get_scalarpredictions_get_extremepredictions_get_timingpredictions_get_binarypredictions_get_scalar_historypredictions_get_extreme_historypredictions_get_timing_historypredictions_get_binary_historypredictions_get_policy_pathpredictions_get_policy_path_historycalendars_list_holidayscalendars_get_holidays_on_datecalendars_get_next_holidayeconomics_get_yield_curveeconomics_get_yield_curve_history引数と結果
最新リリースツールは次を受け付けます: country、任意 period および任意で取得できる version_id。履歴ツールは country、任意 start および end、さらに limit および cursor はページ分割に使用します。
{
"country": "USA",
"period": "2026-07"
}| ツール | 期間 | その他の引数 |
|---|---|---|
economics_get_cpi | YYYY-MM | version_id |
economics_get_inflation | YYYY-MM | version_id |
economics_get_unemployment | YYYY, YYYY-MM, or YYYY-QN | version_id |
economics_get_labour_force_participation | YYYY, YYYY-MM, or YYYY-QN | version_id |
economics_get_gdp | YYYY-QN | version_id |
economics_get_gdp_growth | YYYY-QN | version_id |
economics_get_trade | YYYY or YYYY-MM | version_id |
economics_get_cpi_history | YYYY-MM | start, end, limit、および cursor |
economics_get_inflation_history | YYYY-MM | start, end, limit、および cursor |
economics_get_unemployment_history | YYYY, YYYY-MM, or YYYY-QN | start, end, limit、および cursor |
economics_get_labour_force_participation_history | YYYY, YYYY-MM, or YYYY-QN | start, end, limit、および cursor |
economics_get_gdp_history | YYYY-QN | start, end, limit、および cursor |
economics_get_gdp_growth_history | YYYY-QN | start, end, limit、および cursor |
economics_get_trade_history | YYYY-MM | start, end, limit、および cursor |
成功したツール呼び出しが返すのは、スキーマに適合した structuredContent と、クライアントとの互換性のために同じ JSON をテキストにシリアライズしたものです。MCP のエラーは、REST と共通の公開ステータスとコードを使用します。
クォータの動作
初期化とツールの検出はデータクォータを消費しません。成功した各 tools/call は、成功した REST 呼び出し1回と同じく、リクエストを正確に1件消費します。
{
"method": "tools/call",
"params": {
"name": "fx_get_rates",
"arguments": { "base": "USD", "currencies": ["EUR", "JPY"] }
}
}Free ベータ版の上限は 5,000 件の成功リクエスト(UTC の暦月単位)、および 毎分30リクエストです。クォータの状態を返すヘッダーは X-RateLimit-Limit, X-RateLimit-Remaining、および X-RateLimit-Resetです。短時間枠の状態を返すヘッダーは X-RateLimit-Short-Limit, X-RateLimit-Short-Remaining、および X-RateLimit-Short-Resetです。短時間枠でのリクエスト制限時に返されるのは 429 rate_limit_exceededです。月間クォータを使い切った場合に返されるのは 429 quota_exhausted。
トラブルシューティング
| 症状 | 確認 |
|---|---|
401 invalid_api_key | 正確なBearerヘッダーと、キーが有効なままかを確認します。 |
| 接続時にリダイレクトされる | 正確に使用: https://api.narwhalapi.com/mcp (末尾のスラッシュなし)。 |
| ツールがありません | 利用できるのは、上記に記載した公開ツールだけです。 |
| ツールがエラーを返す | 構造化された status、code、detail とリクエスト ID を確認します。参照先: エラーとクォータ。 |
ドキュメント