mcp-server-client

devendra4014/mcp-server-client

3.1

If you are the rightful owner of mcp-server-client and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

This project implements a Model Context Protocol (MCP) server that bridges a PostgreSQL database and an AI agent powered by Google's Gemini LLM.

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