Openai MCP README

The full upstream README, mirrored for reference. Install config, tool schemas, adoption signals and our own overview live on the Openai MCP listing page.

openai-mcp

npm version CI License: MIT

openai-mcp MCP server – quality and maintenance score on Glama

Use OpenAI models from Claude, Cursor and any other MCP client: text, images, speech, transcription, embeddings and moderation.

Features

  • Each tool stays off until you set its model variable, so you choose which models the client can use. Only list_models is always available.
  • Generated and edited images and generated speech are saved to files.
  • Images and audio can be given as URLs or local file paths.

Setup

Requires Node.js 20 or higher and an OpenAI API key.

Each tool is enabled by its own model setting. Omit a setting to leave that tool disabled. Separate multiple model IDs with commas, or use * to allow any model. Replace sk-... with your OpenAI API key.

config.json
{
  "mcpServers": {
    "openai-mcp": {
      "command": "npx",
      "args": ["-y", "@dancommitsgit/openai-mcp"],
      "env": {
        "OPENAI_API_KEY": "sk-...",
        "OPENAI_MCP_TEXT_MODELS": "gpt-5.4-nano",
        "OPENAI_MCP_IMAGE_MODELS": "gpt-image-2.5-flare",
        "OPENAI_MCP_EMBEDDING_MODELS": "text-embedding-3-small",
        "OPENAI_MCP_SPEECH_MODELS": "gpt-4o-mini-tts",
        "OPENAI_MCP_TRANSCRIPTION_MODELS": "gpt-4o-mini-transcribe",
        "OPENAI_MCP_TRANSLATION_MODELS": "whisper-1",
        "OPENAI_MCP_MODERATION_MODELS": "omni-moderation-latest"
      }
    }
  }
}

A missing or invalid API key is reported as an error on the first tool call, not when the server starts. A request for a model that is not in the tool's list is rejected.

Claude Code
Terminal
claude mcp add --scope user --env OPENAI_API_KEY=sk-... --env OPENAI_MCP_TEXT_MODELS=gpt-5.4-nano --env OPENAI_MCP_IMAGE_MODELS=gpt-image-2.5-flare --transport stdio openai-mcp -- npx -y @dancommitsgit/openai-mcp

Add one more --env for each other model setting in the JSON above. Keep --transport stdio after the last --env, or the server name is read as another variable.

This also applies to the Code tab in the Claude desktop app. Drop --scope user to make the server available only in the current project.

Claude Desktop

For the regular chat app. If you use the Code tab in the desktop app, use the Claude Code command instead.

Open Settings → Developer → Edit Config, paste the JSON above into claude_desktop_config.json, and restart Claude Desktop. The file is at ~/Library/Application Support/Claude/ on macOS and %APPDATA%\Claude\ on Windows.

Cursor

Save the JSON above as .cursor/mcp.json in your project, or as ~/.cursor/mcp.json to use it in every project.

VS Code

Add the server to .vscode/mcp.json. VS Code asks for the API key the first time the server starts and stores it securely. Add other OPENAI_MCP_*_MODELS entries as in the JSON above.

config.json
{
  "inputs": [
    {
      "type": "promptString",
      "id": "openai-api-key",
      "description": "OpenAI API key",
      "password": true
    }
  ],
  "servers": {
    "openai-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@dancommitsgit/openai-mcp"],
      "env": {
        "OPENAI_API_KEY": "${input:openai-api-key}",
        "OPENAI_MCP_TEXT_MODELS": "gpt-5.4-nano",
        "OPENAI_MCP_IMAGE_MODELS": "gpt-image-2.5-flare"
      }
    }
  }
}

Build from source

bash
git clone https://github.com/DanCommitsGit/openai-mcp.git
cd openai-mcp
npm install
npm run build

Then point your client at the compiled entry point, keeping the same env as above:

config.json
{
  "command": "node",
  "args": ["/PATH/TO/openai-mcp/build/index.js"]
}

See CONTRIBUTING.md to run the tests and open a pull request.

Tools

ToolNeedsDescription
generate_textOPENAI_MCP_TEXT_MODELSSend a prompt, optional instructions, images, and web search to an OpenAI model
count_tokensOPENAI_MCP_TEXT_MODELSCount the input tokens a generate_text request would use
generate_imageOPENAI_MCP_IMAGE_MODELSGenerate one or more images from a text prompt
edit_imageOPENAI_MCP_IMAGE_MODELSEdit or combine existing images using a text prompt
generate_speechOPENAI_MCP_SPEECH_MODELSConvert text to spoken audio
transcribe_audioOPENAI_MCP_TRANSCRIPTION_MODELSTranscribe audio from a URL or local file
translate_audioOPENAI_MCP_TRANSLATION_MODELSTranslate audio from a URL or local file into English text
create_embeddingsOPENAI_MCP_EMBEDDING_MODELSGet vector embeddings for one or more pieces of text
create_moderationOPENAI_MCP_MODERATION_MODELSCheck text for potentially harmful content
list_modelsNoneList available models

Image and speech tools save files to your OS temp directory, unless the client passes outputPath, and return the file path.


This is an unofficial project and is not affiliated with OpenAI.