llm-agent-with-mcp
LLM Agent to perform math operations integration integration with MCP server.
GitHubスター
0
ユーザー評価
未評価
お気に入り
0
閲覧数
8
フォーク
0
イシュー
0
README
In this repository I have tried to mimic LLM agent which uses LLM and tools exposed from MCP server to answer question by the user.
This is a similar use case as using agents like Cursor, Claude Desktop, Co-Pilot etc.
About code
mcp_server.py
- Runs MCP server.mcp_client.py
- Creates MCP Client that connects to the MCP server.model.py
- Wrapper class around LLM model. As of now using OpenAIChat model via langchain.calculator.py
- Calculator agent which interacts with model to perform math operations.
MCP Server
MCP server in this example, exposes 4 tools for basic math operations, add
, subtract
, multiply
and divide
.
LLM
LLM wrapper creates and instance of OpenAIChat model, provides system message with appropriate prompt. It also triggers tool call when the model returns response with tool calls.
How to run?
python mcp_server.py & python calculator.py