Skip to main content
Glama
README.md
# GPT-5 MCP Server

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=flat&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)

> **A Model Context Protocol server for GPT-5 interactions and Q&A workflows**

Simple MCP server that provides tools for asking questions, continuing conversations, analyzing responses, and generating follow-ups with GPT-5.

## Features

- **5 Core Tools** - Ask questions, continue conversations, analyze responses
- **Response Analysis** - Quality scoring and feedback
- **Follow-up Generation** - Auto-generate related questions
- **Response Comparison** - Compare multiple responses
- **Error Handling** - Graceful API error handling with test mode

## Quick Start

```bash
# Clone and install
git clone https://github.com/yourusername/gpt5-mcp-server
cd gpt5-mcp-server
npm install

# Set up environment
cp .env.example .env
# Add your OpenAI API key to .env

# Build and run
npm run build
npm start
```

## Installation

1. **Clone the repository:**
   ```bash
   git clone https://github.com/yourusername/gpt5-mcp-server
   cd gpt5-mcp-server
   npm install
   ```

2. **Set up environment:**
   ```bash
   cp .env.example .env
   # Edit .env and add your OpenAI API key
   ```

3. **Build and test:**
   ```bash
   npm run build
   npm run test-server  # Test mode (no API key required)
   ```

## Core Tools

### 1. **ask_gpt5** - Ask GPT-5 Questions
```json
{
  "question": "What is machine learning?",
  "context": "I'm a beginner learning about AI",
  "temperature": 0.7,
  "max_tokens": 500
}
```

### 2. **continue_conversation** - Multi-turn Conversations  
```json
{
  "messages": [
    {"role": "user", "content": "What is Python?"},
    {"role": "assistant", "content": "Python is a programming language..."},
    {"role": "user", "content": "How do I install it?"}
  ]
}
```

### 3. **analyze_response** - Analyze Response Quality
```json
{
  "response": "Your GPT-5 response here...",
  "criteria": ["Accuracy", "Clarity", "Completeness"]
}
```

### 4. **generate_followup_questions** - Generate Follow-ups
```json
{
  "original_question": "What is Python?",
  "response": "Python is a programming language...",
  "count": 3
}
```

### 5. **compare_responses** - Compare Multiple Responses
```json
{
  "question": "What is the best programming language?",
  "responses": [
    {"id": "response_1", "content": "Python is the best because..."},
    {"id": "response_2", "content": "JavaScript is better because..."}
  ]
}
```

## MCP Client Configuration

### Claude Desktop
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
  "mcpServers": {
    "gpt5-qa": {
      "command": "node",
      "args": ["/path/to/gpt5-mcp-server/build/index.js"],
      "env": {
        "OPENAI_API_KEY": "your-api-key-here"
      }
    }
  }
}
```

### Test Mode (No API Key Required)
```json
{
  "mcpServers": {
    "gpt5-qa-test": {
      "command": "tsx",
      "args": ["./src/test-server.ts"],
      "cwd": "/path/to/gpt5-mcp-server"
    }
  }
}
```

## Usage Examples

Once connected to your MCP client:

1. **Ask a basic question:**
   ```
   Use tool: ask_gpt5
   Arguments: {"question": "What is Python?", "temperature": 0.7}
   ```

2. **Continue a conversation:**
   ```
   Use tool: continue_conversation
   Arguments: {
     "messages": [
       {"role": "user", "content": "What is Python?"},
       {"role": "assistant", "content": "Python is a programming language..."},
       {"role": "user", "content": "How do I install it?"}
     ]
   }
   ```

3. **Analyze a response:**
   ```
   Use tool: analyze_response
   Arguments: {"response": "Your GPT response here", "criteria": ["Accuracy", "Clarity"]}
   ```

## Development

### Run in Development Mode
```bash
npm run dev  # Hot reload with tsx
```

### Test Mode (No API Calls)
```bash
npm run test-server  # Uses mock responses
```

### Build for Production
```bash
npm run build
npm start
```

## Error Handling

The server includes graceful error handling:

- **Quota Exceeded**: Shows helpful error message with resolution steps
- **API Errors**: Detailed error information and troubleshooting
- **Test Mode**: Full functionality without API calls when quota is exceeded

## License

MIT License - see [LICENSE](LICENSE) for details.

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Test your changes
5. Submit a pull request