nightness/gpt5-mcp-server
If you are the rightful owner of gpt5-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This document provides a comprehensive overview of an MCP server that integrates OpenAI's LLM capabilities, specifically GPT-5 models, for use with MCP-compatible AI assistants.
LLM MCP Server
A modern Model Context Protocol (MCP) server providing access to OpenAI's GPT-5 models with optional web search capabilities.
๐ Features
- Two Powerful Tools: Standard queries and web-enhanced queries with real-time search
- Latest GPT-5 Models: Support for gpt-5, gpt-5-mini, and gpt-5-nano
- Proper MCP Implementation: Uses stdio transport following MCP best practices
- Type-Safe & Tested: Full TypeScript support with comprehensive test coverage
- Easy Integration: Works with Claude Desktop, Claude Code, and custom MCP clients
๐ ๏ธ Quick Start
-
Install and setup:
npm install cp .env.example .env # Add your OPENAI_API_KEY to .env
-
Test it works:
npx tsx examples/cli-client.ts "Hello! Introduce yourself."
-
Run tests:
npm test
๐ฏ Usage Examples
# Basic query
npx tsx examples/cli-client.ts "What is TypeScript?"
# Different models
npx tsx examples/cli-client.ts "Explain React hooks" --model gpt-5-mini
# Web search for current info
npx tsx examples/cli-client.ts "What's the weather in Paris?" --web-search
# Advanced reasoning
npx tsx examples/cli-client.ts "Solve this math problem: ..." --reasoning-effort high
See for more detailed usage examples.
๐ง Available Tools
llm_query
- Standard Queries
Perfect for coding help, analysis, explanations, and general tasks.
Parameters:
prompt
(required) - Your question or requestmodelVariant
-gpt-5
(default),gpt-5-mini
,gpt-5-nano
reasoningEffort
-minimal
(default),low
,medium
,high
verbosity
-low
,medium
(default),high
max_tokens
- Maximum response lengthinstructions
- Custom system instructions
llm_query_web
- Web-Enhanced Queries
Same as llm_query
but with real-time web search for current information.
Perfect for:
- Weather and news
- Current events
- Live statistics
- Recent documentation updates
๐ Integration
This server integrates with various MCP clients:
- - Native MCP support
- - Professional development environment
- - With MCP extensions
- - Build your own
See for detailed setup instructions.
๐งช Development
Commands
npm run dev # Development with file watching
npm run build # Compile to JavaScript
npm run type-check # TypeScript validation
npm run start # Run the server directly
npm test # Run tests (interactive)
npm run test:run # Run tests once
Project Structure
โโโ src/
โ โโโ index.ts # MCP server implementation
โโโ examples/
โ โโโ cli-client.ts # Feature-complete CLI client
โ โโโ README.md # Detailed usage examples
โโโ tests/
โ โโโ server.test.ts # Test suite (24+ tests)
โโโ .env.example # Environment template
โโโ README.md # This file
โโโ INTEGRATIONS.md # Integration guides
โโโ package.json # ES module configuration
Testing
The project includes comprehensive test coverage:
- โ Tool schema validation
- โ Parameter processing
- โ OpenAI API integration
- โ Error handling
- โ Response formatting
โ๏ธ Configuration
Create a .env
file:
# Required: Your OpenAI API key
OPENAI_API_KEY=your-openai-api-key-here
๐จ Troubleshooting
Common Issues:
- "Cannot find module" โ Run
npm install
- "Must use import to load ES Module" โ Use
tsx
instead ofnode
- Environment variables not loading โ Verify
.env
file exists withOPENAI_API_KEY
- TypeScript errors โ Run
npm run type-check
Test manually:
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | npx tsx src/index.ts
๐๏ธ Architecture
This is a proper MCP server, not an HTTP API:
โ
MCP Protocol Compliant - Standard stdio transport
โ
Tool Discovery - Dynamic tool listing and schema validation
โ
Process Isolation - Each client gets its own server instance
โ
Type Safety - Full TypeScript integration
โ
No Network Dependencies - Works anywhere, no ports needed
โ Not HTTP-based - No REST endpoints or web server
โ Not WebSocket-based - Uses standard input/output
๐ค Contributing
- Make your changes
- Run tests:
npm run test:run
- Type check:
npm run type-check
- Build:
npm run build
- Test manually:
npx tsx examples/cli-client.ts "test query"
๐ License
MIT License - see the file for details.
A modern MCP server built with TypeScript and OpenAI's GPT-5 models