OpenAI Multi-Model MCP Server
A Model Context Protocol (MCP) server that enables Claude Code to interact with OpenAI's GPT-5 and GPT-5-mini models.
README
OpenAI Multi-Model MCP Server
A Model Context Protocol (MCP) server that enables Claude Code to interact with OpenAI's GPT-5 and GPT-5-mini models.
Features
- Multi-model support: Choose between GPT-5 and GPT-5-mini per request
- Advanced parameters: Support for reasoning effort, verbosity control, and system instructions
- Type-safe: Built with TypeScript and Zod validation
- Error handling: Comprehensive error handling with structured responses
- MCP compliant: Full compatibility with MCP specification
Quick Start
Claude Code Configuration
Add to your Claude Code MCP configuration (typically in ~/.claude.json):
Option 1 - From GitHub (Recommended):
{
"mcpServers": {
"openai-multi": {
"command": "npx",
"args": ["-y", "github:vladnicula/vlads-openai-mcp-server"],
"env": {
"OPENAI_API_KEY": "sk-your-openai-api-key-here"
}
}
}
}
Option 2 - Local installation:
{
"mcpServers": {
"openai-multi": {
"command": "node",
"args": ["/path/to/vlads-openai-mcp-server/build/index.js"],
"env": {
"OPENAI_API_KEY": "sk-your-openai-api-key-here"
}
}
}
}
Note: Adding this configuration to the root mcpServers object will make it available in all instances of Claude Code.
Setup
If you wanna build this on your local machine, patch thing up, extend things. PRs are welcome btw.
Prerequisites
- Node.js 18+
- OpenAI API key
Installation
-
Clone or navigate to the project directory:
cd /path/to/vlads-openai-mcp-server -
Install dependencies:
npm install -
Create environment configuration (for local testing only):
cp .env.example .env # Edit .env and add your OpenAI API key - only needed for MCP Inspector testing -
Build the project:
npm run build
Configuration
Environment Variables
Create a .env file with:
OPENAI_API_KEY=sk-your-openai-api-key-here
Usage
Available Tools
openai_chat
Chat with OpenAI models including GPT-5 and GPT-5-mini.
Parameters:
model(required): "gpt-5" or "gpt-5-mini"input(required): String text input for the modelinstructions(optional): System-level instructionsreasoning(optional): Object witheffortproperty ("minimal", "low", "medium", "high")text(optional): Object withverbosityproperty ("low", "medium", "high")max_tokens(optional): Maximum tokens in response
Example:
// GPT-5 for complex tasks
await openai_chat({
model: "gpt-5",
input: "Explain quantum computing in detail",
instructions: "You are a helpful physics tutor",
reasoning: {
effort: "high"
},
text: {
verbosity: "high"
}
});
// GPT-5-mini for quick responses
await openai_chat({
model: "gpt-5-mini",
input: "What's the weather like?",
reasoning: {
effort: "minimal"
}
});
Development
Scripts
npm run dev- Run in development mode with hot reloadnpm run build- Build for productionnpm run start- Run built versionnpm run inspector- Test with MCP Inspectornpm run test- Run tests
Testing
Use the MCP Inspector to test the server:
npm run inspector
This will start the MCP Inspector where you can:
- Test tool definitions
- Try different parameter combinations
- Verify error handling
Project Structure
src/
├── index.ts # Main server entry point
├── client.ts # OpenAI API client wrapper
├── tools/
│ ├── index.ts # Tool registry
│ └── chat.ts # Chat tool implementation
├── schemas/
│ └── index.ts # Zod validation schemas
└── utils/
└── env.ts # Environment validation
Model Comparison
| Feature | GPT-5 | GPT-5-mini |
|---|---|---|
| Performance | Best | Fast |
| Cost | Higher | Lower |
| Context Window | 400k tokens | 400k tokens |
| Verbosity Control | Yes | No |
| Multi-modal | Yes | Yes |
Error Handling
The server provides structured error responses:
- Validation errors: Invalid input parameters
- API errors: OpenAI API issues (rate limits, auth, etc.)
- Network errors: Connectivity problems
- Unexpected errors: Any other failures
All errors include helpful messages and, where applicable, error codes.
Troubleshooting
Common Issues
-
Missing API Key
Missing required environment variable: OPENAI_API_KEYSolution: Set your OpenAI API key in the environment
-
Model Not Found
OpenAI API Error: The model 'gpt-5' does not existSolution: Ensure you have access to GPT-5 models in your OpenAI account
-
Rate Limits
OpenAI API Error: Rate limit exceededSolution: Wait and retry, or upgrade your OpenAI plan
Debug Mode
The server logs detailed information to stderr:
- Request details
- Response metadata
- Error information
License
MIT
Contributing
- Follow the existing code style
- Add tests for new features
- Update documentation
- Ensure all tests pass
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。