GPT-MCP Bridge

GPT-MCP Bridge

Enables Claude and other MCP-compatible tools to communicate with OpenAI's GPT models (GPT-5, GPT-5-mini, o3) with conversation history and session management. Features advanced controls like reasoning effort settings, token tracking, and parallel conversation sessions for efficient AI workflows.

Category
Visit Server

README

GPT-MCP Bridge

A Model Context Protocol (MCP) server that enables Claude Code and other MCP-compatible tools to communicate with OpenAI's GPT models, featuring conversation history, session management, and advanced controls.

Features

🎯 Core Capabilities

  • Conversation History - Maintain context across multiple interactions
  • Session Management - Create, manage, and track parallel conversation sessions
  • Multi-Model Support - GPT-5, GPT-5-mini, and o3 models
  • Advanced Controls - Reasoning effort and verbosity parameters
  • Token Tracking - Monitor usage per session for cost management
  • Error Handling - Robust error recovery and session validation

💡 Key Benefits

  • 70% Token Savings - Reuse context without repeating information
  • Parallel Workflows - Handle multiple independent tasks simultaneously
  • Adaptive Responses - Control response length with verbosity settings
  • Smart Model Routing - Choose optimal model for each task

Installation

  1. Clone the repository
git clone https://github.com/yourusername/gpt-mcp.git
cd gpt-mcp
  1. Install dependencies
npm install
  1. Configure environment
cp .env.example .env
# Edit .env and add your OpenAI API key
  1. Build the project
npm run build

Usage

Running the Server

Development mode:

npm run dev

Production mode:

npm start

MCP Tools

1. askGPT

Send prompts to GPT models with optional conversation context.

Parameters:

  • model (required): "gpt-5" | "gpt-5-mini" | "o3"
  • prompt (required): Your question or request
  • reasoning_effort (optional): "minimal" | "low" | "medium" | "high"
  • verbosity (optional): "low" | "medium" | "high"
  • session_id (optional): Session ID for conversation context

Example:

{
  "model": "gpt-5",
  "prompt": "Explain async/await",
  "reasoning_effort": "medium",
  "verbosity": "low",
  "session_id": "abc-123"
}

2. createSession

Create a new conversation session for maintaining context.

Parameters:

  • system_prompt (optional): System message to set context

Returns: Session ID for use in subsequent calls

3. clearSession

Clear a conversation session and its history.

Parameters:

  • session_id (required): Session to clear

4. listSessions

List all active conversation sessions.

Returns: Array of session information including ID, creation time, message count, and token usage

5. getSessionInfo

Get detailed information about a specific session.

Parameters:

  • session_id (required): Session to query

Configuration

Environment Variables

  • OPENAI_API_KEY - Your OpenAI API key (required)

Session Limits

  • Max tokens per session: 100,000
  • Max messages per session: 100
  • Session expiry: 24 hours
  • Auto-cleanup of expired sessions

Example Workflows

Multi-Step Debugging

// Create a session for debugging
session_id = createSession("Help debug React component")

// Step 1: Present the problem
askGPT({
  model: "gpt-5",
  prompt: "My component re-renders on every keystroke",
  session_id: session_id
})

// Step 2: Ask follow-up (context maintained)
askGPT({
  model: "gpt-5",
  prompt: "How do I fix this?",
  session_id: session_id
})

Parallel Tasks

// Create separate sessions for different tasks
bugSession = createSession("Fixing memory leak")
featureSession = createSession("Adding authentication")

// Work on both independently
askGPT({ model: "gpt-5", prompt: "...", session_id: bugSession })
askGPT({ model: "gpt-5-mini", prompt: "...", session_id: featureSession })

Model Selection Guide

GPT-5

  • Best for: Complex tasks, code generation, detailed analysis
  • Reasoning levels: minimal, low, medium, high
  • Use when: Quality is priority over speed

GPT-5-mini

  • Best for: Simple queries, quick responses, cost optimization
  • Reasoning levels: minimal, low, medium, high
  • Use when: Speed and cost are priorities

o3

  • Best for: Logic puzzles, mathematical reasoning, complex problem-solving
  • Reasoning levels: Not applicable (always maximum)
  • Use when: Deep reasoning is required

Architecture

gpt-mcp/
├── src/
│   ├── index.ts              # MCP server setup
│   ├── services/
│   │   ├── openai.ts         # OpenAI API integration
│   │   └── session-manager.ts # Session management
│   ├── tools/
│   │   ├── askGPT.ts         # Main GPT interface
│   │   └── session-tools.ts  # Session management tools
│   └── types/
│       └── index.ts          # TypeScript interfaces

Development

Building

npm run build

Type Checking

npx tsc --noEmit

Project Structure

  • ES Modules - Uses .js extensions in imports
  • Strict TypeScript - Full type safety
  • MCP SDK - Built on official MCP TypeScript SDK

Requirements

  • Node.js >= 18
  • OpenAI API key
  • MCP-compatible client (Claude Code, etc.)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions, please use the GitHub issue tracker.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured