mcpField
O
OpenAI WebSearch MCP Server

OpenAI WebSearch MCP Server

本地服务
github.com/ConechoAIAI 与智能体9459 周前更新

关于 OpenAI WebSearch MCP Server

OpenAI WebSearch MCP Server 是一个 MCP 服务,通过 OpenAI 的推理模型执行网页搜索,为需要最新信息的 AI 助手提供支持。用户可根据任务在快速检索与深入研究之间选择模型和推理强度。

主要功能

  1. 01支持 gpt-5、o3、o4-mini 等推理模型
  2. 02按场景提供 reasoning_effort 默认值
  3. 03可在 gpt-5-mini 快速检索与 gpt-5 深度研究间切换
  4. 04支持基于地理位置的本地化结果
  5. 05通过环境变量完成配置

适用场景

  1. 01让 AI 助手获取近期的 AI 相关动态
  2. 02对复杂主题进行较深入的搜索与分析
  3. 03搜索特定城市或地区的本地活动

MCP 相关

该服务向 MCP 客户端暴露 openai_web_search 工具,客户端可传入查询、模型、推理强度、搜索上下文大小和用户位置等参数。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

OpenAI WebSearch MCP 服务 🔍

PyPI version Python 3.10+ MCP Compatible License: MIT

一款先进的 MCP 服务,使用 OpenAI 的推理模型提供智能网页搜索功能。非常适合需要通过智能推理获取最新信息的 AI 助手。

✨ 功能

  • 🧠 推理模型支持:全面兼容 OpenAI 最新的推理模型(gpt-5、gpt-5-mini、gpt-5-nano、o3、o4-mini)
  • ⚡ 智能工作量控制:根据使用场景智能设置 reasoning_effort 默认值
  • 🔄 多模式搜索:使用 gpt-5-mini 快速迭代,或使用 gpt-5 深入研究
  • 🌍 本地化结果:支持基于位置定制搜索
  • 📝 丰富的描述:提供完整的参数文档,便于集成
  • 🔧 灵活的配置:支持环境变量,便于部署

🚀 快速开始

Claude Desktop 一键安装
OPENAI_API_KEY=sk-xxxx uvx --with openai-websearch-mcp openai-websearch-mcp-install

将 sk-xxxx 替换为你从 OpenAI Platform 获取的 OpenAI API 密钥。

⚙️ 配置

Claude Desktop

添加到你的 claude_desktop_config.json:

{
  "mcpServers": {
    "openai-websearch-mcp": {
      "command": "uvx",
      "args": ["openai-websearch-mcp"],
      "env": {
        "OPENAI_API_KEY": "your-api-key-here",
        "OPENAI_DEFAULT_MODEL": "gpt-5-mini"
      }
    }
  }
}
Cursor

在 Cursor 的 MCP 设置中添加:

  1. 打开 Cursor 设置(Cmd/Ctrl + ,)
  2. 搜索“MCP”或前往“扩展 → MCP”
  3. 添加服务配置:
{
  "mcpServers": {
    "openai-websearch-mcp": {
      "command": "uvx",
      "args": ["openai-websearch-mcp"],
      "env": {
        "OPENAI_API_KEY": "your-api-key-here",
        "OPENAI_DEFAULT_MODEL": "gpt-5-mini"
      }
    }
  }
}
Claude Code

Claude Code 会自动检测为 Claude Desktop 配置的 MCP 服务。使用上述 Claude Desktop 的相同配置即可。

本地开发

进行本地测试时,请使用虚拟环境的绝对路径:

{
  "mcpServers": {
    "openai-websearch-mcp": {
      "command": "/path/to/your/project/.venv/bin/python",
      "args": ["-m", "openai_websearch_mcp"],
      "env": {
        "OPENAI_API_KEY": "your-api-key-here",
        "OPENAI_DEFAULT_MODEL": "gpt-5-mini",
        "PYTHONPATH": "/path/to/your/project/src"
      }
    }
  }
}

🛠️ 可用工具

openai_web_search

支持推理模型的智能网页搜索。

参数
参数类型描述默认值
inputstring要搜索的查询或问题必填
modelstring要使用的 AI 模型。支持 gpt-4o、gpt-4o-mini、gpt-5、gpt-5-mini、gpt-5-nano、o3、o4-minigpt-5-mini
reasoning_effortstring推理工作量级别:low、medium、high、minimal智能默认值
typestring网页搜索 API 版本web_search_preview
search_context_sizestring上下文量:low、medium、highmedium
user_locationobject可选的位置,用于获取本地化结果null

💬 使用示例

配置完成后,只需用自然语言让 AI 助手搜索信息:

快速搜索

“使用 openai_web_search 搜索 AI 推理模型的最新进展”

深入研究

“使用 gpt-5 和 high 推理工作量,通过 openai_web_search 全面分析量子计算的突破”

本地化搜索

“使用 openai_web_search 搜索本周旧金山当地的科技聚会”

AI 助手会根据你的请求,自动使用带有适当参数的 openai_web_search 工具。

🤖 模型选择指南

快速多轮搜索 🚀
  • 推荐:使用 gpt-5-mini,并将 reasoning_effort 设为 "low"
  • 使用场景:快速迭代、实时信息、多个快速查询
  • 优势:延迟更低,适合频繁搜索,成本效益高
深入研究 🔬
  • 推荐:使用 gpt-5,并将 reasoning_effort 设为 "medium" 或 "high"
  • 使用场景:全面分析、复杂主题、详细调查
  • 优势:提供多轮推理结果,无需 Agent 迭代
模型对比
模型推理能力默认推理力度适用场景
gpt-4o❌不适用常规搜索
gpt-4o-mini❌不适用基础查询
gpt-5-mini✅low快速迭代
gpt-5✅medium深度研究
gpt-5-nano✅medium均衡方案
o3✅medium高级推理
o4-mini✅medium高效推理

📦 安装

使用 uvx(推荐)
# Install and run directly
uvx openai-websearch-mcp

# Or install globally
uvx install openai-websearch-mcp
使用 pip
# Install from PyPI
pip install openai-websearch-mcp

# Run the server
python -m openai_websearch_mcp
从源代码安装
# Clone the repository
git clone https://github.com/yourusername/openai-websearch-mcp.git
cd openai-websearch-mcp

# Install dependencies
uv sync

# Run in development mode
uv run python -m openai_websearch_mcp

👩‍💻 开发

设置开发环境
# Clone and setup
git clone https://github.com/yourusername/openai-websearch-mcp.git
cd openai-websearch-mcp

# Create virtual environment and install dependencies
uv sync

# Run tests
uv run python -m pytest

# Install in development mode
uv pip install -e .
环境变量
变量描述默认值
OPENAI_API_KEY你的 OpenAI API 密钥必填
OPENAI_DEFAULT_MODEL默认使用的模型gpt-5-mini

🐛 调试

使用 MCP Inspector
# For uvx installations
npx @modelcontextprotocol/inspector uvx openai-websearch-mcp

# For pip installations
npx @modelcontextprotocol/inspector python -m openai_websearch_mcp
常见问题

问题:“Unsupported parameter: 'reasoning.effort'” 解决方案:使用非推理模型(gpt-4o、gpt-4o-mini)并设置 reasoning_effort 参数时会出现此问题。服务会自动处理,仅对兼容的模型应用推理参数。

问题:“No module named 'openai_websearch_mcp'” 解决方案:请确保已正确安装该软件包,并且 Python 路径包含该软件包的位置。

📄 许可证

本项目采用 MIT 许可证授权,详情请参阅 LICENSE 文件。

🙏 致谢


共同创作者:Claude [email protected]

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。