OpenAI Multi-Model MCP Server

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.

Category
访问服务器

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

  1. Clone or navigate to the project directory:

    cd /path/to/vlads-openai-mcp-server
    
  2. Install dependencies:

    npm install
    
  3. 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
    
  4. 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 model
  • instructions (optional): System-level instructions
  • reasoning (optional): Object with effort property ("minimal", "low", "medium", "high")
  • text (optional): Object with verbosity property ("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 reload
  • npm run build - Build for production
  • npm run start - Run built version
  • npm run inspector - Test with MCP Inspector
  • npm 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:

  1. Test tool definitions
  2. Try different parameter combinations
  3. 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

  1. Missing API Key

    Missing required environment variable: OPENAI_API_KEY
    

    Solution: Set your OpenAI API key in the environment

  2. Model Not Found

    OpenAI API Error: The model 'gpt-5' does not exist
    

    Solution: Ensure you have access to GPT-5 models in your OpenAI account

  3. Rate Limits

    OpenAI API Error: Rate limit exceeded
    

    Solution: 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

  1. Follow the existing code style
  2. Add tests for new features
  3. Update documentation
  4. Ensure all tests pass

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选