MCP ExplorerExplorer

Mcp Client Openai

@liangpnon a year ago
9 MIT
FreeCommunity
AI Systems
Adapt OpenAI SDK to build MCP Client

Overview

What is Mcp Client Openai

mcp_client_openai is a client designed to adapt the OpenAI SDK for building MCP Clients, addressing the absence of OpenAI SDK compatibility in the official examples.

Use cases

Use cases include building customized AI applications, simulating dynamic server updates, and enhancing client-server interactions in AI-driven projects.

How to use

To use mcp_client_openai, you can refer to the official documentation for developing MCP Clients and check the provided Python example code for implementation guidance.

Key features

Key features include compatibility with the OpenAI SDK, logging enhancements, and the ability to receive specific messages from the server.

Where to use

mcp_client_openai can be used in various fields that require integration with OpenAI’s capabilities, such as AI development, machine learning applications, and interactive systems.

Content

适配 OpenAI SDK 构建 MCP Client

官方文档


项目背景

开发这个适配 OpenAI SDK 的 MCP Client 的原因是,在按照官方示例构建 MCP Client 时,我发现官方示例代码中没有适配 OpenAI SDK 的代码。


文件说明

  • client.py:适配了 OpenAI SDK 的 MCP Client。
  • client_new.py:为解决我在Windows遇到的问题而适配的版本。
  • client_20250316.py:增加了日志以及增加接收来自server的一些特定消息。请看我的知乎文章-从MCP Client-Server 生命周期出发,深入研究 MCP 的完整交互链路 ,里面详细介绍了这个MCP Client的Server生命周期。
  • weather_new.py:增加了模拟动态更新server工具的代码。与client_20250316.py一起使用。

遇到的问题

在构建过程中,我遇到了一些问题。具体可以阅读下我的知乎文章如何构建自己的MCP Client,也可以持续关注我的MCP专栏

问题截图


最后

希望这个项目能对大家有所帮助。

问题反馈

如果您在使用过程中遇到任何问题,欢迎随时反馈。


项目贡献

如果您对这个项目感兴趣,欢迎提交 Pull Request 或 Issue,共同完善这个适配 OpenAI SDK 的 MCP Client。

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers