MCP ExplorerExplorer

Openai Agent Sdk Plus Mcp

@Neurl-LLCon a year ago
1 MIT
FreeCommunity
AI Systems
Integrates MCP with OpenAI Agent SDK for context-aware applications.

Overview

What is Openai Agent Sdk Plus Mcp

OpenAI_Agent_SDK_plus_MCP is a repository that demonstrates the integration of the Model Context Protocol (MCP) with the OpenAI Agent SDK to create context-aware applications. It includes various agent implementations for local, remote, and voice interactions.

Use cases

Use cases include building chatbots that understand context, developing voice-activated assistants, creating applications that require real-time data processing, and implementing systems that leverage the capabilities of the MCP for enhanced user interactions.

How to use

To use OpenAI_Agent_SDK_plus_MCP, install the OpenAI Agent SDK using ‘pip install openai-agents’. For the Local Agent, navigate to the ‘mcp_server_stdio’ directory and run ‘python main.py’. For the Remote Agent, run the MCP server with ‘python server.py’ and then run the agent with ‘python main.py’. The Voice Agent follows a similar installation process.

Key features

Key features include the ability to connect to both local and remote MCP servers, support for voice interactions, and the provision of example implementations for different types of agents.

Where to use

OpenAI_Agent_SDK_plus_MCP can be used in various fields such as software development, artificial intelligence applications, voice recognition systems, and any context-aware application requiring interaction with an MCP server.

Content

Model Context Protocol (MCP) + OpenAI Agent SDK

This repository demonstrates how to leverage the Model Context Protocol (MCP) within the OpenAI Agent SDK to build context-aware applications. It includes three example implementations:

  • Local Agent: Connects to a local MCP server using Standard Input and Output (STDIO).
  • Remote Agent: Connects to a remote MCP server using Server-Sent Events (SSE).
  • Voice Agent: Integrates with an MCP server to enable voice-based interactions.

The examples are organized into the following directories:

  • mcp_server_sse: Contains the implementation for the SSE-based remote agent.
  • mcp_server_stdio: Contains the implementation for the STDIO-based local agent.
  • mcp_voice_agent: Contains the implementation for the voice-enabled agent.

Local Agent

To run the local agent example, you only need to install the OpenAI Agent SDK:

pip install openai-agents

You don’t need to install the MCP SDK separately, as it is already included as a dependency of the OpenAI Agent SDK.

Once the installation is complete, navigate to the mcp_server_stdio directory and run the main.py script:

python main.py

This would launch a REPL that would let you use the Filesystem MCP server to interact with the sample_folder

Remote Agent

The installation for the remote agent example is the same. Although this example depends on uvicorn and starlette but these are already dependencies of the MCP SDK.

To run this example first run the MCP server which is in the server.py file.

python server.py

Then run the agent as well which is in the main.py file.

python main.py

Again this launches an REPL but instead of connecting to an MCP server via standard Input and Output it connects to the server running on local host via SSE.

Voice Agent

The installation process for the voice Agent is a bit different you need to install the OpenAI Agent SDK with voice dependencies.

pip install 'openai-agents[voice]'

Then install sounddevice:

pip install sounddevice

With this you can now run the the main.py python script.

python main.py

This will launch a REPL with a voice-based interface, allowing you to interact with the MCP server using voice commands instead of text.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers