mcp-server-project

lokeshtalamala1/mcp-server-project

3.2

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.

Tools
4
Resources
0
Prompts
0

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

  1. Clone or Copy the Folder

  2. Create Virtual Environment

    python -m venv .venv
    source .venv/bin/activate   # On Windows: .venv\Scripts\activate
    
  3. Install Dependencies

    pip install -r requirements.txt
    
  4. 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")

šŸ›  Available Tools

Your LLM agent has access to the following MCP tools:

  1. get_customer_transactions(customer_id, months_back)
  2. classify_and_store_transactions(customer_id, months_back)
  3. get_mcc_details(mcc_code)
  4. 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