lokeshtalamala1/mcp-server-project
If you are the rightful owner of mcp-server-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.
The MCP Server Project is a local server-client architecture designed to facilitate querying a PostgreSQL banking database using AI agent tools powered by OpenAI.
MCP Server Project (Local)
This project demonstrates a complete local MCP server + client architecture for querying a PostgreSQL banking database via AI agent tools using OpenAI.
📁 Project Structure
mcp-server-project/
├── mcp_server.py # MCP server with database tools
├── mcp_client.py # Interactive agent with OpenAI LLM
├── server.json # MCP client config for launching the server
├── .env # API key for OpenAI (DO NOT COMMIT)
├── requirements.txt # Project dependencies
└── README.md # Setup and usage instructions
✅ Prerequisites
- Python 3.10+
- PostgreSQL running locally with the correct schema
- Access to OpenAI API key (put it in
.env)
🔧 Setup Instructions
-
Clone or Copy the Folder
-
Create Virtual Environment
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate -
Install Dependencies
pip install -r requirements.txt -
Set Up
.envFile Create a.envfile in the root:OPENAI_API_KEY=your-api-key-here
🚀 Running the Project
1️⃣ Start the MCP Client (automatically launches server)
python mcp_client.py
- This will:
- Load
server.json - Start
mcp_server.py - Connect to it via MCPClient
- Create a memory-enabled LLM agent
- Accept user queries (e.g., "Get transactions for customer 12345")
- Load
🛠 Available Tools
Your LLM agent has access to the following MCP tools:
get_customer_transactions(customer_id, months_back)classify_and_store_transactions(customer_id, months_back)get_mcc_details(mcc_code)get_tc_details(tc_code)
📦 Database Config
Database credentials are pulled from .env. Update them as needed:
DB_HOST=localhost
DB_PORT=5432
DB_NAME=mcp_db
DB_USER=postgres
DB_PASS=lokit@181903
Update the mcp_server.py accordingly if you want to use dynamic environment variables.
🔄 Transition to Remote Server (Later)
This setup is for local development only. Once tested, you can:
- Deploy
mcp_server.pyto AWS EC2 (or other cloud) - Update the
server.jsonto point to a remote server URL - Keep
mcp_client.pyon your local machine to communicate with it