Skip to content

devendra4014/mcp-server-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCP Server with SQL Alchemy and Gemini LLM

This project implements a Model Context Protocol (MCP) server that provides a bridge between a PostgreSQL database and an AI agent powered by Google's Gemini LLM. The server allows natural language interactions with the database through MCP endpoints.

Features

  • SQL Alchemy integration for database operations
  • MCP Server implementation with standardized endpoints
  • Gemini LLM-powered agent for natural language database interactions
  • PostgreSQL database support
  • Structured query processing and response handling

Project Structure

mcp-server-client/
├── main.py              # Main application entry point
├── pyproject.toml       # Project dependencies and configuration
├── client/             
│   ├── __init__.py     
│   └── db_client.py    # Database client implementation
├── server/             
│   ├── __init__.py    
│   ├── postgres_db.py  # PostgreSQL database connection and operations
│   └── weather.py      # Weather-related functionality

Installation

  1. install uv:
pip install uv
  1. activate virtual environment'
# for linux
source .venv/bin/activate

# for windows
.venv\Scripts\activate
  1. Install dependencies:
uv add mcp[cli] mcp-use psycopg2 psycopg2-binary sqlalchemy langchain-google-genai
  1. Set up environment variables:
# create .env file
touch .env

# add this into .env file
# PostgreSQL connection
DB_URL= "postgresql://postgres:admin@localhost:5432/mydb"
GEMINI_API_KEY= "API_KEY"
  1. start the agent
uv run client/db_client.py 

Example Interactions

Below are some examples of interactions with the SQL agent:

alt text alt text alt text alt text alt text alt text alt text alt text alt text alt text

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages