国家查询服务器

一个模块化的MCP服务器,提供国家和州查询工具,可作为CLI或插件代理使用。

  • by llanterme
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 llanterme/mcp-server

使用说明

演示国家MCP服务器

一个模块化的MCP服务器,为国家和州查找提供工具。 已准备好用作CLI或插件代理。


快速开始

  1. 克隆并设置您的环境

    git clone<REPO_URL> cd-mcp服务器

  2. 构建包

    python-m构建

  3. 使用pipx进行全局安装

    pipx安装dist/country_mcp_server-*.whl--force

  4. 运行服务器

    国家mcp服务器

    或者,对于使用Inspector UI进行开发:

    mcp-dev country_server_mcp/main.py


添加您自己的工具

  • 放入新模块 country_server_mcp/tools/.
  • 每个模块应定义一个 register(mcp) 使用函数和添加工具 @mcp.tool().
  • 导入并调用每个新工具 register(mcp) 在……里面 main.py.
  • 重新生成并重新安装 pipx install dist/… --force.

项目布局示例

country_server_mcp/
    __init__.py
    main.py
    tools/
        __init__.py
        countries.py
        states.py
pyproject.toml
README.md

用作MCP代理

添加到编排器配置中:

{
  "mcpServers": {
    "country": {
      "command": "country-mcp-server",
      "args": []
    }
  }
}

备注

  • 如果更新工具,请重新生成并重新安装软件包。
  • 确保CLI二进制文件在PATH中(~/.local/bin 默认情况下为pipx)。
  • 对于开发模式,可编辑安装: pip install -e .

如果你想让它变得更小,或者需要一个特定的团队“入门”简介,请告诉我!