OpenAI MCP 服务器
使用 MCP 协议直接从 Claude 查询 OpenAI 模型。此分支添加了对 o3-mini 和 gpt-4o-mini 模型的支持,并改进了消息处理。
Cline自动安装
特征
与 OpenAI 的 API 直接集成
支持多种模型:
o3-mini(默认):针对简洁响应进行了优化
GPT-4O-mini:增强模型,可提供更详细的响应
可配置的消息格式
错误处理和日志记录
通过 MCP 协议实现简单的接口
安装
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 OpenAI MCP 服务器:
手动安装
克隆存储库:
配置Claude桌面:
将此服务器添加到您现有的 MCP 设置配置中。注意:请保留配置中现有的 MCP 服务器 - 只需将此服务器添加到它们旁边即可。
地点:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%/Claude/claude_desktop_config.json
Linux:检查你的主目录(
~/
)以获取默认的 MCP 设置位置
获取 OpenAI API 密钥:
创建账户或登录
导航至 API 设置
生成新的 API 密钥
将密钥添加到您的配置文件中,如上所示
重启克劳德:
更新配置后,重新启动 Claude 以使更改生效
用法
该服务器提供了一个单独的工具ask-openai
,可用于查询 OpenAI 模型。你可以直接在 Claude 中使用 use_mcp_tool 命令来使用它:
模型比较
o3-mini(默认)
最适合:快速、简洁的答案
风格:直接、高效
响应示例:
Python's asyncio provides non-blocking, collaborative multitasking. Key features: 1. Event Loop – Schedules and runs asynchronous tasks 2. Coroutines – Functions you can pause and resume 3. Tasks – Run coroutines concurrently 4. Futures – Represent future results 5. Non-blocking I/O – Efficient handling of I/O operations
GPT-4O-迷你
最适合:更全面的解释
风格:细致、透彻
响应示例:
Python's asyncio library provides a comprehensive framework for asynchronous programming. It includes an event loop for managing tasks, coroutines for writing non-blocking code, tasks for concurrent execution, futures for handling future results, and efficient I/O operations. The library also provides synchronization primitives and high-level APIs for network programming.
响应格式
该工具以标准化格式返回响应:
故障排除
未找到服务器:
验证配置中的 PYTHONPATH 指向正确的目录
确保 Python 和 pip 已正确安装
尝试直接运行
python -m src.mcp_server_openai.server --openai-api-key your-key-here
来检查错误
身份验证错误:
检查您的 OpenAI API 密钥是否有效
确保密钥在 args 数组中正确传递
验证密钥中没有多余的空格或字符
模型误差:
确认您使用的是受支持的型号(o3-mini 或 gpt-4o-mini)
检查您的查询不为空
确保你没有超出令牌限制
发展
与原版的差异
增加了对 o3-mini 和 gpt-4o-mini 型号的支持
改进的消息格式
删除温度参数以提高兼容性
更新了文档,其中包含详细的使用示例
增加了模型比较和响应示例
增强安装说明
添加了故障排除指南
执照
MIT 许可证
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
通过 MCP 协议实现与 OpenAI 模型的集成,支持与 Claude Desktop 一起使用时提供简洁、详细的响应。
Related Resources
Related MCP Servers
- -securityAlicense-qualityThis tool creates a Model Context Protocol (MCP) server that acts as a proxy for any API that has an OpenAPI v3.1 specification. This allows you to use Claude Desktop to easily interact with both local and remote server APIs.Last updated -198823MIT License
- -securityAlicense-qualityA Model Context Protocol (MCP) server that lets you seamlessly use OpenAI's models right from Claude.Last updated -9068MIT License
- -securityAlicense-qualityQuery OpenAI models directly from Claude using MCP protocol.Last updated -173MIT License
- -securityAlicense-qualityA lightweight bridge that wraps OpenAI's built-in tools (like web search and code interpreter) as Model Context Protocol servers, enabling their use with Claude and other MCP-compatible models.Last updated -411MIT License