Skip to main content
Glama
MorvanZhou

Customized MCP Server

by MorvanZhou

定制MCP项目

该项目利用具有 CLI 支持的mcp库并与 OpenAI 的 API 集成。

要求

确保在运行项目之前安装所需的依赖项:

pip install -r requirements.txt

Related MCP server: mcp-server

用法

  1. 将您的 OpenAI API 密钥配置为环境变量:

    export OPENAI_API_KEY="your-api-key"
  2. 启动 MCP 服务器:

    python server.py
  3. 使用客户端与服务器进行交互:

    python client.py
  4. 或者,使用协调器查询 LLM 和工具:

    python main.py

例子

查询天气工具

运行客户端并调用get_weather工具:

python client.py

交互示例:

You: List tools
Assistant: {
  "tools": [
    {
      "name": "get_weather",
      "description": "Get weather for a city",
      "parameters": {
        "city": {
          "type": "string",
          "description": "Name of the city"
        }
      }
    }
  ]
}

You: Call get_weather with {"city": "Beijing"}
Assistant: 北京的天气是晴天

依赖项

  • openai==1.70.0

  • mcp[cli]==1.6.0

执照

该项目已获得 MIT 许可。

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server built with the mcp-framework to provide weather-related tools and data to AI clients. It enables integration of weather capabilities and custom tools into the MCP ecosystem for use with platforms like Claude Desktop.
    9 npm
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    A proof-of-concept MCP server that provides weather information using the Open-Meteo API, with tools for greeting, getting weather by coordinates, and by location name.
    -