Browse all documentation

Give Claude Code economic data

Claude Code can request Narwhal data through one hosted MCP connection, and each successful tool call uses one request. Add a Bearer key to connect the terminal agent to economic indicators, currency rates and the other live tool groups. For the web or Desktop client, use the separate [Claude app](/docs/mcp/claude-app) instructions.

Quick start

  1. Get a free key from https://narwhalapi.com/signup and export it as NARWHAL_API_KEY.
  2. Run the add command with --scope user, HTTP transport and an Authorization header for access across all projects.
  3. Check the connection with claude mcp list, claude mcp get narwhal or /mcp inside a session.

MCP configuration

The add command uses --scope user to register the HTTP endpoint and Bearer header for all projects. With --scope project, Claude Code writes a shared .mcp.json entry, which must include "type": "http"; an entry with a URL but no type is skipped.

Terminal
claude mcp add --scope user --transport http narwhal https://api.narwhalapi.com/mcp \
  --header 'Authorization: Bearer ${NARWHAL_API_KEY}'
.mcp.json
{
  "mcpServers": {
    "narwhal": {
      "type": "http",
      "url": "https://api.narwhalapi.com/mcp",
      "headers": {
        "Authorization": "Bearer ${NARWHAL_API_KEY}"
      }
    }
  }
}

Claude Code expands ${NARWHAL_API_KEY} in headers, so keep the actual key in the environment before connecting. Servers from a shared .mcp.json need approval in an interactive session.

Tools you get

Claude Code gets all these read-only tool groups through the same connection. Initialization and tool discovery use no quota; each successful tool call uses one request from the quota shared with REST.

GroupWhat you can ask forTools
Economic indicatorsAsk for CPI, inflation, unemployment, labour force participation, GDP, GDP growth and trade by country; coverage differs by indicator.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 economics_read_series_observations
Currency ratesAsk for current exchange rates, historical rates, currency conversions and rate bars for a currency pair.fx_get_rates fx_get_rate_history fx_convert_currency fx_get_rate_bars
Commodity pricesAsk for spot prices for gold, silver, platinum, palladium, copper, WTI crude oil, and Brent crude oil, their price history, and physical palm oil prices (crude palm oil and fresh fruit bunches).commodities_get_spot_price commodities_get_price_history commodities_list_palmoil_physical_series commodities_get_palmoil_physical_price commodities_get_palmoil_physical_observations commodities_list_physical_series commodities_get_physical_series commodities_get_physical_latest commodities_get_physical_observations
Releases and eventsAsk for official economic release dates and event details before you plan a country briefing.economics_list_releases economics_get_release events_list events_get
Public holidaysAsk for public holidays by country, holidays on a particular date or the next holiday.calendars_list_holidays calendars_get_holidays_on_date calendars_get_next_holiday
Prediction market oddsAsk for prediction market topics and events with scalar, extreme, timing and binary outcomes, their history, and policy paths by authority.predictions_list_topics predictions_get_topic predictions_list_events predictions_get_scalar predictions_get_extreme predictions_get_timing predictions_get_binary predictions_get_scalar_history predictions_get_extreme_history predictions_get_timing_history predictions_get_binary_history predictions_get_policy_path predictions_get_policy_path_history
Government bond yieldsAsk for government bond yield curves for the US, the UK, Germany, Japan, and Canada through the same Narwhal connection.economics_get_yield_curve economics_get_yield_curve_history

Example prompts

  • Get the latest inflation value for the United States.
  • Show the available history for the USD/IDR exchange rate.
  • Convert GBP to USD using the current GBP/USD exchange rate.
  • Find the next official CPI release date for the United States.
  • Get the available palm oil price history.

Common workflows

Prepare a United States economic briefing

What is the latest United States inflation value? Ask economics_get_inflation for the country to get the reported percentage changes.

Check exchange rates during development

fx_get_rate_history takes USD as the base, ["IDR"] as the quote currencies list, start_date set to 2026-09-01 and end_date set to 2026-09-07 for historical exchange rate observations.

Review palm oil price history

Choose a palm oil series with commodities_list_palmoil_physical_series. Pass its series ID to commodities_get_palmoil_physical_observations for observations by native period, with start and end supplied together if you specify a range.

Check the next United States CPI release

Before a meeting, call economics_list_releases with the United States and a date window of up to 366 days to find official CPI release dates.

Tips

  • Keep the terminal environment available to Claude Code before you add or connect the server; an unset variable sends its literal reference and produces a warning.
  • Use /mcp to distinguish Connected, Needs authentication and Failed to connect before changing your configuration.
  • Choose --scope user when you want the same connection across projects, or --scope project when the configuration belongs with the project.
  • Use the exact URL https://api.narwhalapi.com/mcp because redirects from a trailing slash break some clients.

FAQ

How do I give Claude Code access to economic data?

Add Narwhal as an HTTP MCP server with an Authorization Bearer header. Export your key as NARWHAL_API_KEY, connect the server and ask for a country indicator or historical series.

Does Claude Code share my REST quota?

Yes, REST and MCP use the same account, API key and quota. The free plan has 5,000 successful requests per UTC month and a short-window limit of 30 requests per minute.

Can I put the project configuration in version control?

Yes, share the .mcp.json configuration with an environment variable reference in the header. Keep the actual key out of the file, prompts and URLs, then run claude interactively and approve the project server.

Troubleshooting

SymptomCheck
Narwhal does not appear in the server listInspect the .mcp.json entry for "type": "http", then check claude mcp get narwhal and the selected scope.
The server stays at Pending approvalRun claude interactively and approve the project server from .mcp.json.
The connection fails with 401 invalid_api_keyInspect claude mcp get narwhal and check that NARWHAL_API_KEY is exported in the shell that starts Claude Code. Narwhal returns 401 invalid_api_key for a wrong or inactive key.
A tool call returns a 429 errorCheck whether the code is rate_limit_exceeded or quota_exhausted, then follow errors and quota.