LangGraph-MCP Client logo

LangGraph-MCP Client

by BrianCusack

This repository demonstrates a low-level example of interacting with an MCP server as a Docker image, connected to a PostgreSQL database for LangGraph agents. It utilizes the Model Context Protocol (MCP) to standardize how applications provide context to LLMs.

View on GitHub

Last updated: N/A

What is LangGraph-MCP Client?

This is a client example showcasing how to connect LangGraph agents with a Model Context Protocol (MCP) server backed by a PostgreSQL database. It provides a way to standardize context provision to LLMs.

How to use LangGraph-MCP Client?

  1. Clone the repository. 2. Set up the PostgreSQL database and MCP server (using the provided Dockerfile). 3. Configure the .env file with your database credentials. 4. Install the UV package. 5. Sync the UV package using uv sync. 6. Run the query agent using uv run queryagent with or without a specific query.

Key features of LangGraph-MCP Client

  • Interaction with MCP server

  • PostgreSQL database integration

  • LangGraph agent example

  • Dockerized MCP server setup

  • Uses langchain_mcp_adapters to load mcp tools

  • Fast agent templating with create_react_agent

Use cases of LangGraph-MCP Client

  • Connecting LangGraph agents to data sources via MCP

  • Standardizing context provision for LLMs

  • Building AI applications that require access to structured data

  • Querying a PostgreSQL database using natural language

  • Demonstrating the use of MCP with LangChain

FAQ from LangGraph-MCP Client

What is MCP?

MCP is an open protocol that standardizes how applications provide context to LLMs.

What are the prerequisites for using this client?

You need Docker, a running and populated PostgreSQL database, and the MCP servers set up.

How do I configure the database connection?

Create a .env file with the database host, port, user, password, and name.

What does uv sync do?

It ensures that the UV package installs the dependencies correctly.

How do I run the query agent?

Use the command uv run queryagent followed by an optional query string.