MCP工具自动生成器

一个基于Python的MCP服务器,动态从SuperiorAPIs获取插件定义并根据其OpenAPI模式自动生成MCP工具函数,适用于本地开发和AI客户端测试。

  • by CTeaminfo
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 cteaminfo/mcp-superiorapis

使用说明

MCP高级API本地

这个项目是基于Python的 MCP服务器 从中动态检索插件定义 上级 并根据其OpenAPI模式自动生成MCP工具函数。

它在 stdio 模式,使其成为人工智能客户端本地开发和测试的理想选择。

如果您需要使用HTTP或SSE协议进行集成,请参阅: C团队信息/mcp_supiorapis_remote

📂 项目结构

mcp_superiorapis_local/
├── src/mcp_superiorapis_local/     # Main program
│   ├── __init__.py           # Package initialization
│   └── server.py             # MCP server implementation
├── tests/                    # Test files
├── pyproject.toml            # Project config & dependencies
├── uv.lock                   # Locked dependencies
└── README.md                 # Project documentation (this file)

🚀 快速开始

1.环境准备

先决条件:

2.克隆项目

# Using HTTPS
git clone https://github.com/CTeaminfo/mcp_superiorapis_local.git

# Using SSH
git clone git@github.com:CTeaminfo/mcp_superiorapis_local.git
cd mcp_superiorapis_local

3.安装uv(如果未安装)

# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

# Or use pip
pip install uv

4.安装依赖项

# Create virtual environment
uv venv --python 3.13

# Install dependencies
uv sync

# Or use pip
pip install -e .

5.配置环境变量

# Set your Superior APIs token
export TOKEN=your_superior_apis_token_here

# Windows CMD
set TOKEN=your_superior_apis_token_here

令牌身份验证说明:

  • 从获取您的令牌 卓越的API
  • 在运行服务器之前设置TOKEN环境变量

6.启动服务器


python -m mcp_superiorapis_local

or

python src/mcp_superiorapis_local/server.py

7.验证部署

服务器将:

  1. 从SuperiorAPI获取插件数据
  2. 动态生成MCP工具功能
  3. 注册工具
  4. 在stdio模式下启动MCP服务器

🔌 MCP客户端集成

在Pip上使用uvx

在pip上用uvx配置MCP服务器(无需下载源代码):

{
  "mcpServers": {
    "mcp_superiorapis_local": {
      "command": "uvx",
      "args": [
        "mcp-superiorapis" // https://pypi.org/project/mcp-superiorapis/
      ],
      "env": {
        "TOKEN": "your_superior_apis_token_here"
      }
    }
  }
}

本地模式

{
  "mcp_superiorapis_local": {
    "command": "uv",
    "args": [
      "run",
      "--directory",
      "/path/to/mcp_superiorapis_local",
      "python",
      "-m",
      "mcp_superiorapis_local"
    ],
    "env": {
      "TOKEN": "your_superior_apis_token_here"
    }
  }
}

🔧 启动步骤

# 1. Navigate to the project directory
cd mcp_superiorapis_local

# 2. Activate the virtual environment
.venv\Scripts\activate

# 3. Set environment variable
set TOKEN=your_superior_apis_token_here

# 4. Run the project
python -m mcp_superiorapis_local

or

python src/mcp_superiorapis_local/server.py

注:

  • 依赖项只需要安装一次(使用pip install-e.或uv sync)
  • 重新启动后,您只需激活虚拟环境并设置环境变量
  • 一旦虚拟环境处于活动状态,命令提示符将显示(venv)前缀

🔗 相关链接

MCPHub认证

该项目已获得官方认证 MCPHub.

在MCPHub上查看此项目: 🔗 https://mcphub.com/mcp-servers/CTeaminfo/mcp-superiorapis