# REST Countries Alternative MCP

> REST Countries Alternative MCP Server accesses global data points for any nation, including capitals, currencies, languages, and political status. This server lets your agent query geographic and economic facts using natural language prompts. You can filter countries by continent (`filter_by_region`), find nations based on their currency or official code, or search results using translated names. It's a powerful reference layer for geo-data.

## Overview
- **Category:** data-management
- **Price:** Free
- **Tags:** geography, country-data, demographics, international-codes, currency-data, rest-api

## Description

You're connecting your AI agent to a massive global database using this MCP server, and it handles all the tricky country data for you. Your client can pull specific geographic, economic, or political facts about any nation without needing dozens of separate API calls. You just talk to it like you'd talk to me on the corner—it’ll figure out what you want.

### Filtering Data Down to What Matters

Filtering is where this thing shines. If you only care about a specific type of country, you can narrow the results immediately. To check political status, use `filter_by_independent` to pull lists containing only nations designated as independent. For geography, you've got options: you can limit your search using `filter_by_region` for major continental groups like Asia or Africa. If that’s too broad, you can drill down further by calling `filter_by_subregion`, which lets you focus on specific clusters, say, Oceania or Latin America.

### Targeted Searches and Deep Queries

Need to find something specific? You don't have to guess. The server gives you several ways to zero in on data points. If you know a capital city name, use `search_by_capital` to pull up the corresponding country records. Want to check a nation by its standard code—like 'USA'? Just pass that through `search_by_code`. It’s also got tools for broader searches: run `search_by_name` to look up countries using their common official name, or if you're dealing with alternate names, use `search_by_translation` to find a country by its translated title in another language. 

To pull data based on demographics or culture, your agent can search for nations that speak a specific language using `search_by_language`, or locate countries by their common citizen name—what they call the demonym—with `search_by_demonym`. If you're tracking trade or currency, use `search_by_currency` to find every country that uses a certain money type (like 'EUR'). You can also pull up nations using an ISO code through `search_by_codes`, which lets your agent retrieve data for multiple countries in one go.

### Bulk and Comprehensive Data Retrieval

When you need the whole picture, this server delivers. If you want to map out every nation available, run `get_all_countries`. Keep this in mind: you gotta specify exactly which 10 fields you want when running that tool; otherwise, it'll throw an error for sure. When your query needs data from multiple sources at once—say, finding a country by both its code and its currency—you can combine calls using `search_by_codes` to handle several nations simultaneously.

This setup means you don’t need five different APIs; you just send one prompt through your AI client. It runs the necessary tool, pulls the specific data set, and hands it back formatted and ready to use.

## Tools

### get_all_countries
Retrieves information for all countries in the database; you must specify which 10 fields you want.

### search_by_capital
Finds countries based on a known capital city name.

### search_by_code
Searches for country data using its standard national code (like 'USA').

### search_by_codes
Retrieves data for multiple countries at once by providing a list of their codes.

### search_by_currency
Finds all countries that use a specific currency, given its name or code (e.g., 'EUR').

### search_by_demonym
Searches for countries based on the common name of their citizens (the demonym).

### filter_by_independent
Narrows down search results to include only nations that are marked as independent.

### search_by_language
Locates countries using a specific language, given its code or full name.

### search_by_name
Finds countries by their common official name (e.g., 'Canada').

### filter_by_region
Limits the dataset to countries located within a major continent (e.g., Africa, Asia).

### filter_by_subregion
Further narrows results by specific geographic subregions (e.g., Northern Europe, Latin America).

### search_by_translation
Searches for a country using its translated or alternate name in another language.

## Prompt Examples

**Prompt:** 
```
Search for the country named 'Brazil' and show its capital and population.
```

**Response:** 
```
I found Brazil! Its capital is Brasília and it has a population of approximately 212 million people. Would you like to see its neighboring countries as well?
```

**Prompt:** 
```
List all countries located in the 'South America' subregion.
```

**Response:** 
```
I've filtered the data for South America. There are 12 independent countries and several territories in this subregion, including Argentina, Brazil, Chile, and Colombia. Do you need details on a specific one?
```

**Prompt:** 
```
Which countries use the 'Japanese Yen' as their currency?
```

**Response:** 
```
The Japanese Yen (JPY) is the official currency of Japan. It is one of the most traded currencies in the world. Would you like to see more economic data for Japan?
```

## Capabilities

### Filter by political status
Use `filter_by_independent` to narrow down lists of nations based on their current independence designation.

### Group by continent or subregion
Limit search results using `filter_by_region` and `filter_by_subregion` to focus only on specific geographical clusters (e.g., Oceania, Northern Europe).

