返回 MCP 目录
public公开dns本地运行

mcp-chatgpt-responses

一个让Claude Desktop直接调用ChatGPT API的MCP服务器,支持自定义参数和网络搜索功能。

article

README

🚀 MCP ChatGPT 服务器

MCP ChatGPT 服务器允许您直接从 Claude Desktop 访问 OpenAI 的 ChatGPT API,为您提供便捷的 AI 交互体验。

smithery badge

📝 了解项目构建缘由我构建了一个可以与其他 AI 交谈的 AI:揭开 MCP 热潮的神秘面纱

✨ 主要特性

  • 可使用自定义参数调用 ChatGPT API。
  • 支持让 Claude 和 ChatGPT 进行长时间对话。
  • 能够配置模型版本、温度和其他参数。
  • 可使用网络搜索获取最新的互联网信息。
  • 采用 OpenAI 的响应 API 自动管理对话状态。
  • 允许使用您自己的 OpenAI API 密钥。

📦 安装指南

通过 Smithery 安装

要通过 Smithery 自动安装 Claude Desktop 中的 ChatGPT Server,可运行以下命令:

npx -y @smithery/cli install @billster45/mcp-chatgpt-responses --client claude

先决条件

安装步骤

  1. 克隆此仓库:
git clone https://github.com/billster45/mcp-chatgpt-responses.git
cd mcp-chatgpt-responses
  1. 设置虚拟环境并使用 uv 安装依赖项:
uv venv
uv install
  1. 安装完成后,运行以下命令启动服务器:
uv run server:app

📚 详细文档

配置

在 Claude Desktop 中配置 MCP 服务器,请参考示例配置:

{
  "mcpServers": {
    "chatGpt": {
      "type": "http",
      "url": "http://localhost:5000"
    }
  },
  "tools": {
    "chatGpt": {
      "command": "$ chatgpt工具",
      "description": "与ChatGPT对话。使用$ {message}传递消息。",
      "args": [
        {
          "name": "message",
          "type": "string",
          "description": "要发送给ChatGPT的消息。",
          "required": true
        }
      ]
    }
  }
}

工具

基本工具:ask_chatgpt

格式:

{
  $: "chatgpt工具",
  args: {
    message: string,
    options?: {
      model?: string,
      temperature?: number,
      maxTokens?: number,
      responseId?: string
    }
  }
}

示例:

{
  $: "chatgpt工具",
  args: {
    message: "解释量子计算。",
    options: {
      model: "gpt-3.5-turbo",
      temperature: 0.7,
      maxTokens: 1000,
      responseId: "response_123"
    }
  }
}

带网络搜索的工具:ask_chatgpt_with_search

格式:

{
  $: "chatgpt工具",
  args: {
    message: string,
    options?: {
      model?: string,
      temperature?: number,
      maxTokens?: number,
      responseId?: string
    }
  }
}

示例:

{
  $: "chatgpt工具",
  args: {
    message: "纽约明天的天气如何?然后建议适合的食物和公园活动。",
    options: {
      model: "gpt-3.5-turbo",
      temperature: 0.7,
      maxTokens: 1500
    }
  }
}

🔧 技术细节

此工具利用 OpenAI 的响应 API,自动在 OpenAI 服务器上管理对话状态。这种方法具有以下优势:

  1. 简化了代码,让 OpenAI 处理上下文。
  2. 提供更可靠的上下文跟踪。
  3. 改善用户体验,通过维护消息历史记录。
  4. 允许通过网络搜索工具获取最新信息。

📄 许可证

本项目采用 MIT License。

help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端