GPT-5 MCP服务器
> GPT-5交互和问答工作流的模型上下文协议服务器
简单的MCP服务器,提供提问、继续对话、分析回复和生成GPT-5跟进的工具。
特性
- 5核心工具 -提问、继续对话、分析回答
- 响应分析 -质量评分和反馈
- 后续生成 -自动生成相关问题
- 响应比较 -比较多个响应
- 错误处理 -优雅的API错误处理与测试模式
快速开始```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
## 安装
1. **克隆存储库:**```bash
git clone https://github.com/yourusername/gpt5-mcp-server
cd gpt5-mcp-server
npm install
- 设置环境:```bash
cp .env.example .env
Edit .env and add your OpenAI API key
1. **构建和测试:**```bash
npm run build
npm run test-server # Test mode (no API key required)
核心工具
1. ask_gpt5 -问GPT-5问题```json
{
"question": "What is machine learning?",
"context": "I'm a beginner learning about AI",
"temperature": 0.7,
"max_tokens": 500
}
### 2. **继续对话** -多回合对话```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. 分析响应 -分析响应质量```json
{
"response": "Your GPT-5 response here...",
"criteria": ["Accuracy", "Clarity", "Completeness"]
}
### 4. **生成后续问题** -生成跟进```json
{
"original_question": "What is Python?",
"response": "Python is a programming language...",
"count": 3
}
5. 比较响应 -比较多个响应```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客户端配置
### 克劳德桌面
增添 `~/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"
}
}
}
}
测试模式(不需要API密钥)```json
{
"mcpServers": {
"gpt5-qa-test": {
"command": "tsx",
"args": ["./src/test-server.ts"],
"cwd": "/path/to/gpt5-mcp-server"
}
}
}
## 使用示例
连接到MCP客户端后:
1. **问一个基本问题:**```
Use tool: ask_gpt5
Arguments: {"question": "What is Python?", "temperature": 0.7}
- 继续对话:```
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?"}
]
}
1. **分析响应:**```
Use tool: analyze_response
Arguments: {"response": "Your GPT response here", "criteria": ["Accuracy", "Clarity"]}
发展
以开发模式运行```bash
npm run dev # Hot reload with tsx
### 测试模式(无API调用)```bash
npm run test-server # Uses mock responses
为生产而建```bash
npm run build
npm start
```
错误处理
服务器包括优雅的错误处理:
- 超出配额:显示带有解决步骤的有用错误消息
- API错误:详细的错误信息和故障排除
- 测试模式:超过配额时无需API调用的完整功能
许可证
MIT许可证-请参阅 许可证 了解详情。
贡献
- 分叉存储库
- 创建要素分支
- 进行更改
- 测试您的更改
- 提交拉取请求
