Gemini NLP To MySQL Via FastMCP
LLM + FastAPI + MySQL learning project demonstrating CRUD APIs, Gemini NLP-to-database tool calling, and FastMCP for structured execution. Covers modular Python design, REST architecture, and step-by-step evolution from basic functions to LLM-driven backend workflows.
Ask AI about Gemini NLP To MySQL Via FastMCP
Powered by Claude Β· Grounded in docs
I know everything about Gemini NLP To MySQL Via FastMCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
LLM + REST API + MySQL + FastMCP Learning Project
This project is a hands-on implementation to understand:
- LLM API integration from scratch (Gemini)
- REST API development using FastAPI
- MySQL CRUD operations
- Tool calling architecture
- FastMCP for reducing LLM boilerplate code
Each concept is implemented as an independent method for step-by-step learning.
π Project Structure
Gemini-NLP-to-MySQL-via-FastMCP-main
βββ Method_1_Calling_Func_Same_File/
β βββ function_call_1.py
β
βββ Method_2_Calling_Func_From_Different_File/
β βββ other_file_call_2.py
β
βββ Method_3_Using_RestAPI_to_CRUD_Data/
β βββ fastapi_rest_api_method_call_3.py
β
βββ Method_4_Using_Gemini_LLM_API/
β βββ sql_database_tools_funcs.py
β βββ gemini_api_call_4.py
β βββ gemini_llm_just_chat.py
β βββ llm_tools_mapper.py
β
βββ Method_5_Using_FastMCP_Gemini_LLM_API/
β βββ db_tools_mcp.py
β βββ gemini_mcp_client_5.py
β βββ mcp_db_server.py
β
βββ .env.example
βββ .gitignore
βββ requirements.txt
βββ README.md
βοΈ Setup Instructions
1οΈβ£ Clone the repository
git clone https://github.com/dhaRaniv12/Gemini-NLP-to-MySQL-via-FastMCP.git
cd Gemini-NLP-to-MySQL-via-FastMCP-main
2οΈβ£ Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Mac/Linux
venv\Scripts\activate # Windows
3οΈβ£ Install dependencies
pip install -r requirements.txt
4οΈβ£ Configure environment variables
Create a .env file based on .env.example:
API_KEY='YOUR_GEMINI_API_KEY'
SQL_PW = "YOUR_MySQL_PW"
π― Learning Flow
Method 1 -- Function Call (Same File)
Goal: - Understand basic Python function execution - Control flow inside a single script
Run:
python Method_1_Calling_Func_Same_File/function_call_1.py
Method 2 -- Function Call (Different File)
Goal: - Learn modular programming - Use imports and separation of logic across files
Run:
python Method_2_Calling_Func_From_Different_File/other_file_call_2.py
Method 3 -- FastAPI REST API + MySQL (CRUD)
Goal: - Build REST endpoints - Perform Create, Read, Update, Delete operations on MySQL - Test APIs using Swagger UI
Run server:
fastapi dev Method_3_Using_RestAPI_to_CRUD_Data/fastapi_rest_api_method_call_3.py
Open Swagger docs:
http://127.0.0.1:8000/docs
Method 4 -- Gemini LLM API (NLP β DB Operations)
Features:
- Accept natural language input
- Convert NLP β structured database operation
- Execute MySQL queries via
db_tools.py - Tool execution handled by
tool_executor.py gemini_llm_just_chat.pyfor basic chat testing
Run:
python Method_4_Using_Gemini_LLM_API/gemini_api_call_4.py
Example input:
Add a task at tomorrow 3pm to order groceries
Method 5 -- FastMCP + Gemini
Goal:
- Eliminate redundant tool-calling logic from Method 4
- Use FastMCP for standardized tool execution
- Improve maintainability and architecture
Run:
python Method_5_Using_FastMCP_Gemini_LLM_API/gemini_mcp_client_5.py
π§± Tech Stack
- Python
- FastAPI
- MySQL
- google-genai (Gemini API)
- FastMCP
π¨βπ» Purpose
This is a learning-focused backend + LLM integration project designed to understand real-world architecture step by step, from basic Python function calls to LLM-driven database operations.
