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
.env
File Create a.env
file 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.py
to AWS EC2 (or other cloud) - Update the
server.json
to point to a remote server URL - Keep
mcp_client.py
on your local machine to communicate with it