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 Server Ask 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 config, connects to every MCP server except itself
├──[http]──▶ e.g. unreal-mcp
├──[stdio]─▶ e.g. postgres, perplexity
│
│ loop: OpenAI Responses API ──function_call──▶ forward to the owning MCP server
│ ◀──function_call_output──
▼
final verdict + trace (tool calls, tokens) back to ClaudeThe servers are read from the first file found in the directory the client starts this server in:
ASTRA_MCP_CONFIG, if set;.mcp.json(Claude Code);.cursor/mcp.json(Cursor);.vscode/mcp.json(VS Code,serverskey).
stdio, http (streamable HTTP) and sse servers are supported, and ${VAR} / ${VAR:-default} in commands, args, env, URLs and headers are expanded from the environment, as Claude Code does. With no config file, openai_chat works and astra_investigate reports where it looked.
Child 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: Claude Code Gemini MCP
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. The semaphore relies on Claude Code hooks; in other clients the tools work, but nothing stops the client from calling a server while the agent uses it.
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, an MCP client (Claude Code, Cursor, VS 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. The client starts it in the project directory, so the agent finds that project's config on its own.
Claude Code:
cd <your-project>
claude mcp add openai --scope local --env OPENAI_API_KEY=<your-key> -- node <repo>/dist/index.jsCursor (.cursor/mcp.json) or any client using the mcpServers format:
{
"mcpServers": {
"openai": { "command": "node", "args": ["<repo>/dist/index.js"], "env": { "OPENAI_API_KEY": "<your-key>" } }
}
}If your client doesn't start MCP servers in the project directory (astra_investigate then says where it looked), add "ASTRA_MCP_CONFIG": "<your-project>/.cursor/mcp.json" to env.
Keep the server name openai, or set ASTRA_SELF_NAME to the name you use: the server skips that entry (and any entry launching dist/index.js) to avoid launching itself. Then restart the client; on Claude Code, add the hook above.
Don't commit a config file containing your key: use --scope local, or ${OPENAI_API_KEY} in a shared file.
Configuration
Variable | Default | Description |
| (required) | OpenAI key |
| project config, see How it works | Explicit path of the config listing the servers the agent may use |
|
| 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.
The
deeptier needs access togpt-6-astraon your OpenAI account; otherwise usereasonor passmodel.
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.
Available Tools
2 toolsastra_investigateA
Delegate an investigation to an autonomous OpenAI agent (tier "deep" = GPT-6 Astra). The agent has direct access to the project's MCP servers (from the project's .mcp.json, .cursor/mcp.json or .vscode/mcp.json) and calls them on its own to answer the prompt. It may modify state to test something, but restores original values, never persists changes, and lists every modification in its answer. While it runs, the MCP servers it uses are locked for Claude Code (if the lock hook is installed). Use for independent second-opinion reviews, audits and verifications. Slow (30s-several minutes). Default tier is "reason"; request "deep" only for critical audits.
Inputs: prompt (required), tier, model, allowedServers.
openai_chatB
Use this tool when a user specifically requests to use one of OpenAI's models (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). This tool sends messages to OpenAI's chat completion API using the specified model.
Inputs: messages (required), tier, model.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have mostly distinct purposes: one is a direct synchronous chat completion call, the other delegates to an autonomous agent with MCP access. There is some residual overlap since both ultimately invoke OpenAI models (and 'astra_investigate' uses GPT-6 Astra, a model also reachable via openai_chat), which could make an agent hesitate on a vague 'use OpenAI to review this' request.
Both names follow a <prefix>_<action> snake_case pattern, which is reasonably predictable. The prefixes differ in kind (provider vs. product name) and 'chat' reads more like a noun than a verb, but neither is confusing.
Two tools is on the thin side for a server whose stated scope is OpenAI model access. Both tools earn their place, but the surface is narrow enough that the server feels borderline minimal rather than well-scoped.
Core capabilities (direct chat completion and autonomous agent delegation) are covered, but obvious adjacent operations are absent: no model listing, no way to poll or cancel a running investigation, and no status/result retrieval for async agent work. Agents can work around this by relying on the single blocking call, but it's a notable gap.
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.
Run EchoCall AI phone and chat agents from ChatGPT or Claude: calls, agents, knowledge and numbers.
Related MCP Servers
- AlicenseCqualityDmaintenanceQuery OpenAI models directly from Claude using MCP protocol.184MIT
- AlicenseCqualityDmaintenanceEnables 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.4MIT
- 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
- AlicenseNot gradedqualityDmaintenanceEnables Claude Code to leverage OpenAI models for expert code review, deep architecture analysis, and security audits, with automatic markdown report generation.MIT