Skip to main content

Custom Python MCP Client

Overview

The Custom Python MCP Client demonstrates how to integrate a custom Python MCP server with a PraisonAI agent. This client connects to a stock price MCP server to retrieve real-time stock information.

Quick Start

1

Install Dependencies

Install the required packages:
2

Set Up the Server

First, set up the Custom Python MCP Server.
3

Create Custom Python Client

Save the code above to a file named custom-python-client.py.
4

Run the Client

Execute the client script:
Requirements
  • Python 3.10 or higher
  • praisonaiagents and mcp packages
  • A properly configured custom Python MCP server
  • OpenAI API key (for the agent’s LLM)

Environment Variables

For better security and flexibility, you can modify the client to use environment variables:
This approach allows you to set the paths using environment variables: