Home / MCP / MCP ChatGPT Server

MCP ChatGPT Server

Provides access to OpenAI's ChatGPT API via MCP with optional web search and persistent conversation state.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "chatgpt": {
            "command": "uv",
            "args": [
                "--directory",
                "\\\\path\\\\to\\\\mcp-chatgpt-responses",
                "run",
                "chatgpt_server.py"
            ],
            "env": {
                "OPENAI_API_KEY": "YOUR_API_KEY_PLACEHOLDER",
                "DEFAULT_MODEL": "gpt-4o",
                "DEFAULT_TEMPERATURE": "0.7",
                "MAX_TOKENS": "1000"
            }
        }
    }
}

This MCP server lets you access OpenAI's ChatGPT API directly from Claude Desktop, enabling you to run ChatGPT interactions inside an MCP workflow, with optional web search and persistent conversation state across turns.

How to use

You run this MCP server as a local process and connect your MCP client (Claude Desktop) to it. Use the provided tool endpoints to send prompts, enable web search for up-to-date information, and store conversation history so replies feel like a continuous dialogue rather than isolated calls.

How to install

Prerequisites you need on your machine before you start:

- Python 3.10 or higher

- Claude Desktop application

- OpenAI API key

- uv for Python package management

Install via Smithery to set up the ChatGPT Server for Claude Desktop automatically

npx -y @smithery/cli install @billster45/mcp-chatgpt-responses --client claude

Additional setup steps

Clone the project repository, set up a virtual environment, and install dependencies. Then prepare Claude Desktop to run the MCP server with the configured environment variables.

Concrete steps you should follow exactly as shown to run locally:

Using the local MCP server with Claude Desktop

{
  "mcpServers": {
    "chatgpt": {
      "command": "uv",
      "args": [
        "--directory",
        "\\path\\to\\mcp-chatgpt-responses",
        "run",
        "chatgpt_server.py"
      ],
      "env": {
        "OPENAI_API_KEY": "your-api-key-here",
        "DEFAULT_MODEL": "gpt-4o",
        "DEFAULT_TEMPERATURE": "0.7",
        "MAX_TOKENS": "1000"
      }
    }
  }
}

Notes on usage

After configuring Claude Desktop, restart the client and you can start asking questions or initiate a two-way conversation with ChatGPT. The conversation state is managed by OpenAI's Responses API, which keeps context across messages and enables more natural interactions.

Troubleshooting and tips

If Claude Desktop cannot connect, verify that the uv runtime is running from the specified directory and that the OPENAI_API_KEY environment variable is available to the process. Check that the Python environment is activated and dependencies from requirements.txt are installed.

Security considerations

Keep your OpenAI API key secure. Do not share the file containing your key, and restrict access to the machine running the MCP server. Consider using environment-variable management practices to avoid exposing the key in logs or command history.

Examples and usage patterns

Basic usage: Tell Claude to ask ChatGPT a question, and then continue a two-way conversation to explore a topic in depth. Web search usage: Enable web search to retrieve current information and integrate it into the chat flow.

Available tools

ask_chatgpt

Send a prompt to ChatGPT and receive a response with optional model, temperature, and token limits

ask_chatgpt_with_web_search

Send a prompt to ChatGPT with web search enabled to obtain up-to-date information