# UK ONS Trade MCP

> UK ONS Trade — International Trade & Business Activity provides three specialized datasets from the UK Office for National Statistics (ONS). You can retrieve monthly trade figures—imports, exports, and balance by country/commodity using `get_trade`. It also pulls business counts from the IDBR register, showing enterprises grouped by industry and region via `get_business_counts`. Finally, it includes experimental real-time economic signals from traffic camera activity through `get_traffic_activity`.

## Overview
- **Category:** erp-operations
- **Price:** Free
- **Tags:** international-trade, import-export, business-counts, supply-chain-data, economic-indicators

## Description

This MCP Server connects your agent directly to three core economic datasets from the UK Office for National Statistics (ONS). You'll use this server when you need to model macroeconomics by combining official trade figures, structured business counts, and real-time local movement indicators. It gives you a centralized way to crunch numbers on British economic activity without ever leaving your chat window.

**Analyzing Trade Balances with `get_trade`**

When you call the `get_trade` tool, you get monthly goods trade data for the UK. This dataset specifies imports, exports, and the total balance for specific commodities and partner countries. You can use these figures to calculate the net balance—the difference between what's coming in and what's going out—for any combination of commodity and nation over time. The tool details this flow by providing metrics on both imported goods and exported goods against a specified country or product category, allowing you to map how trade patterns change month-to-month.

**Mapping Business Density with `get_business_counts`**

The `get_business_counts` tool pulls active business data from the IDBR register. It returns an actual count of active UK businesses that you can segment across two dimensions: industry type and local administrative units. This means you don't just get a total number; you figure out *where* the businesses are clustered and *what kind* of businesses they are. For example, you can map how many finance firms operate in London versus manufacturing firms operating in Manchester. It gives you granular density metrics by combining sector classification with specific geographic areas across England.

**Assessing Real-Time Economic Indicators with `get_traffic_activity`**

Calling the `get_traffic_activity` tool delivers experimental, real-time indicators derived from traffic camera data. This isn't standard historical data; it provides a live gauge of local economic or social shifts based on movement patterns in specific areas. You use this to track immediate activity levels—it’s useful for seeing if foot traffic or vehicle flow changes drastically day over day. Because these are experimental indicators, you interpret the metrics as immediate signals of current momentum rather than stable historical averages.

You'll combine these data points easily: you can cross-reference a region with high business counts (using `get_business_counts`) against its recent trade balance changes (from `get_trade`), and then overlay that analysis with real-time activity indicators (via `get_traffic_activity`). It helps you build models that connect the big picture—national commodity flows—to micro-level data, like a specific business sector's performance or daily movement in a single neighborhood. You can analyze how local economic signals correlate with international trade trends.

## Tools

### get_trade
Provides monthly goods trade data for the UK, detailing imports, exports, and the total balance by commodity and partner country.

### get_business_counts
Returns the count of active UK businesses, segmented by industry type and local administrative units using IDBR data.

### get_traffic_activity
Delivers experimental, real-time indicators derived from traffic camera activity to gauge local economic or social shifts.

## Prompt Examples

**Prompt:** 
```
What are UK trade figures with the EU?
```

**Response:** 
```
📊 **UK Trade with EU (Latest)**

Exports to EU: £14.2 billion
Imports from EU: £22.8 billion
Trade deficit: -£8.6 billion

Top exports: machinery, vehicles, chemicals
Top imports: vehicles, food, machinery

Source: ONS, trade dataset
```

**Prompt:** 
```
What were the UK's top exports to the US last year?
```

**Response:** 
```
According to ONS trade commodity datasets, the UK's top exports to the United States include medicinal and pharmaceutical products, mechanical power generators, and cars/vehicles.
```

**Prompt:** 
```
How many active IT businesses are registered in London?
```

**Response:** 
```
Based on the Inter-Departmental Business Register (IDBR) counts, there are approximately 58,000 active enterprises classified within the Information and Communication sector in the London region.
```

## Capabilities

### Analyze trade balances by commodity and nation
Retrieves monthly UK goods trade data, allowing you to calculate the net balance of imports versus exports for specific countries or commodities.

### Map business density by sector and region
Generates a count of active enterprises across the UK, segmenting results by industry type and local administrative area.

### Assess real-time economic indicators
Pulls experimental traffic camera data to give you an indicator of current movement or activity levels in specific areas.

## Use Cases

