bull-vision-agent

MCP.Pizza Chef: Cognitive-Stack

Bull Vision Agent is a FastAPI-based MCP client that integrates Telegram via webhooks and leverages the OpenAI Agents SDK to provide AI-powered stock trading assistance. It manages multiple MCP servers through MCPHub, enabling real-time stock data analysis, market news integration, and trading context management with persistent MongoDB storage.

Use This MCP client To

Provide AI-driven stock trading advice via Telegram bot Analyze real-time stock data using multiple MCP servers Detect volume walls and analyze stock news automatically Track conversation history for personalized trading context Integrate market news into trading decision workflows Manage multiple MCP servers through a centralized client Persist trading data and context using MongoDB Enable webhook-based Telegram bot interactions for trading

README

Bull Vision Agent

A FastAPI application that integrates with Telegram using webhooks and OpenAI Agents SDK for AI-powered stock trading assistance, utilizing MCPHub for multiple MCP server management.

Features

  • Telegram bot integration with webhook support
  • AI-powered stock analysis using OpenAI Agents SDK
  • Multiple MCP server integration via MCPHub:
    • Stock news analysis
    • Volume wall detection
  • Real-time stock data analysis
  • Market news integration
  • Conversation history tracking
  • Trading context management
  • MongoDB integration for data persistence

Project Structure

├── app/
│   ├── __init__.py
│   ├── main.py           # FastAPI app with MCPHub initialization
│   ├── api/
│   │   ├── __init__.py
│   │   └── telegram_webhook.py  # Telegram webhook endpoint
│   ├── bot/
│   │   ├── __init__.py
│   │   ├── bot.py            # Bot instance and context management
│   │   ├── agent.py          # AI agent implementation with MCP servers
│   │   ├── context.py        # Conversation context and history
│   │   └── telegram_handler.py  # Process incoming messages
│   ├── core/
│   │   ├── __init__.py
│   │   └── settings.py   # Application settings
│   ├── models/
│   │   ├── __init__.py
│   │   └── news.py           # News data models
│   ├── services/
│   │   ├── __init__.py
│   │   └── mongodb_service.py # MongoDB operations
│   └── startup.py        # Startup events

Setup

  1. Clone the repository

  2. Install dependencies:

    poetry install
  3. Copy .env.example to .env and fill in the required values:

    cp .env.example .env
  4. Edit .env with your actual values:

    • TELEGRAM_BOT_TOKEN: Your Telegram bot token from @BotFather
    • TELEGRAM_WEBHOOK_URL: The public URL where your bot will receive updates
    • HOST and PORT: Server configuration
    • AZURE_OPENAI_API_KEY: Your Azure OpenAI API key
    • AZURE_OPENAI_ENDPOINT: Your Azure OpenAI endpoint
    • AZURE_OPENAI_DEPLOYMENT: Your Azure OpenAI deployment name
    • AZURE_OPENAI_API_VERSION: Azure OpenAI API version
    • MONGO_URI: MongoDB connection string
    • MONGO_DB: MongoDB database name

Running the Application

Start the server:

make run

Webhook Setup

  1. Make sure your server is publicly accessible
  2. The webhook URL should be in the format: https://your-domain.com/api/telegram/webhook
  3. The webhook will be automatically registered when the application starts

Available Commands

  • /start - Start the bot
  • /help - Show help message

Example Queries

You can ask the bot about:

  • Stock analysis (e.g., "Analyze AAPL")
  • Market news (e.g., "What's the latest news about Tesla?")
  • Trading strategies (e.g., "What's your view on the current market?")
  • Volume analysis (e.g., "Check volume patterns for MSFT")

Development Commands

make install    # Install dependencies
make run       # Run the application
make test      # Run tests
make lint      # Run linters
make format    # Format the code
make clean     # Clean up generated files
make setup     # Setup development environment
make check     # Run all checks

Documentation

For detailed instructions on:

  1. Setting up the AI Chatbot with Telegram and OpenAI Agents SDK, see init_telegram_openai_agent.md
  2. Using MCPHub with multiple MCP servers, see create_telegram_chatbot_multi_mcp_server.md

bull-vision-agent FAQ

How does Bull Vision Agent integrate with Telegram?
It uses Telegram webhooks to receive messages and interact with users in real time.
What role does MCPHub play in Bull Vision Agent?
MCPHub manages multiple MCP servers, allowing the client to coordinate stock news analysis and volume wall detection.
How is trading context managed within the agent?
The agent tracks conversation history and trading context to provide relevant AI-powered stock insights.
What data persistence solution does Bull Vision Agent use?
It uses MongoDB to store conversation history and trading-related data persistently.
Can Bull Vision Agent analyze real-time stock data?
Yes, it integrates multiple MCP servers to analyze live stock data and market news.
Which AI SDK does Bull Vision Agent utilize?
It uses the OpenAI Agents SDK, compatible with providers like OpenAI, Anthropic Claude, and Google Gemini.
Is Bull Vision Agent limited to stock trading use cases?
While focused on stock trading, its architecture supports extension to other financial data analysis tasks.
How does the client handle multiple MCP servers?
Through MCPHub, it orchestrates communication and data flow between various MCP servers seamlessly.