openai-mcp-server
Provides tools for interacting with OpenAI's API, enabling text generation, chat completions, model discovery, image generation and editing, audio transcription, speech synthesis, embeddings, and content moderation.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@openai-mcp-serverList the models my API key can access."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
openai-mcp-server
An MCP server that puts the OpenAI API into any MCP client — Claude Desktop, Claude Code, Cowork, Cursor, or anything else that speaks the protocol.
Nine tools: text generation, chat completions, model discovery, image generation and editing, transcription, speech synthesis, embeddings, and moderation.
Why this exists
There is no official OpenAI plugin in the Claude plugin catalogue. This server is the equivalent, built as a normal open-source project you own and can extend.
Related MCP server: OpenAI Assistant MCP Server
Tools
Tool | What it does | Read-only |
| Generate text via the Responses API — instructions, reasoning effort, forced JSON, response chaining | no |
| Send an explicit message history via Chat Completions | no |
| List the model IDs your key can use, filtered and paginated | yes |
| Create images from a prompt, written to disk | no |
| Edit or combine existing images, optionally with a mask | no |
| Transcribe a local audio file | no |
| Synthesize speech to an audio file | no |
| Embed texts for semantic search, written to JSON | no |
| Check text against OpenAI's moderation policy | yes |
Every tool takes response_format: "markdown" | "json" — markdown for reading, JSON for processing. All tools also return structuredContent, so clients that understand output schemas get typed data without parsing.
Requirements
Node.js 20 or newer
An OpenAI API key with available quota
Install
git clone <your-repo-url> openai-mcp-server
cd openai-mcp-server
npm install
npm run buildVerify the build:
node dist/index.js --version # prints 1.0.0
node dist/index.js --help # lists all environment variablesConfigure your MCP client
The server speaks MCP over stdio, so the client launches it as a subprocess.
Claude Desktop
Edit claude_desktop_config.json:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"openai": {
"command": "node",
"args": ["/absolute/path/to/openai-mcp-server/dist/index.js"],
"env": {
"OPENAI_API_KEY": "sk-proj-...",
"OPENAI_MCP_OUTPUT_DIR": "/Users/you/openai-mcp-output"
}
}
}
}Restart Claude Desktop afterwards.
Claude Code
claude mcp add openai \
--env OPENAI_API_KEY=sk-proj-... \
-- node /absolute/path/to/openai-mcp-server/dist/index.jsAny other MCP client
Point it at node /absolute/path/to/dist/index.js with OPENAI_API_KEY in the environment.
Configuration
Only OPENAI_API_KEY is required. See .env.example for a copyable template.
Variable | Default | Purpose |
| — | Required. Your OpenAI API key |
| OpenAI's default | Alternative endpoint (Azure, gateway, proxy) |
| — | Organization ID |
| — | Project ID |
|
| Where generated files are written |
| output dir only | Colon-separated absolute dirs the server may read from |
|
| Per-request timeout |
|
| Retries for transient failures |
|
| Default text model |
|
| Default image model |
|
| Default embedding model |
|
| Default transcription model |
|
| Default speech model |
|
| Default moderation model |
Model IDs change. OpenAI adds, renames and retires models, and access differs per project. Every default is overridable, and openai_list_models reports what your key can actually reach — if a call fails with "model not found", start there.
Security model
Two deliberate constraints:
The filesystem is sandboxed. Tools that read local files (openai_edit_image, openai_transcribe_audio) accept only absolute paths inside OPENAI_MCP_ALLOWED_DIRS. Paths are canonicalised with realpath before the check, so symlinks and ../ traversal cannot escape. The output directory is always allowed; nothing else is, until you add it. Keep that list narrow.
Binary output never enters the conversation. Images, audio and embedding vectors are written to disk and only their paths are returned. A single base64 PNG or a 3072-float vector would otherwise flood the model's context window.
The API key is read from the environment only — it never appears in a tool argument, a log line, or an error message.
Examples
Ask your MCP client in plain language; it picks the tool.
"Use the OpenAI server to summarise this text in three sentences."
→ openai_generate_text
"Which OpenAI embedding models can I use?"
→ openai_list_models with filter="embedding"
"Generate a transparent PNG logo of a blue fox."
→ openai_generate_image with background="transparent"
"Transcribe ~/Documents/audio/interview.m4a in German."
→ openai_transcribe_audio with language="de" — requires that directory in OPENAI_MCP_ALLOWED_DIRS
"Embed these 40 product descriptions so I can cluster them."
→ openai_create_embeddings, then read the JSON file it reports
Development
npm run dev # watch mode via tsx
npm run typecheck # tsc --noEmit, strict
npm test # unit tests, no network calls
npm run build # compile to dist/The test suite covers configuration parsing, the filesystem sandbox (including symlink escape and traversal), error formatting and response shaping. It never contacts the OpenAI API.
Project layout
src/
├── index.ts entry point, server assembly, CLI flags
├── config.ts environment parsing and validation
├── client.ts OpenAI client construction
├── constants.ts defaults, limits, response formats
├── errors.ts API errors → actionable agent messages
├── files.ts sandboxed read/write
├── format.ts tool result shaping, character limit
└── tools/
├── text.ts generate_text, chat_completion
├── models.ts list_models
├── images.ts generate_image, edit_image
├── audio.ts transcribe_audio, text_to_speech
└── analysis.ts create_embeddings, moderate_contentAdding a tool
Write a Zod schema with
.strict()and a.describe()on every field.Register it with
server.registerTool(name, config, handler)— includetitle,description,inputSchema,outputSchemaandannotations.Return via
toolResult(...)so markdown/JSON handling and the character limit stay consistent; catch errors witherrorResult(...).Add the registration call in
src/index.tsand a test intest/.
Troubleshooting
Symptom | Cause |
Client shows no tools | Wrong path in the config, or the project was not built ( |
| The key is missing from the client's |
| The path is outside |
| The model ID does not exist for your key — run |
| Retry later, or check billing on the project |
The server logs to stderr; stdout carries the JSON-RPC stream and must stay clean.
License
MIT — see LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables interaction with OpenAI's Chat Completion and Assistants APIs, supporting assistant management, file operations, and direct queries to GPT models through standardized MCP tools.92
- AlicenseAqualityCmaintenanceProvides access to OpenAI's ChatGPT API with web search capabilities for Claude and other MCP clients. Supports various GPT models with configurable parameters like reasoning effort, temperature, and streaming mode.1103MIT
- AlicenseBqualityDmaintenanceEnables MCP-compatible clients to leverage OpenAI's multimodal capabilities (vision, image generation, speech-to-text, text-to-speech) through file-oriented tools with a security-first architecture.101MIT
Related MCP Connectors
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Connect MCP clients to 2,000+ AI models without managing provider API keys.
MCP server for AI dialogue using various LLM models via AceDataCloud
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/piorkowskim79/openai-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server