Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Banking MCP Server & LLM Agent Demo

This project demonstrates how to build a Model Context Protocol (MCP) server using FastMCP and connect it to an LLM agent powered by the Groq API.

The demo consists of two main components:

  1. banking_mcp_server.py: A FastMCP server that exposes a tool to fetch a list of available banks from the public Open Bank Project sandbox API.
  2. llm_agent.py: A ReAct-style LLM agent that connects to the MCP server, discovers the available tools, and uses them to answer user questions.

This architecture showcases how to securely and standardly provide external tools and context to any LLM-powered application or chatbot.

Output

🤖 Starting ReAct LLM Agent...
🔌 Connecting to MCP Server at http://127.0.0.1:8080/mcp...
Which banks can I have information about?

--- Turn 1 ---
🧠 Thinking...
🤔 Thought: The user is asking for a list of banks. I should use the 'get_available_banks' tool to fetch this information. The tool has no parameters.
🎬 Action: tool_calls
👀 Observation sent to LLM.

--- Turn 2 ---
🧠 Thinking...
🤔 Thought: The user is asking for a list of banks. I should use the 'get_available_banks' tool to fetch this information. The tool has no parameters.
🎬 Action: tool_calls
👀 Observation sent to LLM.

--- Turn 3 ---
🧠 Thinking...
🤔 Thought: The user is asking for a list of banks. I should use the 'get_available_banks' tool to fetch this information. The tool has no parameters.
🎬 Action: tool_call
  -> Calling tool 'get_available_banks' via MCP server...
  -> Tool executed successfully.
👀 Observation sent to LLM.

--- Turn 4 ---
🧠 Thinking...
🤔 Thought: I have successfully retrieved the list of available banks. I will now present this list to the user to answer their question.
🎬 Action: finish


==================================================
🤖 Final LLM Response:
==================================================
I can provide information on the following banks: Royal Bank of Scotland, Test Bank, Testowy bank, Nordea Bank AB, Hongkong and Shanghai Bank, Erste Bank Test, Deutche Bank Test, Bank X, Bank Y, Abanca, Banca March, Banco Santander, Banco Pastor, Banco Popular, Bankia, Bankinter, BBVA, BMN, CaixaBank, Cetelem, Deutsche Bank, Ibercaja, ING, Kutxabank, Liberbank, Open Bank, Sabadell, Unicaja, and many more.

Prerequisites

Setup

  1. Clone the repository:

    git clone https://github.com/cbarkinozer/mcp-demo
    cd mcp-demo
  2. Install dependencies: It's recommended to use a virtual environment.

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    pip install -r requirements.txt
  3. Set Environment Variable: You only need to set one environment variable for the Groq API key.

    On Linux/macOS:

    export GROQ_API_KEY="your_groq_api_key_here"

    On Windows (Command Prompt):

    set GROQ_API_KEY="your_groq_api_key_here"

    Note: You may need to restart your terminal for the variable to be recognized.

How to Run the Demo

You need to run the server and the agent in two separate terminals.

Terminal 1: Start the MCP Server

Navigate to the project directory and run:

python banking_mcp_server.py

You should see output indicating the server has started and is listening on http://127.0.0.1:8080.

Terminal 2: Run the LLM Agent

In a new terminal (with the same environment variable set), run the agent:

python llm_agent.py

The agent will:

  1. Connect to the MCP server.
  2. Discover the get_available_banks tool.
  3. Use its ReAct loop to think, decide to use the tool, and call it via the MCP server.
  4. Receive the bank data and send it back to Groq for a final, summarized answer.
  5. Print the final, human-friendly response.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages