Gen-AI Developer Classroom notes 09/Jul/2025

Data Generator MCP contd

  • Refer Here for new changes
  • ensure you have delete all the containers and volumes
  • Get the latest version of the code
  • cd into the folder june25/mcp/servers/dummy_sales_data
  • Run the command
docker compose up -d
  • Now open docker desktop and click on phpmyadmin port (8080)
    Preview
    Preview
    Preview
  • Every time to remove all the data generated by experiments and giving a fresh start
docker compose down -v
docker compose up -d

Adding mcp server in python

  • Refer Here for the changes done
    Preview

  • To connect the python code to mysql we need connector and connection string

uv add mysql-connector-python
  • Now create a .env file with the following info
MYSQL_DATABASE ='genaicommerce'
MYSQL_USER = 'qtgenai'
MYSQL_PASSWORD = 'qtgenai'
MYSQL_HOST = 'localhost'
  • We can use a package python-dotenv which loads variables from .env as environmental variables
uv add python-dotenv

Lets implement add Product

  • SQL Query
INSERT INTO products (name, description, price, stock_quantity, category_id, image_url) VALUES
('Laptop Pro X', 'Powerful laptop for professionals.', 1200.00, 50, (SELECT category_id FROM categories WHERE name = 'Electronics'), 'https://placehold.co/600x400/000000/FFFFFF?text=Laptop')
  • Find the purpose of with in python
  • How to use mysql connection to execute an
    • select statement
    • insert statement
  • Refer Here for the changes done.
  • Exercise:
    • Create mcp tool for creating user and category
    • Create a mcp resource for getting latest user and all categories

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading