Skip to main content
Glama
alohays

openai-tool2mcp

by alohays

openai-tool2mcp

Release Build status codecov Commit activity License

openai-tool2mcp is a lightweight, open-source bridge that wraps OpenAI's powerful built-in tools as Model Context Protocol (MCP) servers. It enables you to use high-quality OpenAI tools like web search and code interpreter with Claude and other MCP-compatible models.

  • πŸ” Use OpenAI's robust web search in Claude App

  • πŸ’» Access code interpreter functionality in any MCP-compatible LLM

  • πŸ”„ Seamless protocol translation between OpenAI and MCP

  • πŸ› οΈ Simple API for easy integration

  • 🌐 Full compatibility with the MCP SDK

πŸ” OpenAI Search Integration Demo with Claude App! πŸš€

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

OpenAI tried to keep their powerful, LLM-optimized tools locked within their own agent platform, but they couldn't stop the unstoppable open-source movement of MCP!

Related MCP server: OpenAI Agents MCP Server

The Developer's Dilemma

AI developers currently face a challenging choice between two ecosystems:

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<br/>(Web Search, Code Interpreter)"]
        Tracing["Advanced Tracing<br/>(Visual Debugging)"]
        Evaluation["Evaluation Dashboards<br/>(Performance Metrics)"]
        VendorLock["Vendor Lock-in<br/>⚠️ 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<br/>(Open Standard)"]
        MCPTools["MCP-compatible Tools"]
        OpenStandard["Open Ecosystem<br/>βœ… Interoperability βœ…"]
        LimitedTools["Limited Tool Quality<br/>⚠️ Less Mature (e.g., web search, computer use) ⚠️"]

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

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

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

openai-tool2mcp bridges this gap by letting you use OpenAI's mature, high-quality tools within the open MCP ecosystem.

🌟 Features

  • Easy Setup: Get up and running with a few simple commands

  • OpenAI Tools as MCP Servers: Wrap powerful OpenAI built-in tools as MCP-compliant servers

  • Seamless Integration: Works with Claude App and other MCP-compatible clients

  • MCP SDK Compatible: Uses the official MCP Python SDK

  • Tool Support:

    • πŸ” Web Search

    • πŸ’» Code Interpreter

    • 🌐 Web Browser

    • πŸ“ File Management

  • Open Source: MIT licensed, hackable and extensible

πŸš€ Installation

# 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

Prerequisites

  • Python 3.10+

  • OpenAI API key with access to the Assistant API

  • (Recommended) uv package manager for MCP compatibility

πŸ› οΈ Quick Start

  1. Set your OpenAI API key:

export OPENAI_API_KEY="your-api-key-here"
  1. Start the MCP server with OpenAI tools:

# 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. Use with Claude for Desktop:

Configure your Claude for Desktop to use the server by editing the claude_desktop_config.json:

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

The config file is located at:

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %AppData%\Claude\claude_desktop_config.json

πŸ’» Usage Examples

Basic Server Configuration

# 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")

Run it with uv as recommended by MCP:

uv run server_script.py

MCP-Compatible Configuration for Claude Desktop

Create a standalone script:

# 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")

Configure Claude Desktop to use this script with uv:

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

πŸ“Š How It Works

The library serves as a bridge between the OpenAI Assistant API and the MCP protocol:

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 Integration

openai-tool2mcp is now fully compatible with the MCP SDK. You can use it with the Claude for Desktop app by:

  1. Installing the package with pip install openai-tool2mcp

  2. Configuring your claude_desktop_config.json to include:

{
  "mcpServers": {
    "openai-tools": {
      "command": "openai-tool2mcp",
      "args": [
        "start",
        "--transport",
        "stdio",
        "--tools",
        "retrieval",
        "code_interpreter"
      ]
    }
  }
}

The config file is located at:

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %AppData%\Claude\claude_desktop_config.json

🀝 Contributing

We welcome contributions from the community! Here's how you can help:

  1. Fork the repository

  2. Clone your fork to your local machine

  3. Create a branch for your feature or bugfix

  4. Make your changes and commit them

  5. Push to your fork and submit a pull request

Please make sure to follow our coding standards and add tests for any new features.

Development Setup

# 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

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgements

  • The OpenAI team for their excellent tools and APIs

  • The MCP community for developing an open standard for tool usage

  • All contributors who have helped improve this project


⚠️ Project Status

This project is in active development. While the core functionality works, expect frequent updates and improvements. If you encounter any issues, please submit them on our issue tracker.


openai-tool2mcp is part of the broader MCPortal initiative to bridge OpenAI's tools with the open-source MCP ecosystem.

Available Tools

4 tools
browserC

Browse websites and interact with web content

ParametersJSON Schema
NameRequiredDescriptionDefault
parametersYes

TDQS

C2.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'browse' and 'interact' but doesn't specify whether this is read-only or allows mutations, what permissions or authentication might be needed, rate limits, or what 'interact' entails (e.g., clicking, form submission). It lacks critical behavioral details for a tool with web interaction capabilities.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with two short phrases: 'Browse websites' and 'interact with web content'. It's front-loaded with the core purpose, though it could be more structured. There's no wasted text, but it's under-specified rather than efficiently detailed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of web browsing/interaction, no annotations, no output schema, and 0% schema coverage for the single parameter, the description is incomplete. It doesn't cover what the tool returns, how errors are handled, or the scope of interactions. For a tool with potential side effects and rich functionality, this is inadequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, and the description provides no information about parameters. It doesn't explain what 'parameters' should contain (e.g., URLs, actions, content), their format, or how they're used. For a single undocumented parameter, the description fails to add any semantic value beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Browse websites and interact with web content' states a general purpose but lacks specificity. It mentions 'browse' and 'interact' as verbs with 'websites' and 'web content' as resources, but doesn't distinguish from sibling tools like 'web-search' or specify what type of interaction is possible. It's vague about scope and functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'web-search' or other siblings. The description implies a general web browsing context but doesn't specify use cases, prerequisites, or exclusions. There's no mention of when-not-to-use or comparisons to other tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

code-executionC

Execute code and return the result

ParametersJSON Schema
NameRequiredDescriptionDefault
parametersYes

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool executes code and returns a result, but lacks critical details such as execution environment (e.g., sandbox, permissions), safety implications (e.g., destructive effects, rate limits), or output format. This is a significant gap for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single sentence 'Execute code and return the result', which is front-loaded and wastes no words. Every part of the sentence contributes to the core purpose, making it efficient in structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of code execution (a mutation tool with potential security implications), no annotations, no output schema, and incomplete parameter documentation, the description is insufficient. It should address execution context, safety, and result details to be complete enough for an AI agent to use correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter ('parameters') with 0% description coverage, so the schema provides no semantic information. The description adds no meaning beyond the schema, failing to explain what 'parameters' should contain (e.g., code string, language spec, arguments). For a tool with low schema coverage, this is inadequate compensation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Execute code and return the result' states a clear verb ('execute') and resource ('code'), but it's vague about what type of code (e.g., programming language, environment) and lacks differentiation from sibling tools like 'browser' or 'file-io' that might also involve execution. It's not tautological but misses specificity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'browser' for web-based execution or 'file-io' for file operations. The description implies a general-purpose code execution but offers no context, exclusions, or prerequisites, leaving the agent to guess based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

file-ioC

Search and access file content

ParametersJSON Schema
NameRequiredDescriptionDefault
parametersYes

TDQS

C2.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Search and access file content' implies read operations, but it doesn't specify whether this tool can modify files, requires specific permissions, has rate limits, or what happens during errors. The description is too brief to provide meaningful behavioral context for safe invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise with just three words, which is efficient. However, it's arguably under-specified rather than optimally conciseβ€”it could benefit from slightly more detail without becoming verbose. The structure is simple but lacks front-loading of critical information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a parameter with 0% schema coverage, the description is incomplete. It doesn't compensate for the lack of structured data by explaining return values, error conditions, or parameter usage. For a tool with one parameter and potential file system interactions, this leaves significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 0% description coverage, and the tool description doesn't mention any parameters at all. The description 'Search and access file content' doesn't explain what the 'parameters' string should contain (e.g., file paths, search queries, access modes). This leaves the parameter completely undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Search and access file content' states a general purpose (searching and accessing files) but lacks specificity about what resources it operates on (local files, remote files, specific file types) and doesn't clearly distinguish from sibling tools like 'browser' or 'web-search' which might also access content. It's vague about the exact scope of file operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'browser' or 'web-search'. The description doesn't mention any prerequisites, constraints, or typical use cases. It's left to the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: browser for web interaction, code-execution for running code, file-io for file access, and web-search for information retrieval. There is no overlap in functionality, making tool selection straightforward for an agent.

Naming Consistency4/5

The tools follow a consistent snake_case naming convention, but there is a minor deviation with 'file-io' using a hyphen instead of an underscore. Overall, the naming is readable and predictable, with clear verb-noun patterns like 'browser' and 'web-search'.

Tool Count5/5

With 4 tools, the server is well-scoped for its purpose of providing general utility functions. Each tool serves a distinct and essential role, and the count is neither too sparse nor overwhelming, fitting typical utility server ranges.

Completeness4/5

The tool set covers key utility domains: web browsing, code execution, file access, and web search. Minor gaps might exist, such as lack of advanced file operations or specialized code environments, but agents can handle core tasks effectively with these tools.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server and local HTTP bridge designed to integrate remote upstream MCP tools into OpenClaw skills or local environments. It enables users to generate skill wrappers and proxy tool calls via a local HTTP bridge for use in Claude Desktop, Cursor, or OpenClaw.
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/alohays/openai-tool2mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server