Skip to main content
Glama

MCP Server with LangChain and AI Tools

by durgeshmca

🧠 MCP Server with LangChain and AI Tools

This project demonstrates how to build a multi-tool AI assistant using the Model Context Protocol (MCP), LangChain, and Groq’s Qwen model. It includes:

  • 📐 A local Math MCP Server
  • 🌤️ A simulated Weather MCP Server
  • 🤖 A conversational AI agent (MCP client) that talks to both

🧰 Features

  • Uses LangChain MCP Adapters to connect tools
  • Powered by Groq's Qwen LLM
  • Handles local and remote tool servers via MCP
  • Interactive CLI chat with tool usage detection

🏁 Prerequisites

  • Python >= 3.11
  • uv for project/environment management (https://github.com/astral-sh/uv)
  • Internet connection for loading LLM (Groq)

⚙️ Setup Instructions

1. Create Project

mkdir mcp_project cd mcp_project uv init

Set Python version in .python-version and pyproject.toml to >=3.11

2. Create Virtual Environment

uv venv source .venv/Scripts/activate

3. Add Dependencies

Create a requirements.txt file: langchain-mcp-adapters langchain-groq langgraph mcp

Install them

uv add -r requirements.txt

Project Structure

mcp_project/ │ ├── math_server.py # MCP server for math tools ├── weather_server.py # MCP server for weather API simulation ├── client.py # MCP client with AI agent ├── requirements.txt ├── .python-version └── .env # For storing Groq API key (GROQ_API_KEY)

How to Run

1. Run the Weather Server

python weather_server.py

2. Run the Client (Automatically runs math server as sub process)

python client.py

Example Conversation

You: What is the output of 2*3/(4-2) AI: The result is 3.0 You: What is the weather in New York? AI: The current weather in New York is sunny. You: thanks AI: You're welcome! 😊

Note

The weather server is simulated. Replace it with real API logic if needed.
You can add more MCP servers for documents, search, DBs, etc.
Use .env to store your GROQ_API_KEY.
-
security - not tested
F
license - not found
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

A multi-tool AI assistant system that uses Model Context Protocol to connect language models with various tools, including math calculations and weather information.

  1. 🧰 Features
    1. 🏁 Prerequisites
      1. ⚙️ Setup Instructions
        1. 1. Create Project
        2. 2. Create Virtual Environment
        3. 3. Add Dependencies
        4. Project Structure
      2. How to Run
        1. 1. Run the Weather Server
        2. 2. Run the Client (Automatically runs math server as sub process)
      3. Example Conversation
        1. Note
          1. The weather server is simulated. Replace it with real API logic if needed.
          2. You can add more MCP servers for documents, search, DBs, etc.
          3. Use .env to store your GROQ_API_KEY.

        Related MCP Servers

        • -
          security
          F
          license
          -
          quality
          A versatile Model Context Protocol server that enables AI assistants to manage calendars, track tasks, handle emails, search the web, and control smart home devices.
          Last updated -
          14
          Python
          • Apple
          • Linux
        • A
          security
          A
          license
          A
          quality
          A customizable Model Context Protocol server implementation that enables AI models to interact with external tools including weather queries, Google search, and camera control functionality.
          Last updated -
          1
          13
          Python
          Apache 2.0
          • Linux
          • Apple
        • A
          security
          F
          license
          A
          quality
          A Model Context Protocol server that provides real-time weather information and 5-day forecasts to AI assistants, supporting multiple languages and flexible units.
          Last updated -
          3
          0
          TypeScript
        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol server that enables AI assistants to communicate with each other using Inter-Process Communication, featuring natural language commands and cross-platform compatibility.
          Last updated -
          9
          78
          Python
          MIT License

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/durgeshmca/MCPServerPOCDemo'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server