mcp-project

lokeshtalamala1/mcp-project

3.1

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

This project demonstrates a Model Context Protocol (MCP) server and client implementation for interacting with a PostgreSQL database.

MCP Project - Database Interaction

This project demonstrates a Model Context Protocol (MCP) server and client implementation for interacting with a PostgreSQL database.

Setup Instructions

Follow these steps to set up and run the project:

  1. Install dependencies manager uv:
pip install uv
  1. Create a virtual environment and activate it:
uv venv
.venv/Scripts/activate
  1. Install project dependencies from requirements.txt:
uv add -r requirements.txt

Running the Server

To run the server with the MCP Inspector for development:

uv run mcp dev server/mcp_server.py

To run the server normally (without inspector):

uv run server/mcp_server.py

Running the Client

To interact with the MCP server:

uv run server/mcp_client.py

Example Usage

Once the client is running, you can ask natural language queries such as:

Provide me the last 6 months transactions of a customer CUST_000023

Project Structure

  • .env : Environment variables (e.g., API keys, database URL).
  • .gitignore : Git ignore rules.
  • .python-version : Python version used.
  • mcp_server.py : Main MCP server implementation.
  • mcp_client.py : MCP client for interacting with the server.
  • pyproject.toml : Project configuration and dependencies.
  • requirements.txt : Required Python dependencies.
  • server.json : MCP server configuration.
  • uv.lock : Lock file generated by uv.

Workflow

  1. mcp_client.py loads server.json → launches MCP server (mcp_server.py) using uv
  2. MCPClient connects to MCPServer
  3. User types query → MCPAgent uses OpenAI + memory + MCP tools
  4. If tool get_customer_transactions is needed → Queries PostgreSQL → Formats results → Returns response
  5. Chatbot prints the result