MCP OpenAI Server
Provides a tool to send chat messages to OpenAI's models (e.g., gpt-4o, o1-preview) and receive responses, enabling AI agents to leverage OpenAI's chat completion API.
Click on "Deploy 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., "@MCP OpenAI ServerAsk gpt-4o to explain the concept of entanglement."
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.
MCP OpenAI — Astra second opinion
An MCP server that gives Claude Code a second, independent opinion from OpenAI models.
It exposes two tools:
openai_chat: ask an OpenAI model a question and get a text answer.astra_investigate: hand a task to an autonomous OpenAI agent that inspects the project on its own through the same MCP servers Claude uses (Unreal Editor, Perplexity, ...) and reports back a verdict with evidence.
The point of astra_investigate is independence: the agent is not fed Claude's summary of the situation, it looks at the real state of the project with its own criteria.
Fork of mzxrai/mcp-openai, extended with the autonomous agent, model tiers and a cross-agent semaphore.
How it works
Claude Code
│ astra_investigate(prompt, tier)
▼
this server (stdio MCP)
│ reads the project .mcp.json, connects to every MCP server except itself
├──[http]──▶ unreal-mcp
├──[stdio]─▶ perplexity
│
│ loop: OpenAI Responses API ──function_call──▶ forward to the owning MCP server
│ ◀──function_call_output──
▼
final verdict + trace (tool calls, tokens) back to ClaudeChild MCP servers are connected lazily on the first astra_investigate call, so openai_chat keeps working even when, say, the Unreal Editor is closed. Servers that fail to connect are skipped and listed as unavailable in the trace.
Every investigation re-checks the servers, so you can open or close the Unreal Editor at any time without restarting anything:
a server that was unavailable is retried, and picked up as soon as it is running;
an already connected server is pinged first; if it stopped answering (e.g. the editor was closed and reopened, which invalidates the old session), the stale connection is dropped and a new one is opened.
A server that goes down during an investigation makes the remaining calls fail; the agent sees the errors and reports them.
Related MCP server: GPT-MCP Bridge
Tools
openai_chat
Argument | Required | Description |
| yes | Array of |
| no |
|
| no | Exact model, overrides |
astra_investigate
Argument | Required | Description |
| yes | The task. Be specific: the agent decides which tools to call |
| no |
|
| no | Exact model, overrides |
| no | Restrict the agent to some MCP servers, e.g. |
Example prompts, as you would type them to Claude:
Use astra_investigate with tier deep: verify that PCG_CliffRockScatter has slope
filters that really catch vertical walls. Verdict plus suggested fixes.Ask astra_investigate to test whether the maxThreshold of FilterCliffSlopes can be
changed via MCP, then restore it.The answer ends with a trace like:
Astra trace: model=gpt-6-astra, servers=unreal-mcp, perplexity
Tokens: 73430 in (59664 cached) / 890 out
Tool calls (7):
- unreal-mcp__list_toolsets {}
- unreal-mcp__call_tool {"toolset_name":"PCGToolset.PCGToolset","tool_name":"UpdateNode",...}
...Model tiers
The default is never the expensive model: ask for deep explicitly.
Tier | Model | Use for |
|
| Trivial lookups. Noticeably less reliable on facts |
|
| Most checks and reviews |
|
| Critical audits. Much slower and more expensive than the other tiers |
model accepts any of these, all verified on both the Chat Completions and the Responses API with function calling:
gpt-6-astra, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-5.5, gpt-5.4, gpt-5.4-mini, gpt-5, gpt-5-mini, o3, o4-mini, gpt-4.1, gpt-4.1-mini, gpt-4o, gpt-4o-mini
Tiers and the model list live in src/models.ts. Verify a model before adding it.
What the agent may do
The agent has write access to the MCP servers, because some questions can only be answered by trying something. Its instructions require it to:
read and note original values before changing anything;
restore every original value and verify the restore by reading it back;
never save assets, levels or packages, and never delete assets;
end its answer with a Modifications table (object, property, original, test value, restored?).
Changes therefore stay in memory in the editor: if something goes wrong, close without saving or use Undo.
Two unreal-mcp toolsets are always blocked for the agent: ProgrammaticToolset (runs Python in the editor) and SlateInspectorToolset (simulates UI input).
Semaphore between Claude and the agent
Claude and the agent must not drive the same MCP server at the same time, especially while the agent is in the middle of a "change, test, restore" sequence.
During an investigation the agent holds a lock on each server it uses, until the investigation ends.
A Claude Code hook takes a short lock around each of Claude's own MCP calls and denies the call if the agent holds the server:
MCP server "unreal-mcp" is locked by Astra (pid 18616, since 13:05:48) running astra_investigate.If Claude has a call in flight, the agent waits (up to 90 s) before touching that server.
Locks of dead processes are ignored, so a crash never leaves a server blocked.
Locks are files in ~/.astra-mcp-locks/. Install the hook in every project whose Claude sessions use the same MCP servers, in .claude/settings.local.json:
{
"hooks": {
"PreToolUse": [
{ "matcher": "mcp__.*", "hooks": [{ "type": "command", "command": "node", "args": ["<repo>/hooks/mcp-lock-hook.mjs"], "timeout": 15 }] }
],
"PostToolUse": [
{ "matcher": "mcp__.*", "hooks": [{ "type": "command", "command": "node", "args": ["<repo>/hooks/mcp-lock-hook.mjs"], "timeout": 15 }] }
],
"PostToolUseFailure": [
{ "matcher": "mcp__.*", "hooks": [{ "type": "command", "command": "node", "args": ["<repo>/hooks/mcp-lock-hook.mjs"], "timeout": 15 }] }
]
}
}The hook imports dist/lock.js, so the project must be built. If the hook itself fails, it lets the call through.
Installation
Requirements: Node.js 18+, an OpenAI API key, Claude Code.
git clone https://github.com/Akira-AA83/MCP-OPENAI.git
cd MCP-OPENAI
npm install # also builds dist/ through the prepare scriptRegister it in the project that holds the MCP servers the agent should use:
cd <your-project>
claude mcp add openai --scope project \
--env OPENAI_API_KEY=<your-key> \
--env ASTRA_MCP_CONFIG=<your-project>/.mcp.json \
-- node <repo>/dist/index.jsKeep the server name openai, or set ASTRA_SELF_NAME to the name you use: the server skips that entry to avoid launching itself. Then restart Claude Code (or claude --continue) and add the hook above.
--scope project writes the key into .mcp.json: don't commit that file, or use --scope local.
Configuration
Variable | Default | Description |
| (required) | OpenAI key |
|
|
|
|
| Name of this server in that file, excluded to avoid recursion |
|
| Max model round trips per investigation |
|
| Max output tokens per round trip |
|
| Tool results longer than this are truncated; images are always omitted |
|
| Timeout of a single child tool call |
|
| How long the agent waits for a server Claude is using |
|
| Expiry of Claude's per-call lock, in case PostToolUse never fires |
|
| Lock directory, shared by server and hook |
Limitations
Servers that authenticate through Claude Code's own OAuth (e.g. Atlassian) can't be reused by the agent and are skipped.
Tool calls within one iteration run sequentially; no streaming.
Only verified on Windows.
Development
npm run build # tsc into dist/
npm run watch # rebuild on changeFile | Role |
| MCP server, |
| Agent loop over the Responses API, instructions, trace |
| Aggregates child tools, naming, policy, result truncation |
| Connects to child MCP servers (stdio / HTTP) |
| Reads |
| Verified models and tiers |
| Semaphore shared by the server and the hook |
| Claude Code hook enforcing the semaphore |
License
MIT. Original openai_chat server by mzxrai.
This server cannot be deployed
Maintenance
Related MCP Connectors
Claude makes real phone calls for you — in many languages, with transcript and outcome back in chat.
One workspace of tools for Claude and ChatGPT: connect 600+ apps, generate media, build tools.
Use AI models for chat, image, and video generation from Claude Code and other MCP hosts.
Deploy, monitor, and manage your OpenClaw AI assistants via natural language.
Related MCP Servers
- AlicenseCqualityDmaintenanceQuery OpenAI models directly from Claude using MCP protocol.184MIT
- FlicenseNot gradedqualityNot gradedmaintenanceEnables Claude and other MCP-compatible tools to communicate with OpenAI's GPT models (GPT-5, GPT-5-mini, o3) with conversation history and session management. Features advanced controls like reasoning effort settings, token tracking, and parallel conversation sessions for efficient AI workflows.4 npm-
- FlicenseCqualityDmaintenanceEnables Claude Code to call Gemini models through an OpenAI-compatible API, providing tools for deep analysis, brainstorming, code review, and general queries using Gemini's capabilities.4-
- AlicenseAqualityDmaintenanceEnables 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.11MIT