Skip to main content
Glama

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.

Related MCP server: OpenAI MCP Server

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.

{
  "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 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.

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.

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

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.

{
  "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

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:

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

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

Tools

Tool

Needs

Description

generate_text

OPENAI_MCP_TEXT_MODELS

Send a prompt, optional instructions, images, and web search to an OpenAI model

count_tokens

OPENAI_MCP_TEXT_MODELS

Count the input tokens a generate_text request would use

generate_image

OPENAI_MCP_IMAGE_MODELS

Generate one or more images from a text prompt

edit_image

OPENAI_MCP_IMAGE_MODELS

Edit or combine existing images using a text prompt

generate_speech

OPENAI_MCP_SPEECH_MODELS

Convert text to spoken audio

transcribe_audio

OPENAI_MCP_TRANSCRIPTION_MODELS

Transcribe audio from a URL or local file

translate_audio

OPENAI_MCP_TRANSLATION_MODELS

Translate audio from a URL or local file into English text

create_embeddings

OPENAI_MCP_EMBEDDING_MODELS

Get vector embeddings for one or more pieces of text

create_moderation

OPENAI_MCP_MODERATION_MODELS

Check text for potentially harmful content

list_models

None

List 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.

Available Tools

10 tools
count_tokensCount tokensA
Read-only

Count the input tokens a generate_text request would use, without running the model

Inputs: model (required), prompt (required), images, webSearch, +1 more.

create_embeddingsCreate embeddingsC
Read-only

Get vector embeddings for one or more pieces of text

Inputs: input (required), model (required).

create_moderationCreate moderationA
Read-only

Check text for potentially harmful content using an OpenAI moderation model. Returns, for each input, whether it was flagged plus per-category flags and scores

Inputs: input (required), model (required).

edit_imageEdit imageA
Destructive

Edit or combine existing images using a text prompt and an OpenAI image model. By default returns the local file path(s) the result was saved to rather than inline image data; set returnAs to 'base64' for inline data instead

Inputs: model (required), images (required), prompt (required), n, +4 more.

generate_imageGenerate imageA
Destructive

Generate an image from a text prompt using an OpenAI image model. By default returns the local file path(s) the image was saved to rather than inline image data; set returnAs to 'base64' for inline data instead

Inputs: model (required), prompt (required), n, size, +2 more.

generate_speechGenerate speechA
Destructive

Convert text to spoken audio using an OpenAI text-to-speech model. By default returns the local file path the audio was saved to rather than inline data; set returnAs to 'base64' for inline audio instead

Inputs: input (required), model (required), speed, voice, +4 more.

generate_textGenerate textA
Read-only

Send a prompt to an OpenAI model and return its text reply. Pass images to ask a vision-capable model about them

Inputs: model (required), prompt (required), images, webSearch, +1 more.

list_modelsList modelsA
Read-only

List available OpenAI models. Returns configured models unless a tool allows any model

Inputs: no named parameters.

transcribe_audioTranscribe audioB
Read-only

Transcribe spoken audio to text using an OpenAI speech-to-text model

Inputs: file (required), model (required), format, prompt, +1 more.

translate_audioTranslate audioA
Read-only

Translate spoken audio in any supported language into English text using an OpenAI speech-to-text model. Output may occasionally come back untranslated, in its original language

Inputs: file (required), model (required), format, prompt.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools target clearly distinct OpenAI capabilities: text generation, token counting, embeddings, moderation, image generation/editing, model listing, and speech generation/transcription/translation. The only mild overlap is transcribe_audio versus translate_audio, since both convert speech to text, though the descriptions make the translation-to-English distinction reasonably clear.

    Naming Consistency4/5

    All names are snake_case and follow a verb_noun structure, which is highly predictable. There is a minor inconsistency in verb choice between create_embeddings/create_moderation and generate_text/generate_image/generate_speech, but the pattern remains readable.

    Tool Count5/5

    Ten tools is a well-scoped set for an OpenAI API wrapper, covering major modalities without obvious filler. Each tool maps to a recognizable OpenAI capability and earns its place.

    Completeness4/5

    The surface covers text generation, vision input, token counting, embeddings, moderation, image generation/editing, model listing, TTS, transcription, and translation. Minor gaps exist around other OpenAI API areas such as fine-tuning, files, or assistants, but core model-inference workflows are well covered.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      Enables integration with OpenAI models through the MCP protocol, supporting concise and detailed responses for use with Claude Desktop.
      1
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A universal server that enables MCP-compatible clients (like Claude Desktop, Cursor, VS Code) to access OpenAI's APIs for chat completions, image generation, embeddings, and model listing through a standardized interface.
      33 npm
      7
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables Claude to directly invoke OpenAI's chat models (GPT-4o, GPT-4o-mini, o1-preview, o1-mini) through a Model Context Protocol integration, allowing users to query and compare responses from different AI models within Claude Desktop.
      1
      1
      MIT