OpenAI GPT MCP Server
README.md
# OpenAI GPT MCP Server
A local [Model Context Protocol](https://modelcontextprotocol.io/) server that provides OpenAI GPT text generation over standard input/output.
## Prerequisites
- Node.js 18 or newer
- An OpenAI API key
## Install and build
```powershell
npm install
npm run build
```
Copy `.env.example` to `.env` and set your API key:
```powershell
OPENAI_API_KEY=your_api_key
```
`OPENAI_MODEL` is optional and defaults to `gpt-5`. `OPENAI_IMAGE_MODEL` is optional and defaults to `gpt-image-2`.
## MCP client configuration
Build first, then add this server to your MCP client's configuration. Replace `<absolute-path-to-repository>` with the absolute path to your clone.
```json
{
"mcpServers": {
"openai-gpt": {
"command": "node",
"args": ["<absolute-path-to-repository>\\dist\\index.js"]
}
}
}
```
## Tool: `generate_text`
Required input:
- `prompt`: text to send to the model.
Optional inputs:
- `instructions`: system-level behavior for the response.
- `model`: a GPT model ID, overriding `OPENAI_MODEL`.
- `max_output_tokens`: maximum response size, from 1 through 16,384.
The server uses the OpenAI Responses API and returns generated text to the MCP client. It never writes API keys to output or logs.
## Tool: `generate_image`
Generates one PNG image and returns it directly to the MCP client.
- `prompt` (required): detailed image description.
- `model` (optional): image model ID, overriding `OPENAI_IMAGE_MODEL`.
- `size` (optional): `1024x1024`, `1536x1024`, or `1024x1536`.
- `quality` (optional): `low`, `medium`, or `high`.
Image generation consumes OpenAI API credits separately from Claude usage.
## Run directly
```powershell
npm start
```
For interactive inspection:
```powershell
npm run inspect
```
TDQS
A3.7/5.0
Scored across 2 tools
Disambiguation5/5
The two tools are clearly distinct: one generates text and the other generates images. There is no overlap or ambiguity in their purposes.
Naming Consistency5/5
Both tools follow the same consistent generate_noun pattern using snake_case. The naming convention is uniform and predictable.
Tool Count3/5
Two tools is borderline for a coherent server; they are well-scoped but the surface feels thin for a general OpenAI GPT server. Each tool earns its place, but the count is on the low end.
Completeness4/5
The two-generation capabilities cover the core domain of text and image generation with no obvious dead ends. Minor gaps exist if considering broader OpenAI features like embeddings or audio, but for the stated GPT-focused purpose the coverage is reasonable.
Maintenance
ActivityMaintained
ResponsivenessNo issues