数学运算代理客户端

MCP客户端通过LangChain创建代理,连接MCP服务器执行自然语言数学运算。

  • by upxill
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 upxill/langchain-mcp-client

使用说明

MCP Client

An MCP (Model Context Protocol) client that connects to an MCP server and uses LangChain to create an agent that can perform mathematical operations.

Overview

This client application:

  • Connects to an MCP server running on http://localhost:8000/mcp
  • Loads available tools from the server (math operations: add, sub, mul, div)
  • Creates a LangChain agent powered by Claude Sonnet 4.5
  • Executes natural language queries like "what's (3 + 5) x 12?"

Prerequisites

  • Python 3.13+
  • An MCP server running on http://localhost:8000/mcp

Installation

uv sync

Running

uv run main.py

Architecture

The client uses:

  • MCP (Model Context Protocol): For server-client communication via HTTP
  • LangChain: For agent creation and orchestration
  • Claude Sonnet 4.5: As the language model backend

Dependencies

  • mcp: Model Context Protocol library
  • langchain: LangChain framework
  • langchain-mcp-adapters: Adapters for MCP integration with LangChain