MCP ExplorerExplorer

Mcp Client

@exyriason a year ago
1 MIT
FreeCommunity
AI Systems
MCP client sample for OpenAI Agents SDK

Overview

What is Mcp Client

mcp_client is an implementation of a Model Context Protocol (MCP) client designed for the OpenAI Agents SDK, enabling the orchestration of multiple agents to collaborate on tasks.

Use cases

Use cases for mcp_client include automating customer service interactions with multiple agents, managing workflows in AI research projects, and coordinating tasks in smart home systems.

How to use

To use mcp_client, create a configuration file named ‘config.json’ that defines the agents, their models, instructions, and MCP server settings. Start the workflow by specifying the starting agent in the configuration.

Key features

Key features of mcp_client include agent orchestration for collaboration, flexible configuration for dynamic MCP server management, easy integration with OpenAI Agents SDK, scalable design for complex workflows, and customizable agent instructions and behaviors.

Where to use

mcp_client can be used in fields that require automation and orchestration of tasks among multiple agents, such as AI development, robotics, and complex data processing.

Content

MCP Client

This project is an implementation of an MCP (Model Context Protocol) client for OpenAI Agents SDK.

Features

  • Dynamic and Flexible Configuration: Effortlessly add or modify MCP servers through a simple configuration file. Explore a curated list of powerful MCP servers here and orchestrate them seamlessly to suit your needs.
  • Supports agent orchestration, allowing multiple agents to collaborate and delegate tasks.
  • Easy integration with OpenAI Agents SDK.
  • Scalable design to handle complex workflows with multiple agents.
  • Customizable agent instructions and behavior.

Requirements

  • Python 3.8 or higher
  • OpenAI Agents SDK (pip install openai-agents)

Usage

Make configuration file (config.json)

{
  "agents": [
    {
      "name": "agent1",
      "model": "model_name",
      "instructions": "Agent 1 instructions",
      "cache_tools_list": true,
      "assistants": [
        "agent2"
      ],
      "mcp_servers": [
        {
          "command": "path/to/command",
          "args": [
            "--arg1",
            "value1"
          ]
        }
      ]
    },
    {
      "name": "agent2",
      "model": "model_name",
      "instructions": "Agent 2 instructions",
      "cache_tools_list": false,
      "assistants": [],
      "mcp_servers": [
        {
          "command": "path/to/command",
          "args": [
            "--arg2",
            "value2"
          ]
        }
      ]
    }
  ],
  "starting_agent": "agent1"
}

Explanation of Fields

  • agents: A list of agent configurations.
    • name: The unique name of the agent.
    • model: The model associated with the agent.
    • instructions: Instructions or description for the agent.
    • cache_tools_list: A boolean indicating whether to cache the tools list.
    • assistants: A list of other agents that this agent can hand off tasks to.
    • mcp_servers: A list of MCP server configurations.
      • command: The command to start the MCP server.
      • args: A list of arguments for the command.
  • starting_agent: The name of the agent to start the workflow.

Notes

  • Ensure that all agents listed in the assistants field exist in the agents list.
  • Warning: Circular dependencies between agents may lead to infinite loops during execution. Ensure that the configuration avoids such scenarios.

Run the client with:

export OPENAI_API_KEY=<Your API KEY>
python main.py <config_file>

Use exit, quit, or q to terminate the program during execution.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers