Gen-AI Developer Classroom notes 14/May/2026

Running mcp servers closer what enterprises doe

  • Organizations run mcp servers in 3 ways

    • on virtual machines
    • inside containers on a dedicated servers
    • cloud hosted
  • We will be using containerized option

  • Step 1: Lets run mysql in a docker container

  • Step 2: To view the data in mysql we have multiple ways

  • IN the the following code i have create a docker compose file with

    • mysql
    • phpmyadmin
  • Mysql runs on 3306 on localhost and phpmyadmin on 18080
# to bring up
docker compose up -d

# to bring down 
docker compose down

# to bring down and wipe database contents
docker compose down -v
# create some folder cd into it
git clone https://github.com/GenAIDevelopment/agenticai.git

cd agenticai/may26/mcp/library-mcp
uv sync
code .
  • Small research
Explore the idea of how to create a record in mysql table from python
   * SQL statement
   * ORM Frameworks
  • Now lets setup the mysql connection details into mcp sever
  • Environmental variables for mysql connection details
MYSQL_USERNAME
MYSQL_PASSWORD
MYSQL_HOST
MYSQL_DATABASE
  • Lets add a depenency called as python-dotenv
uv add python-dotenv
  • Create a .env file with following content
MYSQL_USERNAME=root
MYSQL_PASSWORD=rootpassword
MYSQL_HOST=localhost
MYSQL_DATABASE=library
  • To load environment variables
from dotenv import load_dotenv
import os

load_dotenv()
print(os.getenv('MYSQL_USERNAME'))

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