MCP Server with LangChain and AI Tools

MCP Server with LangChain and AI Tools

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

Category
Visit Server

README

🧠 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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured