MCP Server
Connect any AI assistant to countries.dev through the Model Context Protocol. A hosted, no-key MCP endpoint that exposes country, city, postal-code, distance and IP-geolocation tools over Streamable HTTP.
countries.dev runs a hosted MCP server, so AI assistants like Claude, Cursor and ChatGPT can query country and geographic data directly — no API key, no install, no local process.
Endpoint
https://countries.dev/api/mcpIt speaks the Streamable HTTP transport (MCP spec 2025-06-18, with 2025-03-26 and 2024-11-05 negotiated for older clients). It's stateless and read-only — point any MCP client at the URL and the tools appear.
Connect your client
claude mcp add --transport http countries https://countries.dev/api/mcpAdd to ~/.cursor/mcp.json (or a project's .cursor/mcp.json):
{
"mcpServers": {
"countries": { "url": "https://countries.dev/api/mcp" }
}
}Settings → Connectors → Add custom connector, then paste the URL:
https://countries.dev/api/mcpFor older builds that only speak stdio, bridge with mcp-remote:
{
"mcpServers": {
"countries": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://countries.dev/api/mcp"]
}
}
}In Settings → Connectors → Add, choose a custom MCP server and enter:
https://countries.dev/api/mcpAny client that follows the standard mcpServers schema:
{
"mcpServers": {
"countries": {
"type": "http",
"url": "https://countries.dev/api/mcp"
}
}
}Tools
| Tool | What it does |
|---|---|
get_country | Record for one country by ISO code or name. |
list_countries | List or filter countries by region, subregion, currency, language, calling code or timezone. |
get_borders | Full records of the countries bordering a given one. |
search_cities | Search cities by name and/or country, ordered by population. |
search_places | Search the full GeoNames gazetteer — mountains, lakes, parks, landmarks and more. |
reverse_geocode | Nearest cities to a latitude/longitude. |
distance | Great-circle distance between two cities or coordinate pairs. |
lookup_postal_code | Resolve a postal / ZIP code to its place, region and coordinates. |
geolocate_ip | Country for an IPv4 or IPv6 address. |
random_country | A random country — for quizzes and sample data. |
list_reference_data | Distinct regions, subregions, currencies, languages or time zones. |
Each tool maps directly to a REST endpoint, so results match the documented API exactly.
Country results are lean by default to keep payloads small. Tools that return countries (get_country, list_countries, get_borders, random_country, geolocate_ip) take an optional fields argument — pass "full" for the complete record, or a comma-separated list to pick exact fields.
Try it
Once connected, ask your assistant something like:
"What's the capital and currency of Japan, and how far is Tokyo from Osaka?"
It'll call get_country and distance and answer from live data.
Test it yourself
The endpoint is a normal HTTP server — list the tools with one curl:
curl -s https://countries.dev/api/mcp \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'Rate limits & caching
countries.dev has no per-key rate limits or quotas — only a generous abuse ceiling. Responses are cached at the edge for speed. Learn the Cache-Control headers and how to cache in your app.
Search countries by name GET
Returns every country whose name contains the given value (case-insensitive).