国家数据API服务

一个提供国家相关数据的MCP服务器,通过API Ninjas Country API获取国家信息。

  • by BACH-AI-Tools
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 BACH-AI-Tools/country_by_api_ninjas

使用说明

Country By Api Ninjas MCP Server

English |Simplified Chinese| Traditional Chinese

MCP server used to access Country By Api Ninjas API.

🚀 Quickly experience using the EMCP platform

EMCP It is a powerful MCP server management platform that allows you to quickly use various MCP servers without manual configuration!

Quick Start:

  1. 🌐 visit EMCP platform
  2. 📝 Register and log in to your account
  3. 🎯 enter MCP SquareBrowse all available MCP servers
  4. 🔍 Search or find this server(bach-country_by_api_ninjas)
  5. 🎉 click Install MCP button
  6. ✅ Done! Can be used in your application

Advantages of the EMCP platform:

  • ✨ Zero configurationNo need to manually edit configuration files
  • 🎨 Visual managementEasily manage all MCP servers through a graphical interface
  • 🔐 safe and reliableUnified management of API keys and authentication information
  • 🚀 One-click installationMCP Square offers a wide range of server options
  • 📊 Use statisticsReal time viewing of service invocation status

Visit Now EMCP platform Start your MCP journey!


Introduction

This is an MCP server used to access the Country By Api Ninjas API.

  • PyPI package name: bach-country_by_api_ninjas
  • version: 1.0.0
  • transmission protocol: stdio

install

Install from PyPI:

pip install bach-country_by_api_ninjas

Install from source code:

pip install -e .

run

Method 1: Use UVX (recommended, no installation required)

# 运行(uvx 会自动安装并运行)
uvx --from bach-country_by_api_ninjas bach_country_by_api_ninjas

# 或指定版本
uvx --from bach-country_by_api_ninjas@latest bach_country_by_api_ninjas

Method 2: Direct Run (Development Mode)

python server.py

Method 3: Run as a command after installation

# 安装
pip install bach-country_by_api_ninjas

# 运行(命令名使用下划线)
bach_country_by_api_ninjas

configuration

API certification

This API requires authentication. Please set environment variables:

export API_KEY="your_api_key_here"

environment variable

Variable Name Description Required
API_KEY API Key Yes
PORT Not applicable No
HOST Not applicable No

Use in cursor

Edit cursor MCP configuration file ~/.cursor/mcp.json:

{
  "mcpServers": {
    "bach-country_by_api_ninjas": {
      "command": "uvx",
      "args": ["--from", "bach-country_by_api_ninjas", "bach_country_by_api_ninjas"],
      "env": {
        "API_KEY": "your_api_key_here"
      }
    }
  }
}

Using Claude Desktop

Edit Claude Desktop configuration file claude_desktop_config.json:

{
  "mcpServers": {
    "bach-country_by_api_ninjas": {
      "command": "uvx",
      "args": ["--from", "bach-country_by_api_ninjas", "bach_country_by_api_ninjas"],
      "env": {
        "API_KEY": "your_api_key_here"
      }
    }
  }
}

Available tools

This server provides the following tools:

v1country

API Ninjas Country API endpoint.

endpoint: GET /v1/country

parameter:

  • name (string): Plain English name, 2-letter ISO-3166 alpha-2, or 3-letter ISO-3166 alpha-3 code of country.

  • currency (string): 3-letter currency code of country (e.g. USD).

  • min_gdp (number): Minimum gross domestic product (GDP) of country, in US Dollars.

  • max_gdp (number): Maximum gross domestic product (GDP) of country, in US Dollars.

  • min_population (number): Minimum population of country.

  • max_population (number): Maximum population of country.

  • min_area (number): Minimum surface area of country in km2.

  • max_area (number): Maximum surface area of country in km2.

  • min_unemployment (number): Minimum unemployment rate in %.

  • max_unemployment (number): Maximum unemployment rate in %.

  • min_gdp_growth (number): Minimum GDP growth rate in %.

  • max_gdp_growth (number): Maximum GDP growth rate in %.

  • min_infant_mortality (number): Minimum infant mortality rate in %.

  • max_infant_mortality (number): Maximum infant mortality rate in %.

  • min_fertility (number): Minimum fertility rate in %.

  • max_fertility (number): Maximum fertility rate in %.

  • min_urban_pop_rate (number): Minimum urban population rate in %.

  • max_urban_pop_rate (number): Maximum urban population rate in %.

  • limit (number): How many results to return. Must be between 1 and 30. Default is 5.


tech stack

  • transmission protocol: stdio
  • HTTP client: httpx

license

MIT License - see details LICENSE Document.

development

This server is composed of API-to-MCP Tool generation.

Version: 1.0.0