MCP
Stock Price MCP Integration
Guide for integrating stock price retrieval capabilities with PraisonAI agents using MCP
Add Stock Price Tool to AI Agent
Quick Start
1
Install Dependencies
Create a conda environment and install the required packages:
2
Set API Key
Set your OpenAI API key as an environment variable in your terminal:
3
Create the MCP Server
Create a new file stock_price_server.py
with the following code:
4
Create the Agent
Create a new file stock_price_agent.py
with the following code:
5
Run the Agent
Execute your script:
Requirements
- Python 3.10 or higher
- yfinance package
- mcp-python-sdk package
- praisonaiagents package
- OpenAI API key (for the agent’s LLM)
Gradio UI Example
You can also create a simple web UI for your stock price agent using Gradio:
Install Gradio with:
Was this page helpful?