openai-agents-mcp

openai-agents-mcp

MCP server that bridges OpenAI's Agents SDK with Claude Code, enabling web search, file search, and computer use capabilities directly in your development environment.

Category
访问服务器

README

OpenAI Agents MCP 🤖

npm version License: MIT

A Model Context Protocol (MCP) server that bridges OpenAI's Agents SDK with Claude Code and other MCP clients. Enable powerful AI agent capabilities including web search, file search, and computer use directly in your development environment.

🚀 Quick Start

npx openai-agents-mcp

That's it! The server will start and be ready to accept MCP connections.

🎯 Features

  • 🔍 Web Search - Search the web using OpenAI's integrated web search capability
  • 📁 File Search - Analyze and search through files with AI-powered understanding
  • 💻 Computer Use - Interact with computer interfaces (preview feature, requires tier 3-5)
  • ⚡ Real-time Streaming - Stream responses for better user experience
  • 🔧 Claude Code Ready - Works seamlessly with Claude Code via stdio transport
  • 🧪 Test-Driven - Comprehensive test suite with high coverage
  • 📦 NPX Compatible - Run directly without installation

📋 Prerequisites

  • Node.js 18.0.0 or higher
  • OpenAI API key
  • For computer use: OpenAI usage tier 3-5

🔧 Installation & Setup

Option 1: NPX (Recommended)

No installation needed! Just run:

npx openai-agents-mcp

Option 2: Global Installation

npm install -g openai-agents-mcp
openai-agents-mcp

Option 3: From Source

git clone https://github.com/merlinrabens/openai-agents-mcp.git
cd openai-agents-mcp
npm install
npm run build
npm start

⚙️ Configuration

Environment Variables

Create a .env file in your project root:

# Required
OPENAI_API_KEY=sk-...your-key-here

# Optional
OPENAI_ORGANIZATION=org-...         # Your org ID
ENABLE_COMPUTER_USE=true            # Enable computer use (requires tier 3-5)
LOG_LEVEL=info                      # debug | info | warn | error

Claude Code Integration

Add to your Claude Code configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "openai-agents": {
      "command": "npx",
      "args": ["openai-agents-mcp"],
      "env": {
        "OPENAI_API_KEY": "sk-...your-key-here"
      }
    }
  }
}

Then restart Claude Code to activate the server.

💡 Usage Examples

Once configured, you can use these commands in Claude Code:

Web Search

Use the web_search tool to find the latest news about AI developments

File Search

Use the file_search tool to analyze this codebase and find all API endpoints

Computer Use (if enabled)

Use the computer_use tool to take a screenshot of the current screen

🏗️ Architecture

┌─────────────┐     MCP Protocol     ┌──────────────┐     OpenAI API     ┌──────────┐
│ Claude Code │ ◄──────────────────► │  This Server │ ◄─────────────────► │  OpenAI  │
│   or other  │      stdio/HTTP       │              │    Agents SDK       │  Agents  │
│ MCP Client  │                       │              │                     │          │
└─────────────┘                       └──────────────┘                     └──────────┘

Key Components

  • MCP Server Core - Handles MCP protocol using @modelcontextprotocol/sdk
  • OpenAI Integration - Uses @openai/agents SDK for agent capabilities
  • Tool Translation - Maps MCP tool calls to OpenAI function calls
  • Stream Handler - Manages real-time streaming responses
  • Error Handler - Provides retry logic and graceful error handling

🧪 Development

Setup Development Environment

# Clone the repository
git clone https://github.com/merlinrabens/openai-agents-mcp.git
cd openai-agents-mcp

# Install dependencies
npm install

# Run in development mode
npm run dev

Available Scripts

npm run dev          # Development mode with hot reload
npm test            # Run test suite
npm run test:watch  # Run tests in watch mode
npm run test:coverage # Generate coverage report
npm run build       # Build for production
npm run lint        # Run ESLint
npm run format      # Format with Prettier

Project Structure

src/
├── server/         # MCP server implementation
│   └── index.ts    # Main server class
├── openai/         # OpenAI Agents SDK integration
│   └── client.ts   # OpenAI client wrapper
├── tools/          # Tool definitions
├── config/         # Configuration management
└── utils/          # Utilities and helpers

tests/              # Test suite
bin/               # CLI entry point
examples/          # Usage examples

📊 Testing

The project follows Test-Driven Development (TDD) principles:

# Run all tests
npm test

# Watch mode for development
npm run test:watch

# Coverage report
npm run test:coverage

Current test coverage: ~71%

💰 Pricing

This server uses OpenAI's API, which has the following pricing (as of March 2025):

  • Input: $3 per 1M tokens
  • Output: $12 per 1M tokens
  • Computer Use: Research preview (requires tier 3-5)

🤝 Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Write tests first (TDD approach)
  4. Implement your feature
  5. Ensure all tests pass
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

📝 License

MIT License - see LICENSE file for details

🙏 Acknowledgments

Built with:

🐛 Troubleshooting

Server won't start

  • Ensure OPENAI_API_KEY is set correctly
  • Check Node.js version is 18.0.0 or higher
  • Run npm run build if running from source

Claude Code doesn't see the server

  • Restart Claude Code after updating configuration
  • Check the configuration file path is correct
  • Verify the server starts without errors: npx openai-agents-mcp

Computer use not working

  • Verify your OpenAI account is tier 3-5
  • Set ENABLE_COMPUTER_USE=true in environment

📧 Support

🚦 Status

  • ✅ Web Search - Fully functional
  • ✅ File Search - Fully functional
  • ⚠️ Computer Use - Preview (requires tier 3-5)
  • 🚧 OpenAI Agents SDK - Preview as of March 2025

Note: The OpenAI Agents SDK is currently in preview. Features and pricing may change. The deprecated Assistants API will be sunset by mid-2026 in favor of the Agents SDK.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选