](https://mseep.ai/app/billster45-mcp-chatgpt-responses)
MCP ChatGPT服务器
](https://smithery.ai/server/@billster45/mcp-chatgpt-responses)
此MCP服务器允许您直接从Claude Desktop访问OpenAI的ChatGPT API。
📝 阅读我为什么构建这个项目: 我构建了一个可以与其他AI对话的AI:揭开MCP炒作的神秘面纱
特性
- 使用可自定义参数调用ChatGPT API
- Aks-Claude和ChatGPT进行了长时间的讨论!
- 配置型号版本、温度和其他参数
- 使用网络搜索从互联网获取最新信息
- 使用OpenAI的Responses API进行自动会话状态管理
- 使用您自己的OpenAI API密钥
安装说明
通过Smithery安装
通过以下方式自动安装Claude Desktop的ChatGPT服务器 史密瑟里:
npx -y @smithery/cli install @billster45/mcp-chatgpt-responses --client claude先决条件
- Python 3.10或更高版本
- 克劳德桌面 应用
- OpenAI API密钥
- 紫外线 用于Python包管理
安装
- 克隆此存储库:
git clone https://github.com/billster45/mcp-chatgpt-responses.git
cd mcp-chatgpt-responses- 使用uv设置虚拟环境并安装依赖项:
uv venv .venv\\Scripts\\activate uv pip install -r requirements.txt与Claude Desktop一起使用
- 按照以下说明配置Claude Desktop以使用此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使用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)-在启用web搜索的情况下向ChatGPT发送提示以获取最新信息
示例用法
ChatGPT的基本用法:
告诉克劳德向ChatGPT提问!
Use the ask_chatgpt tool to answer: What is the best way to learn Python?告诉克劳德与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?现在,尝试以代理方式进行网络搜索,根据天气来计划你完美的一天!
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许可证

