Token导航 LogoToken导航TokenDH.com
Openai Tool2mcp logo
开发工具stdio官方级别未说明来源级核验

Openai Tool2mcp

MCP Server

一个轻量级开源工具,将OpenAI内置工具(如网页搜索和代码解释器)封装为MCP协议服务器,使Claude等兼容MCP的模型能够使用这些功能。

工具数

4

提示词数

0

GitHub Stars

12

资源数

0
协议转换开源工具PythonClaudeAI开发工具Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

alohays

提供方

alohays

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install openai-tool2mcp

详细介绍

openai-tool2mcp

![Release](https://img.shields.io/github/v/release/alohays/openai-tool2mcp) ![Build status](https://github.com/alohays/openai-tool2mcp/actions/workflows/main.yml?query=branch%3Amain) ![codecov](https://codecov.io/gh/alohays/openai-tool2mcp) ![Commit activity](https://img.shields.io/github/commit-activity/m/alohays/openai-tool2mcp) ![License](https://img.shields.io/github/license/alohays/openai-tool2mcp)

openai-tool2mcp 是一个轻量级的开源网桥,将OpenAI强大的内置工具封装为模型上下文协议(MCP)服务器。它使您能够使用高质量的OpenAI工具,如web搜索和代码解释器,以及Claude和其他兼容MCP的模型。

  • 🔍 在Claude App中使用OpenAI强大的网络搜索
  • 💻 访问任何兼容MCP的LLM中的代码解释器功能
  • 🔄 OpenAI和MCP之间的无缝协议转换
  • 🛠️ 简单的API,便于集成
  • 🌐 与MCP SDK完全兼容

🔍 OpenAI搜索与Claude App集成演示! 🚀

https://github.com/user-attachments/assets/f1f10e2c-b995-4e03-8b28-61eeb2b2bfe9

OpenAI试图将他们强大的LLM优化工具锁定在自己的代理平台中,但他们无法阻止MCP不可阻挡的开源运动!

开发商的困境

人工智能开发人员目前面临着在两个生态系统之间做出具有挑战性的选择:

graph TD
    subgraph "Developer's Dilemma"
        style Developer fill:#ff9e64,stroke:#fff,stroke-width:2px
        Developer((Developer))
    end

    subgraph "OpenAI's Ecosystem"
        style OpenAITools fill:#bb9af7,stroke:#fff,stroke-width:2px
        style Tracing fill:#bb9af7,stroke:#fff,stroke-width:2px
        style Evaluation fill:#bb9af7,stroke:#fff,stroke-width:2px
        style VendorLock fill:#f7768e,stroke:#fff,stroke-width:2px,stroke-dasharray: 5 5

        OpenAITools["Built-in Tools
(Web Search, Code Interpreter)"]
        Tracing["Advanced Tracing
(Visual Debugging)"]
        Evaluation["Evaluation Dashboards
(Performance Metrics)"]
        VendorLock["Vendor Lock-in
⚠️ Closed Source ⚠️"]

        OpenAITools --> Tracing
        Tracing --> Evaluation
        OpenAITools -.-> VendorLock
        Tracing -.-> VendorLock
        Evaluation -.-> VendorLock
    end

    subgraph "MCP Ecosystem"
        style MCPStandard fill:#7dcfff,stroke:#fff,stroke-width:2px
        style MCPTools fill:#7dcfff,stroke:#fff,stroke-width:2px
        style OpenStandard fill:#9ece6a,stroke:#fff,stroke-width:2px
        style LimitedTools fill:#f7768e,stroke:#fff,stroke-width:2px,stroke-dasharray: 5 5

        MCPStandard["Model Context Protocol
(Open Standard)"]
        MCPTools["MCP-compatible Tools"]
        OpenStandard["Open Ecosystem
✅ Interoperability ✅"]
        LimitedTools["Limited Tool Quality
⚠️ Less Mature (e.g., web search, computer use) ⚠️"]

        MCPStandard --> MCPTools
        MCPStandard --> OpenStandard
        MCPTools -.-> LimitedTools
    end

    Developer -->|"Wants powerful tools
& visualizations"| OpenAITools
    Developer -->|"Wants open standards
& interoperability"| MCPStandard

    classDef highlight fill:#ff9e64,stroke:#fff,stroke-width:4px;
    class Developer highlight

openai-tool2mcp 通过让您在开放的MCP生态系统中使用OpenAI成熟、高质量的工具来弥合这一差距。

🌟 特性

  • 轻松设置:只需几个简单的命令即可启动并运行
  • OpenAI工具作为MCP服务器:将强大的OpenAI内置工具包装为符合MCP的服务器
  • 无缝集成:适用于Claude App和其他MCP兼容客户端
  • MCP SDK兼容:使用官方MCP Python SDK
  • 工具支持:

- 🔍 网页搜索 - 💻 代码解释器 - 🌐 Web浏览器 - 📁 文件管理

  • 开源:麻省理工学院许可、可破解和可扩展

🚀 安装

# Install from PyPI
pip install openai-tool2mcp

# Or install the latest development version
pip install git+https://github.com/alohays/openai-tool2mcp.git

# Recommended: Install uv for better MCP compatibility
pip install uv

先决条件

  • Python 3.10+
  • 可访问助手API的OpenAI API密钥
  • (推荐)用于MCP兼容性的uv包管理器

🛠️ 快速开始

  1. 设置OpenAI API密钥:
export OPENAI_API_KEY="your-api-key-here"
  1. 使用OpenAI工具启动MCP服务器:
# Recommended: Use uv for MCP compatibility (recommended by MCP documentation)
uv run openai_tool2mcp/server_entry.py --transport stdio

# Or use the traditional method with the CLI
openai-tool2mcp start --transport stdio
  1. 与Claude一起用于桌面:

通过编辑Claude_Desktop_config.json配置您的Claude for Desktop以使用服务器:

{
  "mcpServers": {
    "openai-tools": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/your/openai-tool2mcp",
        "run",
        "openai_tool2mcp/server_entry.py"
      ]
    }
  }
}

配置文件位于:

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 窗户: %AppData%\Claude\claude_desktop_config.json

💻 使用示例

基本服务器配置

# server_script.py
from openai_tool2mcp import MCPServer, ServerConfig, OpenAIBuiltInTools

# Configure with OpenAI web search
config = ServerConfig(
    openai_api_key="your-api-key",
    tools=[OpenAIBuiltInTools.WEB_SEARCH.value]
)

# Create and start server with STDIO transport (for MCP compatibility)
server = MCPServer(config)
server.start(transport="stdio")

用它运行 uv 根据MCP的建议:

uv run server_script.py

Claude桌面的MCP兼容配置

创建独立脚本:

# openai_tools_server.py
import os
from dotenv import load_dotenv
from openai_tool2mcp import MCPServer, ServerConfig, OpenAIBuiltInTools

# Load environment variables
load_dotenv()

# Create a server with multiple tools
config = ServerConfig(
    openai_api_key=os.environ.get("OPENAI_API_KEY"),
    tools=[
        OpenAIBuiltInTools.WEB_SEARCH.value,
        OpenAIBuiltInTools.CODE_INTERPRETER.value
    ]
)

# Create and start the server with stdio transport for MCP compatibility
server = MCPServer(config)
server.start(transport="stdio")

配置Claude Desktop以使用此脚本 uv:

{
  "mcpServers": {
    "openai-tools": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/your/project/folder",
        "run",
        "openai_tools_server.py"
      ]
    }
  }
}

📊 运作原理

该库是OpenAI Assistant API和MCP协议之间的桥梁:

sequenceDiagram
    participant Claude as "Claude App"
    participant MCP as "MCP Client"
    participant Server as "openai-tool2mcp Server"
    participant OpenAI as "OpenAI API"

    Claude->>MCP: User query requiring tools
    MCP->>Server: MCP request
    Server->>OpenAI: Convert to OpenAI format
    OpenAI->>Server: Tool response
    Server->>MCP: Convert to MCP format
    MCP->>Claude: Display result

🔄 MCP SDK集成

openai-tool2mcp 现在与MCP SDK完全兼容。您可以通过以下方式将其与Claude for Desktop应用程序一起使用:

  1. 安装软件包 pip install openai-tool2mcp
  2. 配置您的 claude_desktop_config.json 包括:
{
  "mcpServers": {
    "openai-tools": {
      "command": "openai-tool2mcp",
      "args": [
        "start",
        "--transport",
        "stdio",
        "--tools",
        "retrieval",
        "code_interpreter"
      ]
    }
  }
}

配置文件位于:

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 窗户: %AppData%\Claude\claude_desktop_config.json

🤝 贡献

我们欢迎社区的贡献!以下是您可以提供帮助的方式:

  1. 分叉 存储库
  2. 克隆 将叉子插入本地机器
  3. 创建分支 针对您的功能或错误修复
  4. 进行更改 并承诺
  5. 到你的叉子并提交 拉取请求

请确保遵循我们的编码标准,并为任何新功能添加测试。

开发设置

# Clone the repository
git clone https://github.com/alohays/openai-tool2mcp.git
cd openai-tool2mcp

# Install in development mode
make install

# Run tests
make test

# Run linting
make lint

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

🙏 致谢

  • OpenAI团队的优秀工具和API
  • MCP社区致力于开发工具使用的开放标准
  • 所有帮助改进此项目的贡献者

______________________________________________________________________

⚠️ 项目状态

该项目正在积极开发中。虽然核心功能正常工作,但预计会经常更新和改进。如果您遇到任何问题,请在我们的 问题跟踪系统.

______________________________________________________________________

_openai-tool2mcp是更广泛的 MCPortal 将OpenAI的工具与开源MCP生态系统连接起来的倡议。_

目录标签

目录标签

协议转换开源工具PythonClaudeAI开发工具本地部署工具集成MCP兼容

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP