OpenAI MCP Server

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.

Integrations

  • Allows querying OpenAI models (o3-mini and gpt-4o-mini) directly from Claude using the MCP protocol, enabling users to ask questions and receive responses from OpenAI's AI models

OpenAI MCP サーバー

MCPプロトコルを使用して、Claudeから直接OpenAIモデルをクエリできます。このフォークは、メッセージ処理が改善されたo3-miniおよびgpt-4o-miniモデルのサポートを追加します。

クライン自動インストール

Set up the MCP server from https://github.com/thadius83/mcp-server-openai. Use "github.com/thadius83/mcp-server-openai" as the server name in cline_mcp_settings.json. Analyse the readme and instructions below. Do not create new files in the repo, utilise the findings from pyproject.toml, src/mcp_server_openai/server.py, src/mcp_server_openai/llm.py Once installed, demonstrate the server's capabilities by using one of its tools. Installation Steps: # Clone the repository git clone https://github.com/thadius83/mcp-server-openai cd mcp-server-openai # Install the package pip install .` MCP Settings Configuration: The cline_mcp_settings.json should be configured with: Correct server name format: "github.com/thadius83/mcp-server-openai" Python module path structure for the server PYTHONPATH environment variable pointing to the project directory OpenAI API key passed as a command line argument Example configuration: { "mcpServers": { "github.com/thadius83/mcp-server-openai": { "command": "python", "args": [ "-m", "src.mcp_server_openai.server", "--openai-api-key", "your-openai-api-key" ], "env": { "PYTHONPATH": "/path/to/mcp-server-openai" }, "disabled": false, "autoApprove": [] } } } Requirements: Python >= 3.10 OpenAI API key Dependencies installed via pip (mcp>=0.9.1, openai>=1.0.0, click>=8.0.0, pytest-asyncio) Available Tools: Tool Name: ask-openai Description: Ask OpenAI assistant models a direct question Models Available: o3-mini (default) gpt-4o-mini Input Schema: { "query": "Your question here", "model": "o3-mini" // optional, defaults to o3-mini }

特徴

  • OpenAIのAPIとの直接統合
  • 複数のモデルのサポート:
    • o3-mini(デフォルト):簡潔な応答に最適化
    • gpt-4o-mini: より詳細な応答のための強化モデル
  • 設定可能なメッセージフォーマット
  • エラー処理とログ記録
  • MCPプロトコルによるシンプルなインターフェース

インストール

Smithery経由でインストール

Smithery経由で Claude Desktop 用の OpenAI MCP Server を自動的にインストールするには:

npx -y @smithery/cli install @thadius83/mcp-server-openai --client claude

手動インストール

  1. リポジトリのクローンを作成します:
git clone https://github.com/thadius83/mcp-server-openai.git cd mcp-server-openai # Install dependencies pip install -e .
  1. Claude デスクトップを構成する:

このサーバーを既存のMCP設定に追加します。注: 既存のMCPサーバーは設定にそのまま残し、このサーバーをそれらと一緒に追加するだけです。

位置:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json
  • Linux: デフォルトのMCP設定の場所については、ホームディレクトリ( ~/ )を確認してください。
{ "mcpServers": { // ... keep your existing MCP servers here ... "github.com/thadius83/mcp-server-openai": { "command": "python", "args": ["-m", "src.mcp_server_openai.server", "--openai-api-key", "your-key-here"], "env": { "PYTHONPATH": "/path/to/your/mcp-server-openai" } } } }
  1. OpenAI APIキーを取得する:
    • OpenAIのウェブサイトをご覧ください
    • アカウントを作成するかログインしてください
    • API設定に移動する
    • 新しいAPIキーを生成する
    • 上記のように設定ファイルにキーを追加します
  2. クロードを再起動:
    • 設定を更新した後、変更を有効にするためにClaudeを再起動します。

使用法

サーバーは、OpenAIモデルのクエリに使用できるツールask-openaiを1つ提供しています。Claudeでは、use_mcp_tool コマンドを使用して直接使用できます。

<use_mcp_tool> <server_name>github.com/thadius83/mcp-server-openai</server_name> <tool_name>ask-openai</tool_name> <arguments> { "query": "What are the key features of Python's asyncio library?", "model": "o3-mini" // Optional, defaults to o3-mini } </arguments> </use_mcp_tool>

モデル比較

  1. 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
  2. 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.

応答フォーマット

ツールは標準化された形式で応答を返します。

{ "content": [ { "type": "text", "text": "Response from the model..." } ] }

トラブルシューティング

  1. サーバーが見つかりません:
    • 設定内のPYTHONPATHが正しいディレクトリを指していることを確認してください
    • Pythonとpipが正しくインストールされていることを確認する
    • エラーを確認するには、 python -m src.mcp_server_openai.server --openai-api-key your-key-here直接実行してみてください。
  2. 認証エラー:
    • OpenAI APIキーが有効であることを確認してください
    • キーがargs配列に正しく渡されていることを確認する
    • キーに余分なスペースや文字がないことを確認してください
  3. モデルエラー:
    • サポートされているモデル(o3-mini または gpt-4o-mini)を使用していることを確認してください
    • クエリが空でないことを確認してください
    • トークン制限を超えていないことを確認する

発達

# Install development dependencies pip install -e ".[dev]" # Run tests pytest -v test_openai.py -s

オリジナルからの変更点

  • o3-miniおよびgpt-4o-miniモデルのサポートを追加しました
  • メッセージのフォーマットの改善
  • 互換性向上のため温度パラメータを削除しました
  • 詳細な使用例を含むドキュメントを更新しました
  • モデルの比較と応答例を追加しました
  • 強化されたインストール手順
  • トラブルシューティングガイドを追加しました

ライセンス

MITライセンス

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

MCP プロトコルを介して OpenAI モデルとの統合を可能にし、Claude Desktop で使用するための簡潔で詳細な応答をサポートします。

  1. Cline Auto Install
    1. Features
      1. Installation
        1. Installing via Smithery
        2. Manual Installation
      2. Usage
        1. Model Comparison
        2. Response Format
      3. Troubleshooting
        1. Development
          1. Changes from Original
            1. License
              ID: fzgyk9mw5e