- Explore MCP Servers
- mcp-client-with-openai
Mcp Client With Openai
What is Mcp Client With Openai
mcp-client-with-openai is a TypeScript framework that integrates OpenAI’s GPT-4o with MCP Tool Servers, enabling real-time reasoning through a structured approach.
Use cases
Use cases include building intelligent chatbots, creating automated data analysis tools, developing real-time monitoring systems, and enhancing user interactions in applications.
How to use
To use mcp-client-with-openai, install the dependencies using npm, configure the environment variables including the OpenAI API key, and set up your MCP tool servers in the mcp-config.json file. Finally, build and run the application.
Key features
Key features include seamless tool-calling via MCP Protocol, structured reasoning with the ReAct Planning Loop, real-time streaming with Server-Sent Events, dynamic system prompting, easy extensibility, and session management.
Where to use
mcp-client-with-openai can be used in various fields such as AI development, real-time data processing, interactive applications, and any scenario requiring integration with MCP-compatible tools.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Client With Openai
mcp-client-with-openai is a TypeScript framework that integrates OpenAI’s GPT-4o with MCP Tool Servers, enabling real-time reasoning through a structured approach.
Use cases
Use cases include building intelligent chatbots, creating automated data analysis tools, developing real-time monitoring systems, and enhancing user interactions in applications.
How to use
To use mcp-client-with-openai, install the dependencies using npm, configure the environment variables including the OpenAI API key, and set up your MCP tool servers in the mcp-config.json file. Finally, build and run the application.
Key features
Key features include seamless tool-calling via MCP Protocol, structured reasoning with the ReAct Planning Loop, real-time streaming with Server-Sent Events, dynamic system prompting, easy extensibility, and session management.
Where to use
mcp-client-with-openai can be used in various fields such as AI development, real-time data processing, interactive applications, and any scenario requiring integration with MCP-compatible tools.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP Client TypeScript
A Node.js client for Model Context Protocol (MCP) servers with TypeScript.
Project Architecture
This project follows Clean Code and SOLID principles with a modular architecture:
src/ ├── config/ # Configuration management │ └── environment.ts ├── controllers/ # Request handling logic │ └── ConversationController.ts ├── middleware/ # Express middleware │ └── errorHandler.ts ├── routes/ # API routes │ └── apiRoutes.ts ├── services/ # Core business logic │ ├── MCPService.ts │ ├── OpenAIService.ts │ └── SessionManager.ts ├── types/ # TypeScript type definitions │ └── index.ts ├── utils/ # Utility functions │ ├── helpers.ts │ └── sse.ts └── server.ts # Express server setup
Core Components
- Environment: Centralized configuration management
- MCPService: Handles connections to MCP servers and tool execution
- OpenAIService: Manages OpenAI API interactions
- SessionManager: Manages user chat sessions and active streams
- ConversationController: Implements conversation handling logic
- API Routes: Defines HTTP endpoints for the application
Design Principles Applied
- Single Responsibility Principle: Each class has a single reason to change
- Open/Closed Principle: Components are open for extension but closed for modification
- Dependency Inversion: High-level modules depend on abstractions
- DRY (Don’t Repeat Yourself): Code duplication is minimized
- KISS (Keep It Simple, Stupid): Logic is simple and straightforward
- Separation of Concerns: Clear boundaries between components
Getting Started
Prerequisites
- Node.js (v16+)
- npm or yarn
Installation
- Clone the repository
- Install dependencies:
npm install - Set up environment variables in
.env:PORT=3000 OPENAI_API_KEY=your_openai_api_key - Configure MCP servers in
config/mcp-config.json
Running the Application
Development mode:
npm run dev
Production mode:
npm run build npm start
API Endpoints
GET /api/stream-sse- Server-Sent Events endpoint for real-time chatPOST /api/tool-permission- Approve/deny tool usagePOST /api/inject-message- Inject an assistant messageGET /api/clear-session- Clear a chat session
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










