浏览全部文档

通过 MCP 服务器连接 Narwhal

通过 MCP 客户端使用同一个 Narwhal 密钥和公开 API 数据结构。

获取免费 API 密钥

Narwhal 提供一个无状态的 Streamable HTTP MCP 端点。它使用与 REST 相同的已启用数据 API、响应结构、身份验证和额度。

连接

将远程服务器 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_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_historyfx_get_ratesfx_get_rate_historyfx_convert_currencycommodities_list_palmoil_physical_seriescommodities_get_palmoil_physical_pricecommodities_get_palmoil_physical_observationscalendars_list_holidayscalendars_get_holidays_on_datecalendars_get_next_holidayeconomics_get_yield_curveeconomics_get_yield_curve_historyeconomics_list_releaseseconomics_get_releasecommodities_get_spot_priceeconomics_read_series_observationspredictions_list_topicspredictions_get_topicpredictions_list_eventspredictions_get_scalarpredictions_get_scalar_historypredictions_get_extremepredictions_get_extreme_historypredictions_get_timingpredictions_get_timing_historypredictions_get_binarypredictions_get_binary_historypredictions_get_policy_pathpredictions_get_policy_path_historyeconomics_get_policy_rateeconomics_get_policy_rate_historyeconomics_get_central_bank_reserveseconomics_get_central_bank_balance_sheetcalendars_get_exchange_closurescalendars_get_exchange_statuscalendars_list_exchangescalendars_get_business_dayseconomics_get_population_historyeconomics_get_regional_cpieconomics_get_regional_gdpcalendars_convert_datescalendars_find_datescalendars_get_hijri_yeareconomics_get_equity_risk_premiumeconomics_get_equity_risk_premium_historyeconomics_list_equity_risk_premiumeconomics_get_rate_decisionseconomics_get_industrial_productioneconomics_get_industrial_production_historyeconomics_get_retail_saleseconomics_get_retail_sales_historyeconomics_get_producer_priceseconomics_get_producer_prices_historyeconomics_get_harmonised_inflationeconomics_get_harmonised_inflation_historyeconomics_list_serieseconomics_get_current_accounteconomics_get_current_account_historyeconomics_get_money_supplyeconomics_get_money_supply_historyequitieseconomics_get_credit_ratingeconomics_list_credit_ratingseconomics_get_inflation_calculatoreconomics_get_country_profilefx_list_currencieseconomics_get_reference_ratespredictions_list_accuracypredictions_get_accuracyeconomics_get_forecaststrade_list_hs_codestrade_get_hs_codetrade_get_coveragetrade_get_partnerstrade_get_productstrade_get_producttrade_get_flowsfilings_search_companiesfilings_get_companyfilings_get_financialsfilings_list_company_filingsfilings_get_filingfilings_list_latest_filingsfilings_list_holdersfilings_get_as_reportedfilings_screen_companiesfilings_get_screen_filtersfilings_search_line_itemsfilings_get_sectionsfilings_get_company_sectionsfilings_list_section_itemsfilings_list_institutional_holdersfilings_list_investor_holdingsfilings_search_investorsfilings_list_investor_filingsfilings_list_fund_holdingsfilings_list_company_fundscalendars_list_registrationsfilings_list_beneficial_ownersfilings_list_investor_beneficial_ownershipfilings_search_beneficial_ownership_filersfilings_search_beneficial_ownership_companiesfilings_list_insider_tradesfilings_list_insider_ownershipfilings_list_insider_feedfilings_list_insider_person_tradesfilings_list_company_insidersfilings_get_insider_activityfilings_list_insider_transaction_codesfilings_list_insider_statementsfundscryptocompany_calendarseconomics_search_catalogueeconomics_read_catalogue_serieseconomics_read_catalogue_observationseconomics_read_catalogue_latest_batchcommodities_get_price_historyfx_get_rate_barscommodities_list_physical_seriescommodities_get_physical_seriescommodities_get_physical_latestcommodities_get_physical_observationsevents_listevents_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 参考。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 指南。

报告缺失数据

把您查找过但没有找到的数据告诉 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_cpiYYYY-MMversion_id
economics_get_inflationYYYY-MM or YYYY-QNversion_id
economics_get_unemploymentYYYY, YYYY-MM, or YYYY-QNversion_id
economics_get_labour_force_participationYYYY, YYYY-MM, or YYYY-QNversion_id
economics_get_gdpYYYY-QNversion_id
economics_get_gdp_growthYYYY-QNversion_id
economics_get_tradeYYYY or YYYY-MMversion_id
economics_get_current_accountYYYY-QNversion_id
economics_get_harmonised_inflationYYYY-MMversion_id
economics_get_industrial_productionYYYY-MMversion_id
economics_get_money_supplyYYYY-MMversion_id
economics_get_producer_pricesYYYY-MMversion_id
economics_get_cpi_historyYYYY-MMstart、 end、 limit,以及 cursor
economics_get_inflation_historyYYYY-MM or YYYY-QNstart、 end、 limit,以及 cursor
economics_get_unemployment_historyYYYY-MM or YYYY-QNstart、 end、 limit,以及 cursor
economics_get_labour_force_participation_historyYYYY-MM or YYYY-QNstart、 end、 limit,以及 cursor
economics_get_gdp_historyYYYY-QNstart、 end、 limit,以及 cursor
economics_get_gdp_growth_historyYYYY-QNstart、 end、 limit,以及 cursor
economics_get_trade_historyYYYY-MMstart、 end、 limit,以及 cursor
economics_get_population_historyYYYYstart、 end、 limit,以及 cursor
economics_get_current_account_historyYYYY-QNstart、 end、 limit,以及 cursor
economics_get_harmonised_inflation_historyYYYY-MMstart、 end、 limit,以及 cursor
economics_get_industrial_production_historyYYYY-MMstart、 end、 limit,以及 cursor
economics_get_money_supply_historyYYYY-MMstart、 end、 limit,以及 cursor
economics_get_producer_prices_historyYYYY-MMstart、 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 不带结尾斜杠。
工具缺失仅可使用上面列出的公共工具。
工具返回错误读取结构化状态、代码、详情和请求 ID。参见 API 错误码与额度。

此页面对你有帮助吗?