Skip to main content
Glama

OpenAI GPT MCP Server

A local Model Context Protocol server that provides OpenAI GPT text generation over standard input/output.

Prerequisites

  • Node.js 18 or newer

  • An OpenAI API key

Related MCP server: gpt-mcp

Install and build

npm install
npm run build

Copy .env.example to .env and set your API key:

OPENAI_API_KEY=your_api_key

OPENAI_MODEL is optional and defaults to gpt-5. OPENAI_IMAGE_MODEL is optional and defaults to gpt-image-2.

MCP client configuration

Build first, then add this server to your MCP client's configuration. Replace <absolute-path-to-repository> with the absolute path to your clone.

{
  "mcpServers": {
    "openai-gpt": {
      "command": "node",
      "args": ["<absolute-path-to-repository>\\dist\\index.js"]
    }
  }
}

Tool: generate_text

Required input:

  • prompt: text to send to the model.

Optional inputs:

  • instructions: system-level behavior for the response.

  • model: a GPT model ID, overriding OPENAI_MODEL.

  • max_output_tokens: maximum response size, from 1 through 16,384.

The server uses the OpenAI Responses API and returns generated text to the MCP client. It never writes API keys to output or logs.

Tool: generate_image

Generates one PNG image and returns it directly to the MCP client.

  • prompt (required): detailed image description.

  • model (optional): image model ID, overriding OPENAI_IMAGE_MODEL.

  • size (optional): 1024x1024, 1536x1024, or 1024x1536.

  • quality (optional): low, medium, or high.

Image generation consumes OpenAI API credits separately from Claude usage.

Run directly

npm start

For interactive inspection:

npm run inspect

Available Tools

2 tools
generate_imageGenerate an image with OpenAIB

Generate one image from a text prompt using OpenAI's image generation API.

Inputs: prompt (required), size, model, quality.

generate_textGenerate text with OpenAIA

Generate a text response using an OpenAI GPT model via the Responses API.

Inputs: prompt (required), model, instructions, max_output_tokens.

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 2 tools

    Disambiguation5/5

    The two tools are clearly distinct: one generates text and the other generates images. There is no overlap or ambiguity in their purposes.

    Naming Consistency5/5

    Both tools follow the same consistent generate_noun pattern using snake_case. The naming convention is uniform and predictable.

    Tool Count3/5

    Two tools is borderline for a coherent server; they are well-scoped but the surface feels thin for a general OpenAI GPT server. Each tool earns its place, but the count is on the low end.

    Completeness4/5

    The two-generation capabilities cover the core domain of text and image generation with no obvious dead ends. Minor gaps exist if considering broader OpenAI features like embeddings or audio, but for the stated GPT-focused purpose the coverage is reasonable.

    Related MCP Connectors

    Related MCP Servers