### Search multiple countries at once
Run `search_by_codes` to retrieve data for several nations simultaneously using their ISO codes.

### Find by specific attribute
Execute targeted searches, such as finding all countries that use the Euro or speaking Mandarin Chinese, using tools like `search_by_currency` or `search_by_language`.

### Bulk data retrieval
Run `get_all_countries` to pull metadata for every nation in the database. You must specify exactly which fields you want (up to 10) to avoid errors.

## Use Cases

### Checking trade partners by currency.
A financial analyst needs to list all countries that accept the Brazilian Real (BRL). They ask their agent, which uses `search_by_currency`. The agent returns a clean list of nations and their respective codes, allowing the analyst to immediately cross-reference this data in a spreadsheet.

### Mapping regional political boundaries.
A geopolitical consultant needs to compare three specific states: one from Northern Europe and two from South America. They use `filter_by_subregion` twice, combined with the general search tools, ensuring they only pull data for countries that are also marked as independent via `filter_by_independent`.

### Validating a client list of country codes.
A developer gets a spreadsheet full of ambiguous 3-letter codes. Rather than hitting the API twelve times, they use `search_by_codes`. This tool runs once and confirms which countries are valid, flagging any bad data points immediately.

### Building an educational quiz on global facts.
An educator needs to generate questions that test knowledge of both language and capital. They use `search_by_language` (to find all countries using Arabic) and then pair the results with `search_by_capital` to pull a list of unique capitals for the quiz.

## Benefits

- Get granular detail by using `search_by_capital`. Instead of guessing, you simply tell your agent the capital city and get back the full country profile.
- Don't manually check codes. Use `search_by_codes` to pull data for five different countries in one call. It saves time when comparing multiple nations.
- Need a regional breakdown? Combine `filter_by_region` (to narrow it down) with `filter_by_subregion` (for precision). This lets you analyze geographic groups without messy manual filtering.
- Verify languages and money sources instantly. Tools like `search_by_currency` let you check which countries use the Yen or Euro, eliminating guesswork in financial modeling.
- Handle name variations easily. If a country is called 'Brazil' in one place but has an official translated name elsewhere, `search_by_translation` finds it for you.

## How It Works

The bottom line is: You ask for world facts in plain English, and the server runs the specific API calls needed to deliver the answer.

1. Subscribe to the REST Countries Alternative server and connect your AI client.
2. Prompt your agent with a natural language query (e.g., 'What countries use the Yen?').
3. The agent executes one or more tools—like `search_by_currency`—and presents you with the structured data.

## Frequently Asked Questions

**How do I find countries by their continent?**
You use `filter_by_region`. Just tell your agent which region you want (e.g., 'Asia') and it filters the data for you.

**Can I search for multiple countries using the search_by_codes tool?**
Yes, use `search_by_codes`. This function lets you input a list of codes (e.g., ['USA', 'CAN']) and get data back for every country in that batch.

**What if the name I use is translated?**
Don't worry about translations; use `search_by_translation`. It finds countries even when you provide their alternate or foreign-language names.

**Do I need to specify fields when calling get_all_countries?**
Yes, you must. The tool requires you to list the specific 10 fields (like 'population' and 'currency') you actually want back to prevent a bad API request.

**Does running a query using the `search_by_name` tool require an API key or token?**
No, you don't need to worry about tokens. This is a public API, so no specific credential is required. If the server prompts for authentication, enter 'public'.

**What happens if I run `get_all_countries` without specifying fields?**
The request will fail with a 400 Bad Request error. You must specify which data points you need—you can select up to ten specific fields.

**Can the `search_by_currency` tool handle both codes and full names?**
Yes, it supports both methods. You can search by a standard three-letter code (like EUR) or by typing out the currency's full name.

**How do I use `search_by_demonym` to find country data?**
You simply ask your agent for the demonym. The tool searches for countries that share a specific common designation among their citizens.

**How do I retrieve a list of all countries with specific data points?**
Use the `get_all_countries` tool. You must provide a comma-separated list in the `fields` parameter (e.g., 'name,capital,population') to specify exactly which information you want to receive.

**Can I find countries based on the currency they use?**
Yes! Use the `search_by_currency` tool and provide the currency name or code (like 'euro' or 'USD'). The agent will return all countries where that currency is legal tender.

**Is it possible to filter countries by their geographic region?**
Absolutely. Use the `filter_by_region` tool with values like 'Europe', 'Americas', 'Asia', 'Africa', or 'Oceania' to get a list of countries in that specific part of the world.