Integrates OpenAI's GPT-5 models and Codex CLI to provide autonomous agents for multi-step task execution, web search capabilities, and advanced code analysis and refactoring.
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., "@gpt5mcprefactor this module to use async/await and optimize performance"
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.
gpt5mcp
MCP server for OpenAI GPT-5 API integration with Claude Code. Provides gpt5_agent and gpt5_codex tools.
Setup
Option A: npm install (recommended)
Option B: From source
Option C: Manual config
Create/edit ~/.claude/.mcp.json:
Codex CLI Setup (for gpt5_codex tool)
The gpt5_codex tool requires OpenAI's Codex CLI. Skip this if you only need gpt5_agent.
Verify
Restart Claude Code and check:
You should see gpt5mcp with tools gpt5_agent and gpt5_codex.
Environment Variables
Variable | Required | Description |
| Yes | OpenAI API key with GPT-5 access |
| No | Path to Codex CLI binary (for |
Active Tools
GPT-5 Agent (gpt5_agent)
Autonomous agent with SSE streaming that solves complex multi-step tasks. Supports tool orchestration, web search, code interpreter, and file operations.
Key Parameters:
Parameter | Default | Description |
| required | Task description |
|
| Model: |
|
|
|
|
|
|
| 10 | Max agent loops (1-20) |
| true | Enable web search |
| false | Enable code execution |
| false | Enable file read/write |
| true | Save output to |
| - | Continue previous conversation |
Examples:
GPT-5 Codex (gpt5_codex)
Deep code analysis via Codex CLI. Spawns codex binary for autonomous code editing.
Key Parameters:
Parameter | Default | Description |
| required | Task for Codex |
|
| Model: |
|
|
|
|
|
|
| - | Single file input (100KB max) |
| - | Multiple files (200KB total) |
|
|
|
Edit Modes:
research- Read-only analysis, no file changesauto_edit- Prompts before each editfull_auto- Auto-applies safe editsdangerous- No restrictions (use with caution)
Example:
Inactive Tools
Disabled by default for performance. Enable in src/tools/index.ts:
Tool | Description |
| Web search via OpenAI Responses API |
| File read/write/delete |
| Execute Python/JavaScript |
| DALL-E 3 / GPT-Image-1 |
| Define custom reusable functions |
To enable:
Then: npm run build and restart Claude Code.
Architecture
Streaming Implementation
GPT-5 Agent uses SSE (Server-Sent Events) to prevent MCP timeout:
Activity timeout: 120 seconds without data
Request timeout: up to 15 minutes for complex tasks
Activated when
reasoning_effortis notnoneorminimal
Troubleshooting
Server not found:
Socket hang up errors:
Ensure
.mcp.jsonpoints tobuild/index.js(notdist/)SSE streaming handles long-running requests
Codex not working:
Credits
Originally inspired by AllAboutAI-YT. Significantly rewritten with SSE streaming, Codex CLI integration, and improved tool architecture.
Built with MCP • Powered by OpenAI GPT-5