MCP HubMCP Hub
mzxrai

mcp-openai

by: mzxrai

Chat with OpenAI models from Claude Desktop

41created 06/12/2024
Visit
OpenAI
Claude

📌Overview

Purpose: To provide a seamless integration of OpenAI's models for users of the Claude Desktop app through a Model Context Protocol (MCP) server.

Overview: The MCP OpenAI Server allows users to interact directly with OpenAI's chat models via the Claude Desktop app, enhancing the capabilities of chat interactions by supporting multiple powerful models in a streamlined manner.

Key Features:

  • Direct Integration with OpenAI's Chat Models: Enables users to interact with various OpenAI models, enhancing conversational experiences.

  • Support for Multiple Models: Compatible with gpt-4o, gpt-4o-mini, o1-preview, and o1-mini, offering flexibility in model selection for different use cases.

  • Simple Message Passing Interface: Facilitates straightforward communication between the user and OpenAI models, making the integration user-friendly.

  • Basic Error Handling: Provides initial support to handle errors gracefully, improving user experience.


MCP OpenAI Server

A Model Context Protocol (MCP) server that lets you seamlessly use OpenAI's models right from Claude.

Features

  • Direct integration with OpenAI's chat models
  • Support for multiple models including:
    • gpt-4o
    • gpt-4o-mini
    • o1-preview
    • o1-mini
  • Simple message passing interface
  • Basic error handling

Prerequisites

  • Node.js >= 18 (includes npm and npx)
  • Claude Desktop app
  • OpenAI API key

Installation

Make sure you have the Claude Desktop app installed and have requested an OpenAI API key.

Add this entry to your claude_desktop_config.json (on Mac, located at ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "mcp-openai": {
      "command": "npx",
      "args": ["-y", "@mzxrai/mcp-openai@latest"],
      "env": {
        "OPENAI_API_KEY": "your-api-key-here (get one from https://platform.openai.com/api-keys)"
      }
    }
  }
}

This config lets Claude Desktop start the OpenAI MCP server when needed.

Usage

Start chatting with Claude and ask it to use OpenAI's models. For example:

Can you ask o1 what it thinks about this problem?

or

What does gpt-4o think about this?

Supported models:

  • gpt-4o (default)
  • gpt-4o-mini
  • o1-preview
  • o1-mini

Tools

  • openai_chat
    • Sends messages to OpenAI's chat completion API
    • Arguments:
      • messages: Array of messages (required)
      • model: Model to use (optional, defaults to gpt-4o)

Known Issues

As this is alpha software, bugs may occur. Check Claude Desktop's MCP logs if issues arise:

tail -n 20 -f ~/Library/Logs/Claude/mcp*.log

Development

To set up the development environment:

pnpm install
pnpm build
pnpm watch
pnpm dev

Requirements

  • Node.js >= 18
  • OpenAI API key

Verified Platforms

  • macOS
  • Linux (not verified)

License

MIT

Author

mzxrai (https://github.com/mzxrai)