Back to MCP directory
publicPublicdnsLocal runtime

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

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client