### Assessing post-pandemic recovery in manufacturing.
A consultant needs to know if trade deficits are being offset by local growth. They ask the agent: 'Show me the trend of machinery exports (`get_trade`) compared to the number of manufacturing businesses registered in key areas (`get_business_counts`).' The system delivers a combined view, showing that while export volumes stabilized, business density lagged behind.

### Understanding supply chain risk in a specific corridor.
A logistics manager is worried about congestion impacting goods flow. They use the agent to run `get_traffic_activity` for a key motorway and compare the current readings against historical trade spikes (`get_trade`) to predict potential bottlenecks that could derail shipments.

### Validating market entry theory in a new region.
A corporate strategy team wants to know if high business density predicts increased foreign trade. They use `get_business_counts` for several industrial hubs and cross-reference the results with specific commodities' import/export data from `get_trade`.

### Modeling immediate economic impact of a local event.
An urban planner wants to see if a new subway line is changing commerce. They use `get_traffic_activity` before and after the line's opening, then compare those changes against the subsequent growth in commercial businesses reported by `get_business_counts`.

## Benefits

- Connect national metrics to local reality. You don't just get a total trade deficit from `get_trade`; you can cross-reference that with regional business health data using `get_business_counts` to pinpoint where the problem starts.
- Stop relying on stale reports. The combination of historical `get_trade` figures and real-time traffic indicators from `get_traffic_activity` lets you model how current activity might affect future trade volumes.
- Speed up deep research. Instead of downloading three separate Excel sheets (one for trade, one for business, one for traffic), your AI client runs all the necessary tools—`get_trade`, `get_business_counts`, and `get_traffic_activity`—in a single query.
- Benchmark industry strength. Use `get_business_counts` to compare how many financial services firms are in London versus Manchester, giving you immediate data points for market reports.
- Calculate the full picture of movement. You can assess not only what is shipped (via `get_trade`) but also the supporting local activity that drives it by running a query against `get_traffic_activity`.

## How It Works

The bottom line is: you get complex, official UK economic statistics instantly, without having to navigate multiple government websites or manually process spreadsheet downloads.

1. Tell your AI client which combination of variables you need (e.g., 'UK exports to Germany for machinery').
2. Your agent calls the appropriate tool, like `get_trade` or `get_business_counts`, sending it structured parameters.
3. The server pulls and formats the raw ONS data, returning clean metrics directly into your conversation.

## Frequently Asked Questions

**How do I use the get_business_counts tool?**
To run this, specify the desired industry sector and geographical region. For example: 'Get business counts for the finance sector in London.' It uses IDBR data to provide an accurate count.

**What kind of data does get_trade handle?**
`get_trade` handles goods trade, specifically imports and exports. You must define a commodity (like 'vehicles') and the partner country to get meaningful results. It uses monthly figures in £ million.

**Can I use get_traffic_activity for future planning?**
The data is experimental, but it's designed as a real-time indicator of economic activity. You can model how current movement correlates with historical trade spikes from `get_trade` to inform your projections.

**Do I need all three tools for one analysis?**
No, you only call the tool(s) relevant to your question. If you just want business density, stick to `get_business_counts`. Don't try to run trade queries if you don't specify a country and commodity.

**When using get_trade, what parameters do I specify if I need data for a date range other than monthly?**
You must provide specific year and month values in your input request. The tool pulls non-seasonally adjusted monthly reports only; it cannot generate quarterly or annual summaries directly.

**Can get_business_counts retrieve enterprise data for regions outside the UK?**
No, this function is restricted to using the Inter-Departmental Business Register (IDBR). You can only pull official business counts specific to local units within the United Kingdom.

**What should I do if I run into a rate limit error while calling get_traffic_activity?**
Wait a short period and retry your request. We recommend implementing an exponential backoff strategy in your agent code to manage high-volume calls.

**How is the data structured when I call get_trade for commodity and country flows?**
The output is a structured JSON array. It includes distinct fields for the partner country, specific commodity codes, and whether the recorded value represents an import or export.

**What is the IDBR?**
The Inter-Departmental Business Register (IDBR) is a comprehensive list of UK businesses used for all government statistical surveys. It covers 2.7 million+ live enterprises across all sectors.

**Does this cover both goods and services?**
Currently, the primary datasets focus extensively on the trade in goods by commodity and country. Trade in services data is also available but categorized separately in larger macroeconomic releases.

**What kind of traffic activity data is available?**
The ONS provides experimental real-time indicators compiled from traffic camera activity, which measure vehicle counts and traffic movement as a proxy for economic and supply chain activity.