关于 MCP ChatGPT Server
MCP ChatGPT Server 是一个让 Claude Desktop 通过 MCP 调用 OpenAI ChatGPT API 的服务。它面向希望在 Claude 中直接使用 ChatGPT 或让两个模型对话的用户,并借助 Responses API 自动管理会话状态。
主要功能
- 01可自定义参数的 ChatGPT API 调用
- 02支持联网搜索获取最新信息
- 03可配置模型版本与 temperature 等参数
- 04通过 Responses API 自动保存会话状态
- 05使用用户自己的 OpenAI API 密钥
适用场景
- 01在 Claude Desktop 中向 ChatGPT 提问
- 02让 Claude 与 ChatGPT 进行多轮对话
- 03借助联网搜索查询最新资讯
MCP 相关
该项目是一个 MCP 服务,向 Claude Desktop 等 MCP 客户端暴露 ask_chatgpt 与 ask_chatgpt_with_web_search 两个工具。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
MCP ChatGPT 服务
此 MCP 服务允许你直接从 Claude Desktop 访问 OpenAI 的 ChatGPT API。
📝 了解我构建此项目的原因:我构建了一个能与其他 AI 对话的 AI:揭开 MCP 热潮的神秘面纱
功能
- 使用可自定义的参数调用 ChatGPT API
- 让 Claude 和 ChatGPT 进行长时间的讨论!
- 配置模型版本、温度及其他参数
- 使用网页搜索从互联网获取最新信息
- 使用 OpenAI 的 Responses API 自动管理对话状态
- 使用你自己的 OpenAI API 密钥
设置说明
通过 Smithery 安装
要通过 Smithery 自动为 Claude Desktop 安装 ChatGPT Server:
npx -y @smithery/cli install @billster45/mcp-chatgpt-responses --client claude
前提条件
- Python 3.10 或更高版本
- Claude Desktop 应用
- OpenAI API 密钥
- 用于 Python 包管理的 uv
安装
-
克隆此仓库:
git clone https://github.com/billster45/mcp-chatgpt-responses.git cd mcp-chatgpt-responses -
使用 uv 设置虚拟环境并安装依赖项:
uv venv.venv\\Scripts\\activateuv pip install -r requirements.txt
与 Claude Desktop 配合使用
-
按照以下说明配置 Claude Desktop,以使用此 MCP 服务: MCP 快速入门指南
-
将以下配置添加到 Claude Desktop 配置文件中(根据需要调整路径):
{ "mcpServers": { "chatgpt": { "command": "uv", "args": [ "--directory", "\\path\\to\\mcp-chatgpt-responses", "run", "chatgpt_server.py" ], "env": { "OPENAI_API_KEY": "your-api-key-here", "DEFAULT_MODEL": "gpt-4o", "DEFAULT_TEMPERATURE": "0.7", "MAX_TOKENS": "1000" } } } } -
重启 Claude Desktop。
-
现在,你可以通过 Claude 使用 ChatGPT API,只需提出提及 ChatGPT 或 Claude 可能无法回答的问题即可。
可用工具
此 MCP 服务提供以下工具:
-
ask_chatgpt(prompt, model, temperature, max_output_tokens, response_id)- 向 ChatGPT 发送提示词并获取回复 -
ask_chatgpt_with_web_search(prompt, model, temperature, max_output_tokens, response_id)- 向启用了网页搜索的 ChatGPT 发送提示词,以获取最新信息
使用示例
ChatGPT 基本用法:
让 Claude 向 ChatGPT 提问!
Use the ask_chatgpt tool to answer: What is the best way to learn Python?
让 Claude 与 ChatGPT 进行对话:
Use the ask_chatgpt tool to have a two way conversation between you and ChatGPT about the topic that is most important to you.
请注意,在轮流对话中,响应 ID 可以让 ChatGPT 保存对话历史,因此这是真正的对话,而不只是一系列 API 调用。这称为对话状态。
使用网页搜索:
对于可能需要最新信息的问题:
Use the ask_chatgpt_with_web_search tool to answer: What are the latest developments in quantum computing?
现在试试以 Agent 方式使用网页搜索,根据天气规划完美的一日游!
Use the ask_chatgpt_with_web_search tool to find the weather tomorrow in New York, then based on that weather and what it returns, keep using the tool to build up a great day out for someone who loves food and parks
工作原理
此工具使用 OpenAI 的 Responses API,该 API 会在 OpenAI 的服务器上自动维护对话状态。这种方式:
- 让 OpenAI 处理对话历史,从而简化代码
- 提供更可靠的上下文跟踪
- 通过在消息之间保留上下文,改善用户体验
- 借助网页搜索工具访问网络上的最新信息
许可证
MIT 许可证
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。
